transone-chart 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/charts/bar.d.ts +5 -1
- package/dist/charts/line.d.ts +5 -1
- package/dist/charts/pie.d.ts +3 -1
- package/dist/charts/radar.d.ts +3 -1
- package/dist/component.d.ts +21 -2
- package/dist/core/chart.d.ts +23 -2
- package/dist/core/debounce.d.ts +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +12 -11
- package/dist/types.d.ts +42 -0
- package/lib/charts/bar.ts +95 -8
- package/lib/charts/line.ts +62 -3
- package/lib/charts/pie.ts +102 -10
- package/lib/charts/radar.ts +52 -1
- package/lib/component.ts +176 -7
- package/lib/core/chart.ts +166 -1
- package/lib/core/debounce.ts +52 -0
- package/lib/index.ts +4 -0
- package/lib/types.ts +46 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ class MyPage extends Component {
|
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
`TcChart` 是**受控组件**:`option` 由父级传入,数据变化自动 `setOption + render`;组件卸载自动销毁。
|
|
46
|
+
尺寸变化(容器宽度 / 窗口横竖屏)自动**防抖重绘(150ms)**:Web 用 ResizeObserver 增量 `resize + render`,
|
|
47
|
+
小程序端用窗口尺寸回调重建,无需手动调用。
|
|
46
48
|
|
|
47
49
|
### 方式二:引擎直用(无框架场景)
|
|
48
50
|
|
|
@@ -71,7 +73,7 @@ chart3.render();
|
|
|
71
73
|
|---|---|---|
|
|
72
74
|
| 折线 | `LineChartOption` | `smooth` 平滑曲线、`area` 面积填充、`showSymbol` 数据点、`startFromZero` |
|
|
73
75
|
| 柱状 | `BarChartOption` | `stack` 堆叠分组、`horizontal` 横向、`borderRadius` 圆角、`barWidth` |
|
|
74
|
-
| 饼图 | `PieChartOption` | `radius / innerRadius`(环形)、`startAngle
|
|
76
|
+
| 饼图 | `PieChartOption` | `radius / innerRadius`(环形)、`startAngle`、`labelPosition: 'outside'` 引线外置标签 |
|
|
75
77
|
| 雷达 | `RadarChartOption` | `indicators[].max` 归一化、`splitCount` 网格层、`area` 多边形填充 |
|
|
76
78
|
|
|
77
79
|
完整字段见 [`lib/types.ts`](./lib/types.ts)(每个字段均带中文注释)。
|
|
@@ -157,7 +159,7 @@ save → scale(dpr) → clear → 背景 → 布局(title/legend/轴区逐层扣
|
|
|
157
159
|
## 开发
|
|
158
160
|
|
|
159
161
|
```bash
|
|
160
|
-
bun test #
|
|
162
|
+
bun test # 62 个单测(mock canvas 断言绘制命令 + 防抖 / resize / tooltip 命中)
|
|
161
163
|
bun run build # tsc 声明 + Bun.build(minify, ESM)
|
|
162
164
|
bun run --cwd ../../playground/chart-demo build:web # 演示项目构建
|
|
163
165
|
```
|
|
@@ -167,7 +169,7 @@ bun run --cwd ../../playground/chart-demo build:web # 演示项目构建
|
|
|
167
169
|
```
|
|
168
170
|
packages/transone-chart/
|
|
169
171
|
├── lib/ # 源码(core / charts / adapters / factory / component / types)
|
|
170
|
-
├── tests/ # 单测(scale / layout / line / bar / pie / radar / factory)
|
|
172
|
+
├── tests/ # 单测(scale / layout / line / bar / pie / radar / factory / debounce / resize)
|
|
171
173
|
├── scripts/build.ts # 构建脚本
|
|
172
174
|
└── playground 演示:playground/chart-demo(城市指数场景,五种图表卡片)
|
|
173
175
|
```
|
|
@@ -175,7 +177,8 @@ packages/transone-chart/
|
|
|
175
177
|
## 路线图
|
|
176
178
|
|
|
177
179
|
- [x] 一期:折线 / 柱状 / 饼 / 雷达 + Web / 小程序 + 原生契约
|
|
178
|
-
- [
|
|
180
|
+
- [x] tooltip:Web 悬浮命中数据点 / 柱体 / 扇区显示数值,formatter 自定义内容
|
|
181
|
+
- [ ] 交互增强:hover 高亮 / 点击事件(event 层)
|
|
179
182
|
- [ ] 更多图表:散点 / 面积 / 漏斗 / 仪表盘
|
|
180
183
|
- [ ] 原生 App 适配器实现(iOS / Android / 鸿蒙桥层)
|
|
181
184
|
- [ ] 主题系统 / 动画过渡
|
package/dist/charts/bar.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { ICanvas2D } from '../core/canvas';
|
|
|
10
10
|
import { ChartBase } from '../core/chart';
|
|
11
11
|
import type { LayoutResult } from '../core/layout';
|
|
12
12
|
import type { LegendItem } from '../core/legend';
|
|
13
|
-
import type { BarChartOption } from '../types';
|
|
13
|
+
import type { BarChartOption, TooltipParams } from '../types';
|
|
14
14
|
export declare class BarChart extends ChartBase<BarChartOption> {
|
|
15
15
|
protected isHorizontal(): boolean;
|
|
16
16
|
protected getValueDomain(): {
|
|
@@ -20,6 +20,10 @@ export declare class BarChart extends ChartBase<BarChartOption> {
|
|
|
20
20
|
protected getCategoryLabels(): readonly string[];
|
|
21
21
|
protected getLegendItems(): LegendItem[];
|
|
22
22
|
protected drawSeries(ctx: ICanvas2D, layout: LayoutResult, option: BarChartOption): void;
|
|
23
|
+
/** 命中检测:点落在某类目的柱体带内即显示该类目所有系列值。 */
|
|
24
|
+
protected hitTestSeries(x: number, y: number): TooltipParams | null;
|
|
25
|
+
/** 从 hover 状态解析命中的类目索引,未命中返回 -1。 */
|
|
26
|
+
private getHoverCategoryIndex;
|
|
23
27
|
private computeSlot;
|
|
24
28
|
private drawBar;
|
|
25
29
|
}
|
package/dist/charts/line.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { ICanvas2D } from '../core/canvas';
|
|
|
6
6
|
import { ChartBase } from '../core/chart';
|
|
7
7
|
import type { LayoutResult } from '../core/layout';
|
|
8
8
|
import type { LegendItem } from '../core/legend';
|
|
9
|
-
import type { LineChartOption } from '../types';
|
|
9
|
+
import type { LineChartOption, TooltipParams } from '../types';
|
|
10
10
|
export declare class LineChart extends ChartBase<LineChartOption> {
|
|
11
11
|
protected getValueDomain(): {
|
|
12
12
|
min: number;
|
|
@@ -15,6 +15,10 @@ export declare class LineChart extends ChartBase<LineChartOption> {
|
|
|
15
15
|
protected getCategoryLabels(): readonly string[];
|
|
16
16
|
protected getLegendItems(): LegendItem[];
|
|
17
17
|
protected drawSeries(ctx: ICanvas2D, layout: LayoutResult, option: LineChartOption): void;
|
|
18
|
+
/** 命中检测:x 落在某类目带内即显示该类目所有系列值(y 在绘图区内即可)。 */
|
|
19
|
+
protected hitTestSeries(x: number, y: number): TooltipParams | null;
|
|
20
|
+
/** 从 hover 状态解析命中的类目索引,未命中返回 -1。 */
|
|
21
|
+
private getHoverCategoryIndex;
|
|
18
22
|
/** 折线路径:直线或 Catmull-Rom 平滑插值(三次贝塞尔)。 */
|
|
19
23
|
private tracePath;
|
|
20
24
|
}
|
package/dist/charts/pie.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ import type { ICanvas2D } from '../core/canvas';
|
|
|
6
6
|
import { ChartBase } from '../core/chart';
|
|
7
7
|
import type { LayoutResult } from '../core/layout';
|
|
8
8
|
import type { LegendItem } from '../core/legend';
|
|
9
|
-
import type { PieChartOption } from '../types';
|
|
9
|
+
import type { PieChartOption, TooltipParams } from '../types';
|
|
10
10
|
export declare class PieChart extends ChartBase<PieChartOption> {
|
|
11
11
|
protected hasCartesianAxis(): boolean;
|
|
12
12
|
protected getLegendItems(): LegendItem[];
|
|
13
|
+
/** 命中检测:点落在某扇区(环形环带内)即显示该扇区名与数值占比。 */
|
|
14
|
+
protected hitTestSeries(x: number, y: number): TooltipParams | null;
|
|
13
15
|
protected drawSeries(ctx: ICanvas2D, layout: LayoutResult, option: PieChartOption): void;
|
|
14
16
|
}
|
package/dist/charts/radar.d.ts
CHANGED
|
@@ -6,11 +6,13 @@ import type { ICanvas2D } from '../core/canvas';
|
|
|
6
6
|
import { ChartBase } from '../core/chart';
|
|
7
7
|
import type { LayoutResult } from '../core/layout';
|
|
8
8
|
import type { LegendItem } from '../core/legend';
|
|
9
|
-
import type { RadarChartOption } from '../types';
|
|
9
|
+
import type { RadarChartOption, TooltipParams } from '../types';
|
|
10
10
|
export declare class RadarChart extends ChartBase<RadarChartOption> {
|
|
11
11
|
protected hasCartesianAxis(): boolean;
|
|
12
12
|
protected getLegendItems(): LegendItem[];
|
|
13
13
|
protected drawSeries(ctx: ICanvas2D, layout: LayoutResult, option: RadarChartOption): void;
|
|
14
|
+
/** 命中检测:靠近任一数据顶点(阈值 24px)即显示该指标下所有系列值。 */
|
|
15
|
+
protected hitTestSeries(x: number, y: number): TooltipParams | null;
|
|
14
16
|
private indicatorMax;
|
|
15
17
|
private tracePolygon;
|
|
16
18
|
}
|
package/dist/component.d.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
* - 未来原生:通过 resolve 注入自定义解析器
|
|
8
8
|
*
|
|
9
9
|
* 组件本身是薄壳:状态由父级以 option 传入(完全受控),
|
|
10
|
-
* 数据变化时自动 setOption + render
|
|
10
|
+
* 数据变化时自动 setOption + render;
|
|
11
|
+
* 容器 / 窗口尺寸变化时防抖(150ms)自动重绘:
|
|
12
|
+
* - Web:ResizeObserver 观察 canvas,重测 clientWidth/Height 后增量 resize + render
|
|
13
|
+
* - 小程序:平台窗口尺寸回调触发后重建图表(SelectorQuery 取最新节点尺寸)
|
|
11
14
|
*/
|
|
12
15
|
import { Component, type VNode } from 'transone';
|
|
13
16
|
import type { ChartRenderContext, ChartOption } from './types';
|
|
@@ -25,6 +28,11 @@ interface TcChartState {
|
|
|
25
28
|
export declare class TcChart extends Component<TcChartProps, TcChartState> {
|
|
26
29
|
private chart;
|
|
27
30
|
private destroyed;
|
|
31
|
+
private resizeDebounced;
|
|
32
|
+
private resizeObserver;
|
|
33
|
+
private mpResizeHandler;
|
|
34
|
+
/** Web 端 hover 事件句柄(mousemove / mouseleave),卸载时移除。 */
|
|
35
|
+
private hoverHandlers;
|
|
28
36
|
protected initState(): TcChartState;
|
|
29
37
|
protected initStyles(): void;
|
|
30
38
|
protected render(): VNode;
|
|
@@ -34,8 +42,19 @@ export declare class TcChart extends Component<TcChartProps, TcChartState> {
|
|
|
34
42
|
/** 对外暴露图表实例(高级用法:手动 resize / 订阅事件)。 */
|
|
35
43
|
getChart(): ChartBase<ChartOption> | null;
|
|
36
44
|
private attachChart;
|
|
37
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Web 端返回根 canvas;小程序端此方法不会被调用(走 SelectorQuery)。
|
|
47
|
+
* 注意:方法体不能写 super.X() —— transone-cli 编译小程序时会把组件方法拍平为
|
|
48
|
+
* Component options 的普通函数属性,super 在普通函数里非法(JSCore 直接报错)。
|
|
49
|
+
* 基类 el 为 protected,此处直接取用;返回类型收窄在使用点做断言。
|
|
50
|
+
*/
|
|
38
51
|
getElement(): HTMLCanvasElement | null;
|
|
52
|
+
/** Web 端绑定 hover 事件:鼠标移动命中数据点即显示 tooltip,离开清除。 */
|
|
53
|
+
private setupHoverEvents;
|
|
54
|
+
private teardownHoverEvents;
|
|
55
|
+
private setupAutoResize;
|
|
56
|
+
private teardownAutoResize;
|
|
57
|
+
private handleResize;
|
|
39
58
|
private resolveContext;
|
|
40
59
|
}
|
|
41
60
|
export {};
|
package/dist/core/chart.d.ts
CHANGED
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* destroy 释放。所有坐标均为逻辑像素(CSS px),DPR 由管线统一缩放。
|
|
11
11
|
*/
|
|
12
12
|
import type { ICanvas2D } from './canvas';
|
|
13
|
+
import type { Box } from './layout';
|
|
13
14
|
import { type LayoutInput, type LayoutResult } from './layout';
|
|
14
15
|
import { type LegendItem } from './legend';
|
|
15
16
|
import { CategoryScale, LinearScale } from './scale';
|
|
16
|
-
import { type CategoryAxisOption, type ChartOption, type ChartRenderContext, type LegendOption, type TitleOption, type ValueAxisOption } from '../types';
|
|
17
|
+
import { type CategoryAxisOption, type ChartOption, type ChartRenderContext, type LegendOption, type TitleOption, type TooltipOption, type TooltipParams, type ValueAxisOption } from '../types';
|
|
17
18
|
export interface CartesianScales {
|
|
18
19
|
value: LinearScale;
|
|
19
20
|
category: CategoryScale;
|
|
@@ -35,11 +36,24 @@ export declare abstract class ChartBase<T extends ChartOption> {
|
|
|
35
36
|
protected readonly palette: readonly string[];
|
|
36
37
|
/** 每次 render 构建的笛卡尔比例尺,供 drawSeries 读取。 */
|
|
37
38
|
protected cartesian: CartesianScales | null;
|
|
39
|
+
/** 最近一次 render 的绘图区,供 hitTestSeries 使用。 */
|
|
40
|
+
protected plot: Box | null;
|
|
41
|
+
/** 当前悬浮命中的 tooltip 参数(由 setHover 触发 render 后绘制)。 */
|
|
42
|
+
protected hover: TooltipParams | null;
|
|
38
43
|
private destroyed;
|
|
39
44
|
constructor(context: ChartRenderContext, option: T);
|
|
40
45
|
setOption(option: Partial<T>): this;
|
|
41
|
-
resize(width: number, height: number): this;
|
|
46
|
+
resize(width: number, height: number, dpr?: number): this;
|
|
42
47
|
render(): this;
|
|
48
|
+
/**
|
|
49
|
+
* 命中测试并显示 tooltip。坐标为逻辑像素(CSS px),由事件层换算后传入。
|
|
50
|
+
* 未命中任何数据 / tooltip 关闭时不显示。调用后自动重绘。
|
|
51
|
+
*/
|
|
52
|
+
setHover(x: number, y: number): this;
|
|
53
|
+
/** 清除悬浮状态并重绘。 */
|
|
54
|
+
clearHover(): this;
|
|
55
|
+
/** 子类实现:命中检测——返回 null 表示该位置无数据。 */
|
|
56
|
+
protected abstract hitTestSeries(x: number, y: number): TooltipParams | null;
|
|
43
57
|
destroy(): void;
|
|
44
58
|
isDestroyed(): boolean;
|
|
45
59
|
protected abstract drawSeries(ctx: ICanvas2D, layout: LayoutResult, option: T): void;
|
|
@@ -66,4 +80,11 @@ export declare abstract class ChartBase<T extends ChartOption> {
|
|
|
66
80
|
protected drawCartesianAxis(layout: LayoutResult): void;
|
|
67
81
|
/** 系列取色:显式 color 优先,否则按索引取色板。 */
|
|
68
82
|
protected seriesColor(index: number, color?: string): string;
|
|
83
|
+
protected getTooltipOption(): TooltipOption | undefined;
|
|
84
|
+
/** 默认 tooltip 文本:首行标题 + 每行一个数据项。 */
|
|
85
|
+
protected defaultTooltipLines(params: TooltipParams): string[];
|
|
86
|
+
/** 在 canvas 上绘制 tooltip 浮层:跟随触发点,边缘自动翻转。 */
|
|
87
|
+
protected drawTooltip(params: TooltipParams): void;
|
|
88
|
+
/** 圆角矩形路径(当前路径),与平台无关。 */
|
|
89
|
+
private roundRectPath;
|
|
69
90
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 零依赖防抖工具。
|
|
3
|
+
*
|
|
4
|
+
* 用于高频触发场景(如窗口 / 容器尺寸变化)的合并调度:
|
|
5
|
+
* 连续调用只会在停止触发 delay 毫秒后执行一次。
|
|
6
|
+
*/
|
|
7
|
+
export interface Debounced<T extends (...args: never[]) => unknown> {
|
|
8
|
+
/** 触发一次;若已有待执行调用则重置计时器(合并连续触发)。 */
|
|
9
|
+
run: (...args: Parameters<T>) => void;
|
|
10
|
+
/** 取消尚未执行的调用。 */
|
|
11
|
+
cancel: () => void;
|
|
12
|
+
/** 是否已有待执行的调用。 */
|
|
13
|
+
pending: () => boolean;
|
|
14
|
+
}
|
|
15
|
+
type AnyFunction = (...args: any[]) => unknown;
|
|
16
|
+
export declare function debounce<T extends AnyFunction>(fn: T, delay: number): Debounced<T>;
|
|
17
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { LinearScale, CategoryScale, niceTicks } from './core/scale';
|
|
|
16
16
|
export type { LinearScaleOptions, ScaleResult } from './core/scale';
|
|
17
17
|
export { computeLayout } from './core/layout';
|
|
18
18
|
export type { Box, LayoutInput, LayoutResult, Padding } from './core/layout';
|
|
19
|
+
export { debounce } from './core/debounce';
|
|
20
|
+
export type { Debounced } from './core/debounce';
|
|
19
21
|
export { ChartBase } from './core/chart';
|
|
20
22
|
export type { CartesianScales } from './core/chart';
|
|
21
23
|
export { LineChart } from './charts/line';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var ke=["#1677ff","#00b578","#ff8f1f","#ff3141","#eb2f96","#722ed1","#13c2c2","#faad14","#2f54eb","#a0d911"],V="#323233",Ne="#c8c9cc",ge="#ebedf0",Q="-apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif";function ut(e){return typeof e==="object"&&e!==null&&typeof e.save==="function"&&typeof e.beginPath==="function"&&typeof e.fill==="function"&&typeof e.stroke==="function"&&typeof e.fillText==="function"}function Oe(e,t,n=5){let r=e,o=t;if(!Number.isFinite(r)||!Number.isFinite(o))throw Error("niceTicks: domain must be finite numbers");if(r===o){let u=Math.abs(r)>1?Math.abs(r)*0.1:1;r-=u,o+=u}if(r>o)[r,o]=[o,r];let s=(o-r)/Math.max(1,n),a=pt(s),l=Math.floor(r/a)*a,c=Math.ceil(o/a)*a,p=[];for(let u=l;u<=c+a*0.000000001;u+=a)p.push(ct(u,a));return{min:l,max:c,step:a,ticks:p}}function pt(e){let t=Math.pow(10,Math.floor(Math.log10(e))),n=e/t,r;if(n<=1)r=1;else if(n<=2)r=2;else if(n<=5)r=5;else r=10;return r*t}function ct(e,t){let n=Math.max(0,-Math.floor(Math.log10(t))+1);return Number(e.toFixed(n))}class W{min;max;ticks;step;rangeStart;rangeEnd;constructor(e,t,n,r,o={}){let{min:i,max:s,splitCount:a=5}=o,l=i,c=s;if(l===void 0||c===void 0){let p=Oe(e,t,a);l=l??p.min,c=c??p.max,this.ticks=p.ticks,this.step=p.step}else{this.step=(c-l)/Math.max(1,a),this.ticks=[];for(let p=0;p<=a;p+=1)this.ticks.push(l+p*this.step)}this.min=l,this.max=c,this.rangeStart=n,this.rangeEnd=r}scale(e){let t=(e-this.min)/(this.max-this.min);return this.rangeStart+t*(this.rangeEnd-this.rangeStart)}}class J{categories;bandWidth;innerGapRatio;rangeStart;constructor(e,t,n,r=0.35){this.categories=e;this.innerGapRatio=r,this.rangeStart=t;let o=Math.max(1,e.length);this.bandWidth=(n-t)/o}bandStart(e){return this.rangeStart+this.bandWidth*e}center(e){return this.bandStart(e)+this.bandWidth/2}innerWidth(){return this.bandWidth*(1-this.innerGapRatio)}groupInnerWidth(e){return this.innerWidth()/Math.max(1,e)*0.8}}var dt={top:12,right:16,bottom:12,left:16};function ht(e,t){let{legend:n}=e,r=e.legendItems??[],o=n?.fontSize??12,i=n?.itemGap??16,s=n?.markerSize??12;if(n?.position==="right"){let l=0;for(let c of r){let p=s+6+t(c);if(p>l)l=p}return{width:l+12,height:Math.max(r.length*(o+8)+12,0)}}let a=0;for(let l of r)a+=s+6+t(l)+i;if(a>0)a-=i;return{width:a,height:o+12+4}}function ye(e,t){let n={...dt,...e.basePadding},r=n.top,o=n.bottom,i=n.left,s=n.right,a=null;if(e.title?.text){let b=e.title.fontSize??16;a={x:0,y:0,width:e.width,height:b},r+=b+(e.title.padding??16)}let l=null,c=e.legend;if(c&&c.show!==!1&&(e.legendItems?.length??0)>0){let b=ht(e,t),T=c.position??"top";if(T==="top")l={x:0,y:a?a.height:0,width:e.width,height:b.height},r+=b.height;else if(T==="bottom")l={x:0,y:e.height-b.height,width:e.width,height:b.height},o+=b.height;else l={x:e.width-b.width,y:r,width:b.width,height:Math.max(0,e.height-r-o)},s+=b.width}let p=11,u=0,d=0,h=0,m=0,R=e.valueLabels??[],g=e.categoryLabels??[];if(e.horizontal){if(g.length>0){for(let b of g){let T=t(b);if(T>m)m=T}m+=16,i+=m}if(R.length>0)h=p+16,o+=h}else{if(R.length>0){for(let b of R){let T=t(b);if(T>u)u=T}u+=16,i+=u}if(g.length>0)d=p+16,o+=d}let y=Math.max(0,e.width-i-s),C=Math.max(0,e.height-r-o),v={x:i,y:r,width:y,height:C},k=e.horizontal?{x:v.x,y:v.y+v.height,width:y,height:h}:{x:v.x-u,y:r,width:u,height:C},w=e.horizontal?{x:v.x-m,y:r,width:m,height:C}:{x:i,y:v.y+C,width:y,height:d};return{plot:v,valueAxisBox:k,categoryAxisBox:w,titleBox:a,legendBox:l,padding:n}}function mt(e,t=Q){return`${e}px ${t}`}function P(e,t,n=Q){let r=mt(t,n);return e.font=r,r}function z(e,t,n,r=Q){return P(e,n,r),e.measureText(t).width}class be{ctx;constructor(e){this.ctx=e}drawValueAxis(e){let{plot:t,scale:n,labels:r,horizontal:o=!1,labelFontSize:i=11,labelColor:s=V,gridColor:a=ge,gridLineWidth:l=1,gridLineDash:c,showGrid:p=!0}=e,u=n.ticks,{ctx:d}=this;for(let h=0;h<u.length;h+=1){let m=n.scale(u[h]),R=r[h]??String(u[h]);if(p){if(d.save(),d.strokeStyle=a,d.lineWidth=l,c&&c.length>0)d.setLineDash(c);if(d.beginPath(),o)d.moveTo(t.x,m),d.lineTo(t.x+t.width,m);else d.moveTo(t.x,m),d.lineTo(t.x+t.width,m);d.stroke(),d.restore()}if(P(d,i),d.fillStyle=s,d.textBaseline="middle",o)d.textAlign="center",d.fillText(R,m,t.y+t.height+8);else d.textAlign="right",d.fillText(R,t.x-8,m)}}drawCategoryAxis(e){let{plot:t,scale:n,labels:r,horizontal:o=!1,axisColor:i=Ne,labelFontSize:s=11,labelColor:a=V,gridColor:l=ge,gridLineWidth:c=1,showGrid:p=!1}=e,{ctx:u}=this,d=r.length;if(p){u.save(),u.strokeStyle=l,u.lineWidth=c,u.beginPath();for(let h=0;h<d;h+=1){let m=n.center(h);if(o)u.moveTo(t.x,m),u.lineTo(t.x+t.width,m);else u.moveTo(m,t.y),u.lineTo(m,t.y+t.height)}u.stroke(),u.restore()}P(u,s),u.fillStyle=a,u.textBaseline="middle";for(let h=0;h<d;h+=1){let m=n.center(h);if(o)u.textAlign="right",u.fillText(r[h],t.x-8,m);else u.textAlign="center",u.fillText(r[h],m,t.y+t.height+8)}if(u.save(),u.strokeStyle=i,u.lineWidth=1,u.beginPath(),o)u.moveTo(t.x,t.y),u.lineTo(t.x,t.y+t.height);else u.moveTo(t.x,t.y+t.height),u.lineTo(t.x+t.width,t.y+t.height);u.stroke(),u.restore()}}class ve{ctx;constructor(e){this.ctx=e}draw(e){let{box:t,items:n,position:r="top",fontSize:o=12,color:i=V,markerSize:s=12,itemGap:a=16}=e;if(n.length===0)return;let{ctx:l}=this;if(P(l,o),r==="right"){let d=t.y+o/2+4;for(let h of n)this.drawItem(h,t.x,d,o,s,i),d+=o+8;return}let c=0;for(let d of n)c+=s+6+z(l,d.name,o)+a;c-=a;let p=t.x+(t.width-c)/2,u=t.y+t.height/2;for(let d of n)this.drawItem(d,p,u,o,s,i),p+=s+6+z(l,d.name,o)+a}drawItem(e,t,n,r,o,i){let{ctx:s}=this;s.fillStyle=e.color,s.beginPath(),s.rect(t,n-o/2,o,o),s.fill(),s.fillStyle=i,s.textAlign="left",s.textBaseline="middle",s.fillText(e.name,t+o+6,n)}}class A{ctx;option;width;height;dpr;palette;cartesian=null;destroyed=!1;constructor(e,t){this.ctx=e.ctx,this.option=t,this.width=e.width,this.height=e.height,this.dpr=e.dpr,this.palette=e.palette??ke}setOption(e){return this.option={...this.option,...e},this}resize(e,t){return this.width=Math.max(0,e),this.height=Math.max(0,t),this}render(){if(this.destroyed)return this;let{ctx:e,width:t,height:n,dpr:r}=this;e.save(),e.scale(r,r),e.clearRect(0,0,t,n);let o=this.getBackgroundColor();if(o)e.fillStyle=o,e.fillRect(0,0,t,n);let i=this.computeLayout();if(this.drawTitle(i),this.drawLegend(i),this.hasCartesianAxis())this.cartesian=this.buildCartesianScales(i),this.drawCartesianAxis(i);else this.cartesian=null;return this.drawSeries(e,i,this.option),e.restore(),this}destroy(){this.destroyed=!0}isDestroyed(){return this.destroyed}hasCartesianAxis(){return!0}getValueDomain(){return{min:0,max:1}}getCategoryLabels(){return[]}isHorizontal(){return!1}getBackgroundColor(){return this.option.backgroundColor}getTitle(){return this.option.title}getLegend(){let e=this.option.legend;if(e)return e;return this.getLegendItems().length>0?{position:"top"}:void 0}getLegendItems(){return[]}getValueAxis(){return this.option.yAxis}getCategoryAxis(){return this.option.xAxis}computeLayout(){let e=this.buildLayoutInput();return ye(e,(n)=>z(this.ctx,n,11))}buildLayoutInput(){let e=this.isHorizontal(),t=this.hasCartesianAxis();return{width:this.width,height:this.height,title:this.getTitle(),legend:this.getLegend(),legendItems:this.getLegendItems().map((n)=>n.name),valueLabels:t&&!e?this.computeValueLabels():void 0,categoryLabels:t?this.getCategoryLabels():void 0,horizontal:e}}computeValueLabels(){let e=this.getValueDomain(),t=this.getValueAxis();return new W(e.min,e.max,0,1,{min:t?.min,max:t?.max,splitCount:t?.splitCount}).ticks.map((r)=>t?.format?t.format(r):String(r))}drawTitle(e){let t=this.getTitle();if(!t?.text||!e.titleBox)return;let{ctx:n}=this;P(n,t.fontSize??16),n.fillStyle=t.color??"#323233",n.textAlign="center",n.textBaseline="top",n.fillText(t.text,this.width/2,e.titleBox.y)}drawLegend(e){let t=this.getLegend();if(t?.show===!1||!e.legendBox)return;let n=this.getLegendItems();if(n.length===0)return;new ve(this.ctx).draw({box:e.legendBox,items:n,position:t?.position??"top",fontSize:t?.fontSize,color:t?.color,markerSize:t?.markerSize,itemGap:t?.itemGap})}buildCartesianScales(e){let{plot:t}=e,n=this.isHorizontal(),r=this.getValueDomain(),o=this.getCategoryLabels(),i=this.getValueAxis(),s=new W(r.min,r.max,n?t.x:t.y+t.height,n?t.x+t.width:t.y,{min:i?.min,max:i?.max,splitCount:i?.splitCount}),a=new J(o,n?t.y:t.x,n?t.y+t.height:t.x+t.width);return{value:s,category:a}}drawCartesianAxis(e){let t=this.cartesian;if(!t)return;let{ctx:n}=this,{plot:r}=e,o=this.isHorizontal(),i=this.getValueAxis(),s=this.getCategoryAxis(),a=this.getCategoryLabels(),l=new be(n),c=t.value.ticks.map((p)=>i?.format?i.format(p):String(p));l.drawValueAxis({plot:r,scale:t.value,labels:c,horizontal:o,labelFontSize:i?.labelFontSize,labelColor:i?.labelColor,gridColor:i?.gridColor,gridLineWidth:i?.gridLineWidth,gridLineDash:i?.gridLineDash,showGrid:i?.showGrid??!0}),l.drawCategoryAxis({plot:r,scale:t.category,labels:a,horizontal:o,labelFontSize:s?.labelFontSize,labelColor:s?.labelColor,gridColor:s?.gridColor,gridLineWidth:s?.gridLineWidth,showGrid:s?.showGrid??!1})}seriesColor(e,t){return t??this.palette[e%this.palette.length]}}class Z extends A{getValueDomain(){let{series:e,yAxis:t,startFromZero:n=!1}=this.option,r=1/0,o=-1/0;for(let i of e)for(let s of i.data){if(s<r)r=s;if(s>o)o=s}if(!Number.isFinite(r)||!Number.isFinite(o))return{min:0,max:1};if(n&&r>0)r=0;if(t?.min!==void 0)r=Math.min(r,t.min);if(t?.max!==void 0)o=Math.max(o,t.max);return{min:r,max:o}}getCategoryLabels(){return this.option.xAxis.labels}getLegendItems(){return this.option.series.filter((e)=>e.name).map((e,t)=>({name:e.name,color:this.seriesColor(t,e.color)}))}drawSeries(e,t,n){let r=this.cartesian;if(!r)return;let{plot:o}=t,{value:i,category:s}=r,a=n.series.map((l)=>l.data.map((c,p)=>({x:s.center(p),y:i.scale(c)})));n.series.forEach((l,c)=>{let p=a[c];if(p.length===0)return;let u=this.seriesColor(c,l.color),d=l.lineWidth??2;if(l.area)e.save(),e.fillStyle=u,e.globalAlpha=0.15,e.beginPath(),this.tracePath(e,p,l.smooth??!1),e.lineTo(p[p.length-1].x,o.y+o.height),e.lineTo(p[0].x,o.y+o.height),e.closePath(),e.fill(),e.restore();if(e.save(),e.strokeStyle=u,e.lineWidth=d,e.lineJoin="round",e.lineCap="round",e.beginPath(),this.tracePath(e,p,l.smooth??!1),e.stroke(),e.restore(),l.showSymbol!==!1){e.save(),e.fillStyle=u;for(let h of p)e.beginPath(),e.arc(h.x,h.y,Math.max(2.5,d+0.5),0,Math.PI*2),e.fill();e.restore()}})}tracePath(e,t,n){if(t.length===0)return;if(e.moveTo(t[0].x,t[0].y),!n||t.length<3){for(let r=1;r<t.length;r+=1)e.lineTo(t[r].x,t[r].y);return}for(let r=0;r<t.length-1;r+=1){let o=t[Math.max(0,r-1)],i=t[r],s=t[r+1],a=t[Math.min(t.length-1,r+2)],l=i.x+(s.x-o.x)/6,c=i.y+(s.y-o.y)/6,p=s.x-(a.x-i.x)/6,u=s.y-(a.y-i.y)/6;e.bezierCurveTo(l,c,p,u,s.x,s.y)}}}class ee extends A{isHorizontal(){return this.option.horizontal??!1}getValueDomain(){let{series:e,yAxis:t}=this.option,n=0,r=0,o=De(e),i=Math.max(0,...e.map((s)=>s.data.length));for(let s=0;s<i;s+=1)for(let a of o){let l=0,c=0;for(let p of a){let u=p.data[s]??0;if(u>=0)l+=u;else c+=u}if(l>n)n=l;if(c<r)r=c}if(t?.min!==void 0)r=Math.min(r,t.min);if(t?.max!==void 0)n=Math.max(n,t.max);return{min:r,max:n}}getCategoryLabels(){return this.option.xAxis.labels}getLegendItems(){return this.option.series.filter((e)=>e.name).map((e,t)=>({name:e.name,color:this.seriesColor(t,e.color)}))}drawSeries(e,t,n){let r=this.cartesian;if(!r)return;let{value:o,category:i}=r,s=n.horizontal??!1,a=De(n.series),l=n.xAxis.labels.length;for(let c=0;c<l;c+=1){let p=a,u=p.length,d=n.series.map((m)=>m.barWidth).find((m)=>m!==void 0&&m>0),h=this.computeSlot(i,u,d);p.forEach((m,R)=>{let g=h.offset+R*h.size,y=0;m.forEach((C)=>{let v=C.data[c]??0,k=this.seriesColor(n.series.indexOf(C),C.color);if(s){let w=o.scale(0),b=o.scale(y+v),T=Math.min(w,b),F=Math.abs(b-w),fe=i.bandStart(c)+g;this.drawBar(e,{x:T,y:fe,width:F,height:h.size,radius:C.borderRadius??0,color:k,roundSide:v>=0?"right":"left"})}else{let w=o.scale(y),b=o.scale(y+v),T=Math.min(w,b),F=Math.abs(b-w),fe=i.bandStart(c)+g;this.drawBar(e,{x:fe,y:T,width:h.size,height:F,radius:C.borderRadius??0,color:k,roundSide:v>=0?"top":"bottom"})}y+=v})})}}computeSlot(e,t,n){if(n!==void 0)return{offset:(e.innerWidth()-n)/2,size:n};let r=e.innerWidth()/Math.max(1,t)*0.8;return{offset:(e.innerWidth()-r*t)/2,size:r}}drawBar(e,t){if(t.width<=0||t.height<=0)return;e.save(),e.fillStyle=t.color,e.beginPath(),ft(e,t,t.radius,t.roundSide),e.fill(),e.restore()}}function De(e){let t=[],n=new Map;for(let r of e)if(r.stack){let o=n.get(r.stack);if(!o)o=[],n.set(r.stack,o),t.push(o);o.push(r)}else t.push([r]);return t}function ft(e,t,n,r){let{x:o,y:i,width:s,height:a}=t,l=Math.min(n,s/2,a/2);if(l<=0){e.rect(o,i,s,a);return}let c=r==="top"||r==="left",p=r==="top"||r==="right",u=r==="bottom"||r==="left",d=r==="bottom"||r==="right";if(e.moveTo(o+(c?l:0),i),e.lineTo(o+s-(p?l:0),i),p)e.arcTo(o+s,i,o+s,i+l,l);else e.lineTo(o+s,i);if(e.lineTo(o+s,i+a-(d?l:0)),d)e.arcTo(o+s,i+a,o+s-l,i+a,l);else e.lineTo(o+s,i+a);if(e.lineTo(o+(u?l:0),i+a),u)e.arcTo(o,i+a,o,i+a-l,l);else e.lineTo(o,i+a);if(e.lineTo(o,i+(c?l:0)),c)e.arcTo(o,i,o+l,i,l);else e.lineTo(o,i);e.closePath()}var gt=Math.PI*2;class te extends A{hasCartesianAxis(){return!1}getLegendItems(){return this.option.data.map((e,t)=>({name:e.name,color:e.color??this.seriesColor(t)}))}drawSeries(e,t,n){let{plot:r}=t,o=r.x+r.width/2,i=r.y+r.height/2,s=Math.min(r.width,r.height)/2,a=He(n.radius??"60%",s),l=He(n.innerRadius??0,s),c=n.startAngle??-Math.PI/2,p=n.data.filter((h)=>h.value>0),u=p.reduce((h,m)=>h+m.value,0);if(u<=0||a<=0)return;let d=c;p.forEach((h,m)=>{let R=h.value/u*gt,g=h.color??this.seriesColor(m);if(e.save(),e.fillStyle=g,e.beginPath(),l>0)e.arc(o,i,a,d,d+R),e.arc(o,i,l,d+R,d,!0);else e.arc(o,i,a,d,d+R),e.lineTo(o,i);if(e.closePath(),e.fill(),e.strokeStyle="#ffffff",e.lineWidth=1,e.stroke(),e.restore(),n.showLabel!==!1){let y=d+R/2,C=(a+(l>0?l:0))/2*0.85,v=o+Math.cos(y)*C,k=i+Math.sin(y)*C,w=u>0?Math.round(h.value/u*100):0;P(e,n.labelFontSize??10),e.fillStyle=n.labelColor??"#ffffff",e.textAlign="center",e.textBaseline="middle",e.fillText(`${h.name} ${w}%`,v,k)}d+=R})}}function He(e,t){if(typeof e==="number")return Math.max(0,e);let n=/^(\d+(?:\.\d+)?)%$/.exec(e);if(!n)return t;return Number(n[1])/100*t}class ne extends A{hasCartesianAxis(){return!1}getLegendItems(){return this.option.series.filter((e)=>e.name).map((e,t)=>({name:e.name,color:this.seriesColor(t,e.color)}))}drawSeries(e,t,n){let{plot:r}=t,o=r.x+r.width/2,i=r.y+r.height/2,s=n.radius??Math.min(r.width,r.height)/2*0.6,a=n.indicators.length;if(a===0||s<=0)return;let l=n.startAngle??-Math.PI/2,c=yt/a,p=Math.max(1,n.splitCount??5),u=n.gridColor??"#ebedf0",d=n.gridLineWidth??1,h=(g)=>l+g*c,m=(g,y)=>({x:o+Math.cos(g)*y,y:i+Math.sin(g)*y});for(let g=1;g<=p;g+=1){let y=s*g/p;e.save(),e.strokeStyle=u,e.lineWidth=d,e.beginPath();for(let C=0;C<a;C+=1){let v=m(h(C),y);if(C===0)e.moveTo(v.x,v.y);else e.lineTo(v.x,v.y)}e.closePath(),e.stroke(),e.restore()}e.save(),e.strokeStyle=u,e.lineWidth=d,e.beginPath();for(let g=0;g<a;g+=1){let y=m(h(g),s);e.moveTo(o,i),e.lineTo(y.x,y.y)}e.stroke(),e.restore();let R=n.labelFontSize??11;P(e,R),e.fillStyle=n.labelColor??"#323233";for(let g=0;g<a;g+=1){let y=m(h(g),s+12);e.textAlign=Math.abs(y.x-o)<1?"center":y.x>o?"left":"right",e.textBaseline=Math.abs(y.y-i)<1?"middle":y.y>i?"top":"bottom",e.fillText(n.indicators[g].name,y.x,y.y)}n.series.forEach((g,y)=>{let C=this.seriesColor(y,g.color),v=n.indicators.map((k,w)=>{let b=k.max??this.indicatorMax(n,w),T=g.data[w]??0,F=b>0?Math.max(0,Math.min(1,T/b)):0;return m(h(w),s*F)});if(g.area!==!1)e.save(),e.fillStyle=C,e.globalAlpha=0.2,e.beginPath(),this.tracePolygon(e,v),e.closePath(),e.fill(),e.restore();e.save(),e.strokeStyle=C,e.lineWidth=g.lineWidth??2,e.lineJoin="round",e.beginPath(),this.tracePolygon(e,v),e.closePath(),e.stroke(),e.restore()})}indicatorMax(e,t){let n=0;for(let r of e.series){let o=r.data[t]??0;if(o>n)n=o}return n}tracePolygon(e,t){if(t.length===0)return;e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n+=1)e.lineTo(t[n].x,t[n].y)}}var yt=Math.PI*2;function q(){let e=bt();if(typeof e.devicePixelRatio==="number"&&e.devicePixelRatio>0)return e.devicePixelRatio;return 1}function bt(){if(typeof globalThis<"u")return globalThis;return{}}function D(e){let n=vt()[e];return typeof n==="object"&&n!==null?n:null}function re(e){let t=e.platform??oe()??"wx",n=D(t),r=n?.createSelectorQuery;if(typeof r!=="function")return Promise.reject(Error(`getMiniProgramCanvasNode: ${t}.createSelectorQuery is not available`));return new Promise((o,i)=>{let s=r.call(n);if(e.instance&&typeof s.in==="function")s=s.in(e.instance);if(typeof s.select!=="function"){i(Error(`${t}.createSelectorQuery().select is not available`));return}s.select(e.selector).fields({node:!0,size:!0}).exec((a)=>{let c=(Array.isArray(a)?a[0]:void 0)?.node;if(!c||typeof c.getContext!=="function"){i(Error(`getMiniProgramCanvasNode: canvas node not found for "${e.selector}"`));return}o(c)})})}function oe(){if(D("wx"))return"wx";if(D("my"))return"my";if(D("tt"))return"tt";return null}function Ce(e){let t=e??oe()??"wx",n=D(t),r=n?.getSystemInfoSync;if(typeof r==="function")try{let o=r.call(n);if(typeof o.pixelRatio==="number"&&o.pixelRatio>0)return o.pixelRatio}catch{}return q()}function B(e,t={}){let n=e.getContext("2d");if(!n)throw Error("resolveMiniProgramCanvas: 2d context is not available");let r=t.dpr??Ce(),o=t.width??e.width,i=t.height??e.height;return{ctx:n,width:o,height:i,dpr:r,palette:t.palette}}function vt(){if(typeof globalThis<"u")return globalThis;return{}}function j(e,t={}){if(!e)throw Error("resolveWebCanvas: canvas element is required");let n=e.getContext("2d");if(!n)throw Error("resolveWebCanvas: 2d context is not available");let r=t.dpr??q(),o=t.width??(e.clientWidth||e.width),i=t.height??(e.clientHeight||e.height);return e.width=Math.round(o*r),e.height=Math.round(i*r),{ctx:n,width:o,height:i,dpr:r,palette:t.palette}}function U(e,t){switch(t.type){case"line":return new Z(e,t);case"bar":return new ee(e,t);case"pie":return new te(e,t);case"radar":return new ne(e,t);default:throw Error(`createChart: unsupported chart type "${t.type}"`)}}function Ct(e,t,n={}){return U(j(e,n),t)}function Rt(e,t,n={}){return U(B(e,n),t)}function qe(e){throw Error("resolveNativeCanvas is not implemented yet. Native app support (iOS/Android/HarmonyOS) is planned for a future phase; implement ICanvas2D on the host side and fill in this resolver.")}function M(e){if(e===void 0||e===null)return[];return Array.isArray(e)?e:[e]}function Be(e){return typeof e==="object"&&e!==null&&"component"in e}function je(e){return typeof e==="object"&&e!==null&&"tag"in e&&e.tag!=="slot"}function _e(e){return typeof e==="object"&&e!==null&&"tag"in e&&e.tag==="slot"}function Fe(e,t,n,r,o,i){return{tag:e,props:t,children:n,listeners:r,key:o,directions:i}}function xt(e,t={}){return{tag:e,...t}}function f(e){return(t={})=>xt(e,t)}var Tt=f("div"),$n=f("span"),zn=f("p"),Un=f("button"),Gn=f("input"),Kn=f("section"),Xn=f("main"),Yn=f("header"),Qn=f("footer"),Jn=f("nav"),Zn=f("article"),er=f("aside"),tr=f("h1"),nr=f("h2"),rr=f("h3"),or=f("h4"),ir=f("h5"),sr=f("h6"),ar=f("strong"),lr=f("em"),ur=f("small"),pr=f("pre"),cr=f("code"),dr=f("blockquote"),hr=f("ul"),mr=f("ol"),fr=f("li"),gr=f("a"),yr=f("img"),br=f("form"),vr=f("label"),Cr=f("textarea"),Rr=f("select"),xr=f("option"),Tr=f("table"),wr=f("thead"),Er=f("tbody"),Sr=f("tr"),Pr=f("th"),Lr=f("td");var H=Symbol("is_reactive"),E=Symbol("is_readonly"),wt=Symbol("is_ref"),Ve=["push","pop","shift","unshift","splice","sort","reverse"];function S(e,t){return Boolean(Reflect.get(e,t))}function I(e){return e!==null&&typeof e==="object"}class Re{pending=new Set;flushing=!1;flushPromise=null;flushResolve=null;enqueue(e){if(this.pending.has(e))return;if(this.pending.add(e),!this.flushing)queueMicrotask(()=>this.flush())}flush(){if(this.flushing)return;this.flushing=!0;try{while(this.pending.size>0){let e=Array.from(this.pending);this.pending.clear();for(let t of e)if(t.active)t()}}finally{this.flushing=!1;let e=this.flushResolve;this.flushResolve=null,this.flushPromise=null,e?.()}}nextTick(){if(!this.flushing&&this.pending.size===0)return Promise.resolve();if(this.flushPromise)return this.flushPromise;return this.flushPromise=new Promise((e)=>{this.flushResolve=e}),this.flushPromise}}var Et=0,xe=new Re;class L{static instance;activeEffect=null;effectStack=[];targetMap=new WeakMap;reactiveMap=new WeakMap;readonlyMap=new WeakMap;proxyMap=new WeakMap;constructor(){}static getInstance(){if(!L.instance)L.instance=new L;return L.instance}reactive(e){if(!I(e))return console.warn("reactive: target must be an object"),e;if(St(e))return e;if(this.reactiveMap.has(e))return this.reactiveMap.get(e);if(Array.isArray(e))return this.createReactiveArray(e);let t=new Proxy(e,{get:(n,r)=>{if(r===H)return!0;if(r===E)return!1;this.track(n,r);let o=Reflect.get(n,r);if(I(o)&&!S(o,E))return this.reactive(o);return o},set:(n,r,o)=>{if(S(n,E))return console.warn(`Cannot set property ${String(r)} on readonly object`),!1;let i=Reflect.get(n,r);if(I(o)&&!S(o,H)&&!S(o,E))o=this.reactive(o);let s=Reflect.set(n,r,o);if(i!==o)this.trigger(n,r);return s},deleteProperty:(n,r)=>{if(S(n,E))return console.warn(`Cannot delete property ${String(r)} on readonly object`),!1;let o=r in n,i=Reflect.deleteProperty(n,r);if(o)this.trigger(n,r);return i}});return this.reactiveMap.set(e,t),this.proxyMap.set(t,e),t}toRawValue(e){if(I(e)&&this.proxyMap.has(e))return this.proxyMap.get(e);return e}createReactiveArray(e){if(this.reactiveMap.has(e))return this.reactiveMap.get(e);let t=new Proxy(e,{get:(n,r)=>{if(r===H)return!0;if(r===E)return!1;this.track(n,r);let o=Reflect.get(n,r);if(typeof r==="string"&&(r==="includes"||r==="indexOf"||r==="lastIndexOf")){this.track(n,"length");for(let s=0;s<n.length;s++)this.track(n,String(s));let i=o;return(...s)=>{let a=i.apply(n,s);if(a===!1||a===-1){let l=n.map((p)=>this.toRawValue(p));return l[r].apply(l,s.map((p)=>this.toRawValue(p)))}return a}}if(typeof r==="string"&&Ve.includes(r))return(...i)=>{let a=o.apply(n,i);return this.trigger(n,"length"),this.trigger(n,r),a};if(I(o)&&!S(o,E))return this.reactive(o);return o},set:(n,r,o)=>{if(S(n,E))return console.warn(`Cannot set property ${String(r)} on readonly object`),!1;let i=Reflect.get(n,r);if(I(o)&&!S(o,H)&&!S(o,E))o=this.reactive(o);let s=Reflect.set(n,r,o);if(i!==o){if(this.trigger(n,r),typeof r==="string"&&!isNaN(Number(r)))this.trigger(n,"length")}return s},deleteProperty:(n,r)=>{if(S(n,E))return console.warn(`Cannot delete property ${String(r)} on readonly object`),!1;let o=r in n,i=Reflect.deleteProperty(n,r);if(o)this.trigger(n,r),this.trigger(n,"length");return i}});return this.reactiveMap.set(e,t),this.proxyMap.set(t,e),t}readonly(e){if(!I(e))return console.warn("readonly: target must be an object"),e;if(S(e,E))return e;if(this.readonlyMap.has(e))return this.readonlyMap.get(e);let t=new Proxy(e,{get:(n,r)=>{if(r===H)return!1;if(r===E)return!0;let o=Reflect.get(n,r);if(I(o))return this.readonly(o);return o},set:()=>(console.warn("Cannot set property on readonly object"),!1),deleteProperty:()=>(console.warn("Cannot delete property on readonly object"),!1)});return this.readonlyMap.set(e,t),t}effect(e,t){let{lazy:n=!1,scheduler:r,throwOnError:o=!1}=t||{},i=()=>{if(!i.active)return e();try{return this.cleanup(i),this.effectStack.push(i),this.activeEffect=i,e()}catch(s){if(o)throw s;console.error("Effect error:",s);return}finally{this.effectStack.pop(),this.activeEffect=this.effectStack[this.effectStack.length-1]??null}};if(i.id=Et++,i.deps=[],i.active=!0,i.scheduler=r,!n)i();return i}runWithEffect(e,t){this.effectStack.push(e),this.activeEffect=e;try{return t()}finally{this.effectStack.pop(),this.activeEffect=this.effectStack[this.effectStack.length-1]??null}}computed(e){let t=!0,n,r={},o=()=>{this.track(r,"value")},i=this.effect(()=>{n=e(),t=!1},{lazy:!0,scheduler:()=>{if(!t)t=!0,this.trigger(r,"value")}});return{get value(){if(t)i();return o(),n}}}cleanup(e){e.deps.forEach((t)=>{t.delete(e)}),e.deps.length=0}track(e,t){if(!this.activeEffect||!this.activeEffect.active)return;let n=this.targetMap.get(e);if(!n)n=new Map,this.targetMap.set(e,n);let r=n.get(t);if(!r)r=new Set,n.set(t,r);if(!r.has(this.activeEffect))r.add(this.activeEffect),this.activeEffect.deps.push(r)}trigger(e,t){let n=this.targetMap.get(e);if(!n)return;let r=n.get(t);if(!r)return;new Set(r).forEach((i)=>{if(i.active)if(i.scheduler)i.scheduler(i);else i()})}stop(e){if(e.active)this.cleanup(e),e.active=!1}}function We(e){return L.getInstance().reactive(e)}function N(e,t){return L.getInstance().effect(e,t)}function O(e){L.getInstance().stop(e)}function St(e){return I(e)&&S(e,H)}function $e(e){let t=e.split(".");if(e.length===0||t.some((n)=>n.length===0||n==="__proto__"||n==="prototype"||n==="constructor"))throw Error(`Invalid model path "${e}"`);return t}function we(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function ze(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Pt(e){return typeof e==="string"?e:e.path}function Ee(e,t){let n=e;for(let r of $e(t)){if(!we(n))throw Error(`Invalid model path "${t}"`);if(!ze(n,r)){if(r in n)throw Error(`Invalid model path "${t}"`);return}n=n[r]}return n}function Lt(e,t,n){let r=$e(t),o=e;for(let s of r.slice(0,-1)){if(!ze(o,s)){if(s in o)throw Error(`Invalid model path "${t}"`);o[s]={}}else if(!we(o[s]))throw Error(`Invalid model path "${t}"`);let a=o[s];if(!we(a))throw Error(`Invalid model path "${t}"`);o=a}let i=r[r.length-1];o[i]=n}function Te(e,t){if(typeof e!=="string"&&e.format)return e.format(t);return t===void 0||t===null?"":String(t)}function At(e,t){if(typeof e!=="string"&&e.parse)return e.parse(t);return t}function Mt(e,t,n){if(e instanceof HTMLInputElement){if(e.type==="checkbox"){e.checked=Array.isArray(n)?n.some((r)=>String(r)===e.value):Boolean(n);return}if(e.type==="radio"){e.checked=n===e.value;return}e.value=Te(t,n);return}if(e instanceof HTMLTextAreaElement){e.value=Te(t,n);return}if(e instanceof HTMLSelectElement){if(e.multiple){let r=Array.isArray(n)?new Set(n.map(String)):new Set;for(let o=0;o<e.options.length;o+=1){let i=e.options.item(o);if(!i)continue;i.selected=r.has(i.value)}return}e.value=Te(t,n)}}function It(e,t){if(e instanceof HTMLInputElement){if(e.type==="checkbox"){if(Array.isArray(t)){let n=t.filter((r)=>String(r)!==e.value);return e.checked?[...n,e.value]:n}return e.checked}if(e.type==="radio")return e.checked?e.value:t;return e.value}if(e instanceof HTMLTextAreaElement)return e.value;if(e instanceof HTMLSelectElement){if(!e.multiple)return e.value;let n=[];for(let r=0;r<e.selectedOptions.length;r+=1){let o=e.selectedOptions.item(r);if(o)n.push(o.value)}return n}return}class Se{bindings=new WeakMap;bind(e,t,n){if(!this.isSupportedControl(e))return;let r=this.bindings.get(e);if(r&&this.sameBinding(r,t))return;this.cleanup(e);let o=Pt(t),i=()=>Mt(e,t,Ee(n,o)),s=e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&!["checkbox","radio"].includes(e.type)?"input":"change",a=()=>{let c=Ee(n,o);Lt(n,o,At(t,It(e,c)))};e.addEventListener(s,a);let l=N(i);this.bindings.set(e,{binding:t,path:o,parse:typeof t==="string"?void 0:t.parse,format:typeof t==="string"?void 0:t.format,eventName:s,listener:a,effect:l})}cleanup(e){let t=this.bindings.get(e);if(!t)return;e.removeEventListener(t.eventName,t.listener),O(t.effect),this.bindings.delete(e)}isSupportedControl(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement}sameBinding(e,t){if(typeof e.binding==="string"||typeof t==="string")return e.binding===t;return e.path===t.path&&e.parse===t.parse&&e.format===t.format}}var Ue=":root{--tu-rpx:calc(min(100vw, 750px) / 750);}",kt=/(-?\d+(?:\.\d+)?)rpx/g;function ie(e){return String(e).replace(kt,(t,n)=>`calc(${n} * var(--tu-rpx))`)}function se(e){return/^on[A-Z]/.test(e)||/^on[a-z]/.test(e)}function Ge(e){return e.slice(2).toLowerCase()}function Ke(e){let[t,...n]=e.split(".");return{eventName:t,modifiers:new Set(n)}}function Xe(e,t){let n=(r)=>{if(t.has("stop"))r.stopPropagation();if(t.has("prevent"))r.preventDefault();if(t.has("self")&&r.currentTarget!==r.target)return;if(t.has("once"))r.currentTarget.removeEventListener(r.type,n);e(r)};return n}function Ye(e,t,n){let r=t.includes("-")?t:t.replace(/[A-Z]/g,(o)=>`-${o.toLowerCase()}`);e.setProperty(r,ie(n))}class Pe{styleElement=null;styles=new Map;constructor(){}addStyle(e,t){this.styles.set(e,t),this.updateStyles()}removeStyle(e){this.styles.delete(e),this.updateStyles()}clearStyles(){if(this.styles.clear(),this.styleElement)this.styleElement.textContent=""}destroy(){if(this.clearStyles(),this.styleElement)this.styleElement.remove(),this.styleElement=null}ensureStyleElement(){if(!this.styleElement){let e=document.createElement("style");document.head.appendChild(e),this.styleElement=e}return this.styleElement}convertToCSS(e){return Object.entries(e).map(([t,n])=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${ie(n)};`).join(`
|
|
2
|
-
`)}updateStyles(){if(this.styles.size===0){if(this.styleElement)this.styleElement.textContent="";return}let e=this.ensureStyleElement(),t=
|
|
1
|
+
var ze=["#1677ff","#00b578","#ff8f1f","#ff3141","#eb2f96","#722ed1","#13c2c2","#faad14","#2f54eb","#a0d911"],X="#323233",_e="#c8c9cc",Ce="#ebedf0",ne="-apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif";function bt(e){return typeof e==="object"&&e!==null&&typeof e.save==="function"&&typeof e.beginPath==="function"&&typeof e.fill==="function"&&typeof e.stroke==="function"&&typeof e.fillText==="function"}function Fe(e,t,n=5){let r=e,o=t;if(!Number.isFinite(r)||!Number.isFinite(o))throw Error("niceTicks: domain must be finite numbers");if(r===o){let u=Math.abs(r)>1?Math.abs(r)*0.1:1;r-=u,o+=u}if(r>o)[r,o]=[o,r];let s=(o-r)/Math.max(1,n),a=yt(s),l=Math.floor(r/a)*a,c=Math.ceil(o/a)*a,p=[];for(let u=l;u<=c+a*0.000000001;u+=a)p.push(vt(u,a));return{min:l,max:c,step:a,ticks:p}}function yt(e){let t=Math.pow(10,Math.floor(Math.log10(e))),n=e/t,r;if(n<=1)r=1;else if(n<=2)r=2;else if(n<=5)r=5;else r=10;return r*t}function vt(e,t){let n=Math.max(0,-Math.floor(Math.log10(t))+1);return Number(e.toFixed(n))}class Y{min;max;ticks;step;rangeStart;rangeEnd;constructor(e,t,n,r,o={}){let{min:i,max:s,splitCount:a=5}=o,l=i,c=s;if(l===void 0||c===void 0){let p=Fe(e,t,a);l=l??p.min,c=c??p.max,this.ticks=p.ticks,this.step=p.step}else{this.step=(c-l)/Math.max(1,a),this.ticks=[];for(let p=0;p<=a;p+=1)this.ticks.push(l+p*this.step)}this.min=l,this.max=c,this.rangeStart=n,this.rangeEnd=r}scale(e){let t=(e-this.min)/(this.max-this.min);return this.rangeStart+t*(this.rangeEnd-this.rangeStart)}}class re{categories;bandWidth;innerGapRatio;rangeStart;constructor(e,t,n,r=0.35){this.categories=e;this.innerGapRatio=r,this.rangeStart=t;let o=Math.max(1,e.length);this.bandWidth=(n-t)/o}bandStart(e){return this.rangeStart+this.bandWidth*e}center(e){return this.bandStart(e)+this.bandWidth/2}innerWidth(){return this.bandWidth*(1-this.innerGapRatio)}groupInnerWidth(e){return this.innerWidth()/Math.max(1,e)*0.8}}var Ct={top:12,right:16,bottom:12,left:16};function Rt(e,t){let{legend:n}=e,r=e.legendItems??[],o=n?.fontSize??12,i=n?.itemGap??16,s=n?.markerSize??12;if(n?.position==="right"){let l=0;for(let c of r){let p=s+6+t(c);if(p>l)l=p}return{width:l+12,height:Math.max(r.length*(o+8)+12,0)}}let a=0;for(let l of r)a+=s+6+t(l)+i;if(a>0)a-=i;return{width:a,height:o+12+4}}function Re(e,t){let n={...Ct,...e.basePadding},r=n.top,o=n.bottom,i=n.left,s=n.right,a=null;if(e.title?.text){let C=e.title.fontSize??16;a={x:0,y:0,width:e.width,height:C},r+=C+(e.title.padding??16)}let l=null,c=e.legend;if(c&&c.show!==!1&&(e.legendItems?.length??0)>0){let C=Rt(e,t),w=c.position??"top";if(w==="top")l={x:0,y:a?a.height:0,width:e.width,height:C.height},r+=C.height;else if(w==="bottom")l={x:0,y:e.height-C.height,width:e.width,height:C.height},o+=C.height;else l={x:e.width-C.width,y:r,width:C.width,height:Math.max(0,e.height-r-o)},s+=C.width}let p=11,u=0,d=0,m=0,f=0,y=e.valueLabels??[],h=e.categoryLabels??[];if(e.horizontal){if(h.length>0){for(let C of h){let w=t(C);if(w>f)f=w}f+=16,i+=f}if(y.length>0)m=p+16,o+=m}else{if(y.length>0){for(let C of y){let w=t(C);if(w>u)u=w}u+=16,i+=u}if(h.length>0)d=p+16,o+=d}let g=Math.max(0,e.width-i-s),R=Math.max(0,e.height-r-o),v={x:i,y:r,width:g,height:R},x=e.horizontal?{x:v.x,y:v.y+v.height,width:g,height:m}:{x:v.x-u,y:r,width:u,height:R},T=e.horizontal?{x:v.x-f,y:r,width:f,height:R}:{x:i,y:v.y+R,width:g,height:d};return{plot:v,valueAxisBox:x,categoryAxisBox:T,titleBox:a,legendBox:l,padding:n}}function xe(e,t){let n=null,r=null;return{run(...o){if(r=o,n!==null)clearTimeout(n);n=setTimeout(()=>{if(n=null,r!==null){let i=r;r=null,e(...i)}},t)},cancel(){if(n!==null)clearTimeout(n),n=null;r=null},pending(){return n!==null}}}function xt(e,t=ne){return`${e}px ${t}`}function S(e,t,n=ne){let r=xt(t,n);return e.font=r,r}function W(e,t,n,r=ne){return S(e,n,r),e.measureText(t).width}class Te{ctx;constructor(e){this.ctx=e}drawValueAxis(e){let{plot:t,scale:n,labels:r,horizontal:o=!1,labelFontSize:i=11,labelColor:s=X,gridColor:a=Ce,gridLineWidth:l=1,gridLineDash:c,showGrid:p=!0}=e,u=n.ticks,{ctx:d}=this;for(let m=0;m<u.length;m+=1){let f=n.scale(u[m]),y=r[m]??String(u[m]);if(p){if(d.save(),d.strokeStyle=a,d.lineWidth=l,c&&c.length>0)d.setLineDash(c);if(d.beginPath(),o)d.moveTo(t.x,f),d.lineTo(t.x+t.width,f);else d.moveTo(t.x,f),d.lineTo(t.x+t.width,f);d.stroke(),d.restore()}if(S(d,i),d.fillStyle=s,d.textBaseline="middle",o)d.textAlign="center",d.fillText(y,f,t.y+t.height+8);else d.textAlign="right",d.fillText(y,t.x-8,f)}}drawCategoryAxis(e){let{plot:t,scale:n,labels:r,horizontal:o=!1,axisColor:i=_e,labelFontSize:s=11,labelColor:a=X,gridColor:l=Ce,gridLineWidth:c=1,showGrid:p=!1}=e,{ctx:u}=this,d=r.length;if(p){u.save(),u.strokeStyle=l,u.lineWidth=c,u.beginPath();for(let m=0;m<d;m+=1){let f=n.center(m);if(o)u.moveTo(t.x,f),u.lineTo(t.x+t.width,f);else u.moveTo(f,t.y),u.lineTo(f,t.y+t.height)}u.stroke(),u.restore()}S(u,s),u.fillStyle=a,u.textBaseline="middle";for(let m=0;m<d;m+=1){let f=n.center(m);if(o)u.textAlign="right",u.fillText(r[m],t.x-8,f);else u.textAlign="center",u.fillText(r[m],f,t.y+t.height+8)}if(u.save(),u.strokeStyle=i,u.lineWidth=1,u.beginPath(),o)u.moveTo(t.x,t.y),u.lineTo(t.x,t.y+t.height);else u.moveTo(t.x,t.y+t.height),u.lineTo(t.x+t.width,t.y+t.height);u.stroke(),u.restore()}}class we{ctx;constructor(e){this.ctx=e}draw(e){let{box:t,items:n,position:r="top",fontSize:o=12,color:i=X,markerSize:s=12,itemGap:a=16}=e;if(n.length===0)return;let{ctx:l}=this;if(S(l,o),r==="right"){let d=t.y+o/2+4;for(let m of n)this.drawItem(m,t.x,d,o,s,i),d+=o+8;return}let c=0;for(let d of n)c+=s+6+W(l,d.name,o)+a;c-=a;let p=t.x+(t.width-c)/2,u=t.y+t.height/2;for(let d of n)this.drawItem(d,p,u,o,s,i),p+=s+6+W(l,d.name,o)+a}drawItem(e,t,n,r,o,i){let{ctx:s}=this;s.fillStyle=e.color,s.beginPath(),s.rect(t,n-o/2,o,o),s.fill(),s.fillStyle=i,s.textAlign="left",s.textBaseline="middle",s.fillText(e.name,t+o+6,n)}}class M{ctx;option;width;height;dpr;palette;cartesian=null;plot=null;hover=null;destroyed=!1;constructor(e,t){this.ctx=e.ctx,this.option=t,this.width=e.width,this.height=e.height,this.dpr=e.dpr,this.palette=e.palette??ze}setOption(e){return this.option={...this.option,...e},this}resize(e,t,n){if(this.width=Math.max(0,e),this.height=Math.max(0,t),n!==void 0&&Number.isFinite(n)&&n>0)this.dpr=n;return this}render(){if(this.destroyed)return this;let{ctx:e,width:t,height:n,dpr:r}=this;e.save(),e.scale(r,r),e.clearRect(0,0,t,n);let o=this.getBackgroundColor();if(o)e.fillStyle=o,e.fillRect(0,0,t,n);let i=this.computeLayout();if(this.plot=i.plot,this.drawTitle(i),this.drawLegend(i),this.hasCartesianAxis())this.cartesian=this.buildCartesianScales(i),this.drawCartesianAxis(i);else this.cartesian=null;if(this.drawSeries(e,i,this.option),this.hover)this.drawTooltip(this.hover);return e.restore(),this}setHover(e,t){if(this.option.tooltip?.show===!1)this.hover=null;else this.hover=this.hitTestSeries(e,t);return this.render()}clearHover(){return this.hover=null,this.render()}destroy(){this.destroyed=!0}isDestroyed(){return this.destroyed}hasCartesianAxis(){return!0}getValueDomain(){return{min:0,max:1}}getCategoryLabels(){return[]}isHorizontal(){return!1}getBackgroundColor(){return this.option.backgroundColor}getTitle(){return this.option.title}getLegend(){let e=this.option.legend;if(e)return e;return this.getLegendItems().length>0?{position:"top"}:void 0}getLegendItems(){return[]}getValueAxis(){return this.option.yAxis}getCategoryAxis(){return this.option.xAxis}computeLayout(){let e=this.buildLayoutInput();return Re(e,(n)=>W(this.ctx,n,11))}buildLayoutInput(){let e=this.isHorizontal(),t=this.hasCartesianAxis();return{width:this.width,height:this.height,title:this.getTitle(),legend:this.getLegend(),legendItems:this.getLegendItems().map((n)=>n.name),valueLabels:t&&!e?this.computeValueLabels():void 0,categoryLabels:t?this.getCategoryLabels():void 0,horizontal:e}}computeValueLabels(){let e=this.getValueDomain(),t=this.getValueAxis();return new Y(e.min,e.max,0,1,{min:t?.min,max:t?.max,splitCount:t?.splitCount}).ticks.map((r)=>t?.format?t.format(r):String(r))}drawTitle(e){let t=this.getTitle();if(!t?.text||!e.titleBox)return;let{ctx:n}=this;S(n,t.fontSize??16),n.fillStyle=t.color??"#323233",n.textAlign="center",n.textBaseline="top",n.fillText(t.text,this.width/2,e.titleBox.y)}drawLegend(e){let t=this.getLegend();if(t?.show===!1||!e.legendBox)return;let n=this.getLegendItems();if(n.length===0)return;new we(this.ctx).draw({box:e.legendBox,items:n,position:t?.position??"top",fontSize:t?.fontSize,color:t?.color,markerSize:t?.markerSize,itemGap:t?.itemGap})}buildCartesianScales(e){let{plot:t}=e,n=this.isHorizontal(),r=this.getValueDomain(),o=this.getCategoryLabels(),i=this.getValueAxis(),s=new Y(r.min,r.max,n?t.x:t.y+t.height,n?t.x+t.width:t.y,{min:i?.min,max:i?.max,splitCount:i?.splitCount}),a=new re(o,n?t.y:t.x,n?t.y+t.height:t.x+t.width);return{value:s,category:a}}drawCartesianAxis(e){let t=this.cartesian;if(!t)return;let{ctx:n}=this,{plot:r}=e,o=this.isHorizontal(),i=this.getValueAxis(),s=this.getCategoryAxis(),a=this.getCategoryLabels(),l=new Te(n),c=t.value.ticks.map((p)=>i?.format?i.format(p):String(p));l.drawValueAxis({plot:r,scale:t.value,labels:c,horizontal:o,labelFontSize:i?.labelFontSize,labelColor:i?.labelColor,gridColor:i?.gridColor,gridLineWidth:i?.gridLineWidth,gridLineDash:i?.gridLineDash,showGrid:i?.showGrid??!0}),l.drawCategoryAxis({plot:r,scale:t.category,labels:a,horizontal:o,labelFontSize:s?.labelFontSize,labelColor:s?.labelColor,gridColor:s?.gridColor,gridLineWidth:s?.gridLineWidth,showGrid:s?.showGrid??!1})}seriesColor(e,t){return t??this.palette[e%this.palette.length]}getTooltipOption(){return this.option.tooltip}defaultTooltipLines(e){let t=[e.name];for(let n of e.items)t.push(`${n.name}: ${n.value}`);return t}drawTooltip(e){let t=this.getTooltipOption();if(t?.show===!1)return;let n=t?.formatter,r=n?n(e):this.defaultTooltipLines(e),o=Array.isArray(r)?r:[r];if(o.length===0)return;let{ctx:i}=this,s=12,a=10,l=8,c=18,p=4,u=6;S(i,s);let d=0;for(let R of o)d=Math.max(d,W(i,R,s));let m=d+a*2+p*2+u,f=o.length*c+l*2,y=this.plot,h,g;if(y&&this.isHorizontal()){if(h=y.x+y.width+8,g=e.y-f/2,h+m>this.width-4)h=y.x-m-8}else if(y){if(h=e.x+14,g=e.y-f/2,h+m>this.width-4)h=e.x-m-14}else if(h=e.x+14,g=e.y-f/2,h+m>this.width-4)h=e.x-m-14;h=Math.max(4,h),g=Math.max(4,Math.min(g,this.height-f-4)),i.save(),i.fillStyle="rgba(50, 50, 51, 0.92)",i.beginPath(),this.roundRectPath(h,g,m,f,6),i.fill(),i.textBaseline="middle",i.textAlign="left",o.forEach((R,v)=>{let x=g+l+c*v+c/2,T=v>0?e.items[v-1]?.color:void 0;if(T)i.fillStyle=T,i.beginPath(),i.arc(h+a+p,x,p,0,Math.PI*2),i.fill();i.fillStyle="#ffffff";let C=h+a+(T?p*2+u:0);i.fillText(R,C,x)}),i.restore()}roundRectPath(e,t,n,r,o){let i=this.ctx,s=Math.min(o,n/2,r/2);i.moveTo(e+s,t),i.lineTo(e+n-s,t),i.arcTo(e+n,t,e+n,t+r,s),i.arcTo(e+n,t+r,e,t+r,s),i.arcTo(e,t+r,e,t,s),i.arcTo(e,t,e+n,t,s),i.closePath()}}class oe extends M{getValueDomain(){let{series:e,yAxis:t,startFromZero:n=!1}=this.option,r=1/0,o=-1/0;for(let i of e)for(let s of i.data){if(s<r)r=s;if(s>o)o=s}if(!Number.isFinite(r)||!Number.isFinite(o))return{min:0,max:1};if(n&&r>0)r=0;if(t?.min!==void 0)r=Math.min(r,t.min);if(t?.max!==void 0)o=Math.max(o,t.max);return{min:r,max:o}}getCategoryLabels(){return this.option.xAxis.labels}getLegendItems(){return this.option.series.filter((e)=>e.name).map((e,t)=>({name:e.name,color:this.seriesColor(t,e.color)}))}drawSeries(e,t,n){let r=this.cartesian;if(!r)return;let{plot:o}=t,{value:i,category:s}=r,a=this.getHoverCategoryIndex(),l=n.series.map((c)=>c.data.map((p,u)=>({x:s.center(u),y:i.scale(p)})));if(a>=0){let c=s.center(a);e.save(),e.strokeStyle="#c8c9cc",e.lineWidth=1,e.setLineDash([4,3]),e.beginPath(),e.moveTo(c,o.y),e.lineTo(c,o.y+o.height),e.stroke(),e.restore()}n.series.forEach((c,p)=>{let u=l[p];if(u.length===0)return;let d=this.seriesColor(p,c.color),m=c.lineWidth??2;if(c.area)e.save(),e.fillStyle=d,e.globalAlpha=0.15,e.beginPath(),this.tracePath(e,u,c.smooth??!1),e.lineTo(u[u.length-1].x,o.y+o.height),e.lineTo(u[0].x,o.y+o.height),e.closePath(),e.fill(),e.restore();if(e.save(),e.strokeStyle=d,e.lineWidth=m,e.lineJoin="round",e.lineCap="round",e.beginPath(),this.tracePath(e,u,c.smooth??!1),e.stroke(),e.restore(),c.showSymbol!==!1){let f=Math.max(2.5,m+0.5);e.save(),e.fillStyle=d;for(let y=0;y<u.length;y+=1){let h=u[y],g=y===a?f*1.6:f;e.beginPath(),e.arc(h.x,h.y,g,0,Math.PI*2),e.fill()}e.restore()}})}hitTestSeries(e,t){let n=this.cartesian,r=this.plot;if(!n||!r)return null;if(t<r.y||t>r.y+r.height)return null;let o=this.option.xAxis.labels,i=-1,s=1/0;for(let l=0;l<o.length;l+=1){let c=Math.abs(n.category.center(l)-e);if(c<s)s=c,i=l}if(i<0||s>n.category.bandWidth/2)return null;let a=this.option.series.map((l,c)=>({name:l.name??`系列${c+1}`,value:l.data[i]??0,color:this.seriesColor(c,l.color)}));return{x:e,y:t,name:o[i],items:a}}getHoverCategoryIndex(){let e=this.hover;if(!e)return-1;return this.option.xAxis.labels.indexOf(e.name)}tracePath(e,t,n){if(t.length===0)return;if(e.moveTo(t[0].x,t[0].y),!n||t.length<3){for(let r=1;r<t.length;r+=1)e.lineTo(t[r].x,t[r].y);return}for(let r=0;r<t.length-1;r+=1){let o=t[Math.max(0,r-1)],i=t[r],s=t[r+1],a=t[Math.min(t.length-1,r+2)],l=i.x+(s.x-o.x)/6,c=i.y+(s.y-o.y)/6,p=s.x-(a.x-i.x)/6,u=s.y-(a.y-i.y)/6;e.bezierCurveTo(l,c,p,u,s.x,s.y)}}}class ie extends M{isHorizontal(){return this.option.horizontal??!1}getValueDomain(){let{series:e,yAxis:t}=this.option,n=0,r=0,o=Ve(e),i=Math.max(0,...e.map((s)=>s.data.length));for(let s=0;s<i;s+=1)for(let a of o){let l=0,c=0;for(let p of a){let u=p.data[s]??0;if(u>=0)l+=u;else c+=u}if(l>n)n=l;if(c<r)r=c}if(t?.min!==void 0)r=Math.min(r,t.min);if(t?.max!==void 0)n=Math.max(n,t.max);return{min:r,max:n}}getCategoryLabels(){return this.option.xAxis.labels}getLegendItems(){return this.option.series.filter((e)=>e.name).map((e,t)=>({name:e.name,color:this.seriesColor(t,e.color)}))}drawSeries(e,t,n){let r=this.cartesian;if(!r)return;let{value:o,category:i}=r,s=n.horizontal??!1,a=Ve(n.series),l=n.xAxis.labels.length,c=this.getHoverCategoryIndex();for(let p=0;p<l;p+=1){let u=a,d=u.length,m=n.series.map((h)=>h.barWidth).find((h)=>h!==void 0&&h>0),f=this.computeSlot(i,d,m),y=c===p;u.forEach((h,g)=>{let R=f.offset+g*f.size,v=0;h.forEach((x)=>{let T=x.data[p]??0,C=this.seriesColor(n.series.indexOf(x),x.color),w=y?wt(C,0.25):C;if(s){let N=o.scale(0),j=o.scale(v+T),_=Math.min(N,j),F=Math.abs(j-N),V=i.bandStart(p)+R;this.drawBar(e,{x:_,y:V,width:F,height:f.size,radius:x.borderRadius??0,color:w,roundSide:T>=0?"right":"left"})}else{let N=o.scale(v),j=o.scale(v+T),_=Math.min(N,j),F=Math.abs(j-N),V=i.bandStart(p)+R;this.drawBar(e,{x:V,y:_,width:f.size,height:F,radius:x.borderRadius??0,color:w,roundSide:T>=0?"top":"bottom"})}v+=T})})}}hitTestSeries(e,t){let n=this.cartesian;if(!n)return null;let r=this.option.horizontal??!1,o=this.getCategoryLabels();for(let i=0;i<o.length;i+=1){let s=n.category.bandStart(i),a=n.category.bandWidth;if(!(r?t>=s&&t<=s+a:e>=s&&e<=s+a))continue;let c=this.option.series.map((p,u)=>({name:p.name??`系列${u+1}`,value:p.data[i]??0,color:this.seriesColor(u,p.color)}));return{x:e,y:t,name:o[i],items:c}}return null}getHoverCategoryIndex(){let e=this.hover;if(!e)return-1;return this.getCategoryLabels().indexOf(e.name)}computeSlot(e,t,n){let r=e.bandWidth,o=e.innerWidth();if(n!==void 0)return{offset:(r-n*t)/2,size:n};let i=o/Math.max(1,t)*0.8,s=(r-o)/2,a=(o-i*t)/2;return{offset:s+a,size:i}}drawBar(e,t){if(t.width<=0||t.height<=0)return;e.save(),e.fillStyle=t.color,e.beginPath(),Tt(e,t,t.radius,t.roundSide),e.fill(),e.restore()}}function Ve(e){let t=[],n=new Map;for(let r of e)if(r.stack){let o=n.get(r.stack);if(!o)o=[],n.set(r.stack,o),t.push(o);o.push(r)}else t.push([r]);return t}function Tt(e,t,n,r){let{x:o,y:i,width:s,height:a}=t,l=Math.min(n,s/2,a/2);if(l<=0){e.rect(o,i,s,a);return}let c=r==="top"||r==="left",p=r==="top"||r==="right",u=r==="bottom"||r==="left",d=r==="bottom"||r==="right";if(e.moveTo(o+(c?l:0),i),e.lineTo(o+s-(p?l:0),i),p)e.arcTo(o+s,i,o+s,i+l,l);else e.lineTo(o+s,i);if(e.lineTo(o+s,i+a-(d?l:0)),d)e.arcTo(o+s,i+a,o+s-l,i+a,l);else e.lineTo(o+s,i+a);if(e.lineTo(o+(u?l:0),i+a),u)e.arcTo(o,i+a,o,i+a-l,l);else e.lineTo(o,i+a);if(e.lineTo(o,i+(c?l:0)),c)e.arcTo(o,i,o+l,i,l);else e.lineTo(o,i);e.closePath()}function wt(e,t){let n=Math.max(0,Math.min(1,t)),r=e.match(/^#([0-9a-f]{3,8})$/i);if(r){let i,s,a,l=r[1];if(l.length===3)i=parseInt(l[0]+l[0],16),s=parseInt(l[1]+l[1],16),a=parseInt(l[2]+l[2],16);else i=parseInt(l.slice(0,2),16),s=parseInt(l.slice(2,4),16),a=parseInt(l.slice(4,6),16);return i=Math.round(i+(255-i)*n),s=Math.round(s+(255-s)*n),a=Math.round(a+(255-a)*n),`rgb(${i}, ${s}, ${a})`}let o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){let i=Math.round(parseInt(o[1])+(255-parseInt(o[1]))*n),s=Math.round(parseInt(o[2])+(255-parseInt(o[2]))*n),a=Math.round(parseInt(o[3])+(255-parseInt(o[3]))*n);return`rgb(${i}, ${s}, ${a})`}return e}var Ee=Math.PI*2;class ae extends M{hasCartesianAxis(){return!1}getLegendItems(){return this.option.data.map((e,t)=>({name:e.name,color:e.color??this.seriesColor(t)}))}hitTestSeries(e,t){let n=this.plot;if(!n)return null;let r=n.x+n.width/2,o=n.y+n.height/2,i=Math.min(n.width,n.height)/2,s=se(this.option.radius??"60%",i),a=se(this.option.innerRadius??0,i),l=this.option.startAngle??-Math.PI/2,c=e-r,p=t-o,u=Math.hypot(c,p);if(u<a||u>s)return null;let d=this.option.data.filter((h)=>h.value>0),m=d.reduce((h,g)=>h+g.value,0);if(m<=0)return null;let f=Math.atan2(p,c);while(f<l)f+=Ee;let y=l;for(let h=0;h<d.length;h+=1){let g=d[h],R=g.value/m*Ee;if(f>=y&&f<=y+R){let v=Math.round(g.value/m*100);return{x:e,y:t,name:g.name,items:[{name:g.name,value:`${v}%`,color:g.color??this.seriesColor(h)}]}}y+=R}return null}drawSeries(e,t,n){let{plot:r}=t,o=r.x+r.width/2,i=r.y+r.height/2,s=Math.min(r.width,r.height)/2,a=se(n.radius??"60%",s),l=se(n.innerRadius??0,s),c=n.startAngle??-Math.PI/2,p=n.data.filter((m)=>m.value>0),u=p.reduce((m,f)=>m+f.value,0);if(u<=0||a<=0)return;let d=c;p.forEach((m,f)=>{let y=m.value/u*Ee,h=m.color??this.seriesColor(f);if(e.save(),e.fillStyle=h,e.beginPath(),l>0)e.arc(o,i,a,d,d+y),e.arc(o,i,l,d+y,d,!0);else e.arc(o,i,a,d,d+y),e.lineTo(o,i);if(e.closePath(),e.fill(),e.strokeStyle="#ffffff",e.lineWidth=1,e.stroke(),e.restore(),n.showLabel!==!1){let g=d+y/2,R=u>0?Math.round(m.value/u*100):0,v=`${m.name} ${R}%`;if(n.labelPosition==="outside"){let x=n.labelLineLength??14,T=n.labelGap??6,C=Math.cos(g),w=Math.sin(g),N=o+C*a,j=i+w*a,_=o+C*(a+x),F=i+w*(a+x),V=C>=0?1:-1,qe=_+V*T,je=F;e.save(),e.strokeStyle=n.labelLineColor??"#c0c4cc",e.lineWidth=1,e.beginPath(),e.moveTo(N,j),e.lineTo(_,F),e.lineTo(qe,je),e.stroke(),e.restore(),S(e,n.labelFontSize??10),e.fillStyle=n.labelColor??"#323233",e.textAlign=V>0?"left":"right",e.textBaseline="middle",e.fillText(v,qe,je)}else{let x=(a+(l>0?l:0))/2*0.85,T=o+Math.cos(g)*x,C=i+Math.sin(g)*x;S(e,n.labelFontSize??10),e.fillStyle=n.labelColor??"#ffffff",e.textAlign="center",e.textBaseline="middle",e.fillText(v,T,C)}}d+=y})}}function se(e,t){if(typeof e==="number")return Math.max(0,e);let n=/^(\d+(?:\.\d+)?)%$/.exec(e);if(!n)return t;return Number(n[1])/100*t}class le extends M{hasCartesianAxis(){return!1}getLegendItems(){return this.option.series.filter((e)=>e.name).map((e,t)=>({name:e.name,color:this.seriesColor(t,e.color)}))}drawSeries(e,t,n){let{plot:r}=t,o=r.x+r.width/2,i=r.y+r.height/2,s=n.radius??Math.min(r.width,r.height)/2*0.6,a=n.indicators.length;if(a===0||s<=0)return;let l=n.startAngle??-Math.PI/2,c=We/a,p=Math.max(1,n.splitCount??5),u=n.gridColor??"#ebedf0",d=n.gridLineWidth??1,m=(h)=>l+h*c,f=(h,g)=>({x:o+Math.cos(h)*g,y:i+Math.sin(h)*g});for(let h=1;h<=p;h+=1){let g=s*h/p;e.save(),e.strokeStyle=u,e.lineWidth=d,e.beginPath();for(let R=0;R<a;R+=1){let v=f(m(R),g);if(R===0)e.moveTo(v.x,v.y);else e.lineTo(v.x,v.y)}e.closePath(),e.stroke(),e.restore()}e.save(),e.strokeStyle=u,e.lineWidth=d,e.beginPath();for(let h=0;h<a;h+=1){let g=f(m(h),s);e.moveTo(o,i),e.lineTo(g.x,g.y)}e.stroke(),e.restore();let y=n.labelFontSize??11;S(e,y),e.fillStyle=n.labelColor??"#323233";for(let h=0;h<a;h+=1){let g=f(m(h),s+12);e.textAlign=Math.abs(g.x-o)<1?"center":g.x>o?"left":"right",e.textBaseline=Math.abs(g.y-i)<1?"middle":g.y>i?"top":"bottom",e.fillText(n.indicators[h].name,g.x,g.y)}n.series.forEach((h,g)=>{let R=this.seriesColor(g,h.color),v=n.indicators.map((x,T)=>{let C=x.max??this.indicatorMax(n,T),w=h.data[T]??0,N=C>0?Math.max(0,Math.min(1,w/C)):0;return f(m(T),s*N)});if(h.area!==!1)e.save(),e.fillStyle=R,e.globalAlpha=0.2,e.beginPath(),this.tracePolygon(e,v),e.closePath(),e.fill(),e.restore();e.save(),e.strokeStyle=R,e.lineWidth=h.lineWidth??2,e.lineJoin="round",e.beginPath(),this.tracePolygon(e,v),e.closePath(),e.stroke(),e.restore()})}hitTestSeries(e,t){let n=this.plot;if(!n)return null;let r=n.x+n.width/2,o=n.y+n.height/2,i=this.option.radius??Math.min(n.width,n.height)/2*0.6,s=this.option.indicators.length;if(s===0)return null;let a=this.option.startAngle??-Math.PI/2,l=We/s,c=-1,p=24;for(let d=0;d<s;d+=1){let m=this.option.indicators[d].max??this.indicatorMax(this.option,d),f=a+d*l;for(let y=0;y<this.option.series.length;y+=1){let h=this.option.series[y].data[d]??0,g=m>0?Math.max(0,Math.min(1,h/m)):0,R=r+Math.cos(f)*i*g,v=o+Math.sin(f)*i*g,x=Math.hypot(e-R,t-v);if(x<p)p=x,c=d}}if(c<0)return null;let u=this.option.series.map((d,m)=>({name:d.name??`系列${m+1}`,value:d.data[c]??0,color:this.seriesColor(m,d.color)}));return{x:e,y:t,name:this.option.indicators[c].name,items:u}}indicatorMax(e,t){let n=0;for(let r of e.series){let o=r.data[t]??0;if(o>n)n=o}return n}tracePolygon(e,t){if(t.length===0)return;e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n+=1)e.lineTo(t[n].x,t[n].y)}}var We=Math.PI*2;function D(){let e=Et();if(typeof e.devicePixelRatio==="number"&&e.devicePixelRatio>0)return e.devicePixelRatio;return 1}function Et(){if(typeof globalThis<"u")return globalThis;return{}}function I(e){let n=St()[e];return typeof n==="object"&&n!==null?n:null}function ue(e){let t=e.platform??H()??"wx",n=I(t),r=n?.createSelectorQuery;if(typeof r!=="function")return Promise.reject(Error(`getMiniProgramCanvasNode: ${t}.createSelectorQuery is not available`));return new Promise((o,i)=>{let s=r.call(n);if(e.instance&&typeof s.in==="function")s=s.in(e.instance);if(typeof s.select!=="function"){i(Error(`${t}.createSelectorQuery().select is not available`));return}s.select(e.selector).fields({node:!0,size:!0}).exec((a)=>{let c=(Array.isArray(a)?a[0]:void 0)?.node;if(!c||typeof c.getContext!=="function"){i(Error(`getMiniProgramCanvasNode: canvas node not found for "${e.selector}"`));return}o(c)})})}function H(){if(I("wx"))return"wx";if(I("my"))return"my";if(I("tt"))return"tt";return null}function Se(e){let t=e??H()??"wx",n=I(t),r=n?.getSystemInfoSync;if(typeof r==="function")try{let o=r.call(n);if(typeof o.pixelRatio==="number"&&o.pixelRatio>0)return o.pixelRatio}catch{}return D()}function U(e,t={}){let n=e.getContext("2d");if(!n)throw Error("resolveMiniProgramCanvas: 2d context is not available");let r=t.dpr??Se(),o=t.width??e.width,i=t.height??e.height;return{ctx:n,width:o,height:i,dpr:r,palette:t.palette}}function St(){if(typeof globalThis<"u")return globalThis;return{}}function G(e,t={}){if(!e)throw Error("resolveWebCanvas: canvas element is required");let n=e.getContext("2d");if(!n)throw Error("resolveWebCanvas: 2d context is not available");let r=t.dpr??D(),o=t.width??(e.clientWidth||e.width),i=t.height??(e.clientHeight||e.height);return e.width=Math.round(o*r),e.height=Math.round(i*r),{ctx:n,width:o,height:i,dpr:r,palette:t.palette}}function Q(e,t){switch(t.type){case"line":return new oe(e,t);case"bar":return new ie(e,t);case"pie":return new ae(e,t);case"radar":return new le(e,t);default:throw Error(`createChart: unsupported chart type "${t.type}"`)}}function Pt(e,t,n={}){return Q(G(e,n),t)}function Lt(e,t,n={}){return Q(U(e,n),t)}function $e(e){throw Error("resolveNativeCanvas is not implemented yet. Native app support (iOS/Android/HarmonyOS) is planned for a future phase; implement ICanvas2D on the host side and fill in this resolver.")}function O(e){if(e===void 0||e===null)return[];return Array.isArray(e)?e:[e]}function Ue(e){return typeof e==="object"&&e!==null&&"component"in e}function Ge(e){return typeof e==="object"&&e!==null&&"tag"in e&&e.tag!=="slot"}function Ke(e){return typeof e==="object"&&e!==null&&"tag"in e&&e.tag==="slot"}function Xe(e,t,n,r,o,i){return{tag:e,props:t,children:n,listeners:r,key:o,directions:i}}function At(e,t={}){return{tag:e,...t}}function b(e){return(t={})=>At(e,t)}var Mt=b("div"),Zn=b("span"),er=b("p"),tr=b("button"),nr=b("input"),rr=b("section"),or=b("main"),ir=b("header"),sr=b("footer"),ar=b("nav"),lr=b("article"),ur=b("aside"),cr=b("h1"),pr=b("h2"),dr=b("h3"),hr=b("h4"),mr=b("h5"),fr=b("h6"),gr=b("strong"),br=b("em"),yr=b("small"),vr=b("pre"),Cr=b("code"),Rr=b("blockquote"),xr=b("ul"),Tr=b("ol"),wr=b("li"),Er=b("a"),Sr=b("img"),Pr=b("form"),Lr=b("label"),Ar=b("textarea"),Mr=b("select"),Ir=b("option"),Or=b("table"),kr=b("thead"),Nr=b("tbody"),Dr=b("tr"),Hr=b("th"),Br=b("td");var z=Symbol("is_reactive"),P=Symbol("is_readonly"),It=Symbol("is_ref"),Ye=["push","pop","shift","unshift","splice","sort","reverse"];function L(e,t){return Boolean(Reflect.get(e,t))}function k(e){return e!==null&&typeof e==="object"}class Pe{pending=new Set;flushing=!1;flushPromise=null;flushResolve=null;enqueue(e){if(this.pending.has(e))return;if(this.pending.add(e),!this.flushing)queueMicrotask(()=>this.flush())}flush(){if(this.flushing)return;this.flushing=!0;try{while(this.pending.size>0){let e=Array.from(this.pending);this.pending.clear();for(let t of e)if(t.active)t()}}finally{this.flushing=!1;let e=this.flushResolve;this.flushResolve=null,this.flushPromise=null,e?.()}}nextTick(){if(!this.flushing&&this.pending.size===0)return Promise.resolve();if(this.flushPromise)return this.flushPromise;return this.flushPromise=new Promise((e)=>{this.flushResolve=e}),this.flushPromise}}var Ot=0,Le=new Pe;class A{static instance;activeEffect=null;effectStack=[];targetMap=new WeakMap;reactiveMap=new WeakMap;readonlyMap=new WeakMap;proxyMap=new WeakMap;constructor(){}static getInstance(){if(!A.instance)A.instance=new A;return A.instance}reactive(e){if(!k(e))return console.warn("reactive: target must be an object"),e;if(kt(e))return e;if(this.reactiveMap.has(e))return this.reactiveMap.get(e);if(Array.isArray(e))return this.createReactiveArray(e);let t=new Proxy(e,{get:(n,r)=>{if(r===z)return!0;if(r===P)return!1;this.track(n,r);let o=Reflect.get(n,r);if(k(o)&&!L(o,P))return this.reactive(o);return o},set:(n,r,o)=>{if(L(n,P))return console.warn(`Cannot set property ${String(r)} on readonly object`),!1;let i=Reflect.get(n,r);if(k(o)&&!L(o,z)&&!L(o,P))o=this.reactive(o);let s=Reflect.set(n,r,o);if(i!==o)this.trigger(n,r);return s},deleteProperty:(n,r)=>{if(L(n,P))return console.warn(`Cannot delete property ${String(r)} on readonly object`),!1;let o=r in n,i=Reflect.deleteProperty(n,r);if(o)this.trigger(n,r);return i}});return this.reactiveMap.set(e,t),this.proxyMap.set(t,e),t}toRawValue(e){if(k(e)&&this.proxyMap.has(e))return this.proxyMap.get(e);return e}createReactiveArray(e){if(this.reactiveMap.has(e))return this.reactiveMap.get(e);let t=new Proxy(e,{get:(n,r)=>{if(r===z)return!0;if(r===P)return!1;this.track(n,r);let o=Reflect.get(n,r);if(typeof r==="string"&&(r==="includes"||r==="indexOf"||r==="lastIndexOf")){this.track(n,"length");for(let s=0;s<n.length;s++)this.track(n,String(s));let i=o;return(...s)=>{let a=i.apply(n,s);if(a===!1||a===-1){let l=n.map((p)=>this.toRawValue(p));return l[r].apply(l,s.map((p)=>this.toRawValue(p)))}return a}}if(typeof r==="string"&&Ye.includes(r))return(...i)=>{let a=o.apply(n,i);return this.trigger(n,"length"),this.trigger(n,r),a};if(k(o)&&!L(o,P))return this.reactive(o);return o},set:(n,r,o)=>{if(L(n,P))return console.warn(`Cannot set property ${String(r)} on readonly object`),!1;let i=Reflect.get(n,r);if(k(o)&&!L(o,z)&&!L(o,P))o=this.reactive(o);let s=Reflect.set(n,r,o);if(i!==o){if(this.trigger(n,r),typeof r==="string"&&!isNaN(Number(r)))this.trigger(n,"length")}return s},deleteProperty:(n,r)=>{if(L(n,P))return console.warn(`Cannot delete property ${String(r)} on readonly object`),!1;let o=r in n,i=Reflect.deleteProperty(n,r);if(o)this.trigger(n,r),this.trigger(n,"length");return i}});return this.reactiveMap.set(e,t),this.proxyMap.set(t,e),t}readonly(e){if(!k(e))return console.warn("readonly: target must be an object"),e;if(L(e,P))return e;if(this.readonlyMap.has(e))return this.readonlyMap.get(e);let t=new Proxy(e,{get:(n,r)=>{if(r===z)return!1;if(r===P)return!0;let o=Reflect.get(n,r);if(k(o))return this.readonly(o);return o},set:()=>(console.warn("Cannot set property on readonly object"),!1),deleteProperty:()=>(console.warn("Cannot delete property on readonly object"),!1)});return this.readonlyMap.set(e,t),t}effect(e,t){let{lazy:n=!1,scheduler:r,throwOnError:o=!1}=t||{},i=()=>{if(!i.active)return e();try{return this.cleanup(i),this.effectStack.push(i),this.activeEffect=i,e()}catch(s){if(o)throw s;console.error("Effect error:",s);return}finally{this.effectStack.pop(),this.activeEffect=this.effectStack[this.effectStack.length-1]??null}};if(i.id=Ot++,i.deps=[],i.active=!0,i.scheduler=r,!n)i();return i}runWithEffect(e,t){this.effectStack.push(e),this.activeEffect=e;try{return t()}finally{this.effectStack.pop(),this.activeEffect=this.effectStack[this.effectStack.length-1]??null}}computed(e){let t=!0,n,r={},o=()=>{this.track(r,"value")},i=this.effect(()=>{n=e(),t=!1},{lazy:!0,scheduler:()=>{if(!t)t=!0,this.trigger(r,"value")}});return{get value(){if(t)i();return o(),n}}}cleanup(e){e.deps.forEach((t)=>{t.delete(e)}),e.deps.length=0}track(e,t){if(!this.activeEffect||!this.activeEffect.active)return;let n=this.targetMap.get(e);if(!n)n=new Map,this.targetMap.set(e,n);let r=n.get(t);if(!r)r=new Set,n.set(t,r);if(!r.has(this.activeEffect))r.add(this.activeEffect),this.activeEffect.deps.push(r)}trigger(e,t){let n=this.targetMap.get(e);if(!n)return;let r=n.get(t);if(!r)return;new Set(r).forEach((i)=>{if(i.active)if(i.scheduler)i.scheduler(i);else i()})}stop(e){if(e.active)this.cleanup(e),e.active=!1}}function Qe(e){return A.getInstance().reactive(e)}function B(e,t){return A.getInstance().effect(e,t)}function q(e){A.getInstance().stop(e)}function kt(e){return k(e)&&L(e,z)}function Je(e){let t=e.split(".");if(e.length===0||t.some((n)=>n.length===0||n==="__proto__"||n==="prototype"||n==="constructor"))throw Error(`Invalid model path "${e}"`);return t}function Me(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ze(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Nt(e){return typeof e==="string"?e:e.path}function Ie(e,t){let n=e;for(let r of Je(t)){if(!Me(n))throw Error(`Invalid model path "${t}"`);if(!Ze(n,r)){if(r in n)throw Error(`Invalid model path "${t}"`);return}n=n[r]}return n}function Dt(e,t,n){let r=Je(t),o=e;for(let s of r.slice(0,-1)){if(!Ze(o,s)){if(s in o)throw Error(`Invalid model path "${t}"`);o[s]={}}else if(!Me(o[s]))throw Error(`Invalid model path "${t}"`);let a=o[s];if(!Me(a))throw Error(`Invalid model path "${t}"`);o=a}let i=r[r.length-1];o[i]=n}function Ae(e,t){if(typeof e!=="string"&&e.format)return e.format(t);return t===void 0||t===null?"":String(t)}function Ht(e,t){if(typeof e!=="string"&&e.parse)return e.parse(t);return t}function Bt(e,t,n){if(e instanceof HTMLInputElement){if(e.type==="checkbox"){e.checked=Array.isArray(n)?n.some((r)=>String(r)===e.value):Boolean(n);return}if(e.type==="radio"){e.checked=n===e.value;return}e.value=Ae(t,n);return}if(e instanceof HTMLTextAreaElement){e.value=Ae(t,n);return}if(e instanceof HTMLSelectElement){if(e.multiple){let r=Array.isArray(n)?new Set(n.map(String)):new Set;for(let o=0;o<e.options.length;o+=1){let i=e.options.item(o);if(!i)continue;i.selected=r.has(i.value)}return}e.value=Ae(t,n)}}function qt(e,t){if(e instanceof HTMLInputElement){if(e.type==="checkbox"){if(Array.isArray(t)){let n=t.filter((r)=>String(r)!==e.value);return e.checked?[...n,e.value]:n}return e.checked}if(e.type==="radio")return e.checked?e.value:t;return e.value}if(e instanceof HTMLTextAreaElement)return e.value;if(e instanceof HTMLSelectElement){if(!e.multiple)return e.value;let n=[];for(let r=0;r<e.selectedOptions.length;r+=1){let o=e.selectedOptions.item(r);if(o)n.push(o.value)}return n}return}class Oe{bindings=new WeakMap;bind(e,t,n){if(!this.isSupportedControl(e))return;let r=this.bindings.get(e);if(r&&this.sameBinding(r,t))return;this.cleanup(e);let o=Nt(t),i=()=>Bt(e,t,Ie(n,o)),s=e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&!["checkbox","radio"].includes(e.type)?"input":"change",a=()=>{let c=Ie(n,o);Dt(n,o,Ht(t,qt(e,c)))};e.addEventListener(s,a);let l=B(i);this.bindings.set(e,{binding:t,path:o,parse:typeof t==="string"?void 0:t.parse,format:typeof t==="string"?void 0:t.format,eventName:s,listener:a,effect:l})}cleanup(e){let t=this.bindings.get(e);if(!t)return;e.removeEventListener(t.eventName,t.listener),q(t.effect),this.bindings.delete(e)}isSupportedControl(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement}sameBinding(e,t){if(typeof e.binding==="string"||typeof t==="string")return e.binding===t;return e.path===t.path&&e.parse===t.parse&&e.format===t.format}}var et=":root{--tu-rpx:calc(min(100vw, 750px) / 750);}",jt=/(-?\d+(?:\.\d+)?)rpx/g;function ce(e){return String(e).replace(jt,(t,n)=>`calc(${n} * var(--tu-rpx))`)}function pe(e){return/^on[A-Z]/.test(e)||/^on[a-z]/.test(e)}function tt(e){return e.slice(2).toLowerCase()}function nt(e){let[t,...n]=e.split(".");return{eventName:t,modifiers:new Set(n)}}function rt(e,t){let n=(r)=>{if(t.has("stop"))r.stopPropagation();if(t.has("prevent"))r.preventDefault();if(t.has("self")&&r.currentTarget!==r.target)return;if(t.has("once"))r.currentTarget.removeEventListener(r.type,n);e(r)};return n}function ot(e,t,n){let r=t.includes("-")?t:t.replace(/[A-Z]/g,(o)=>`-${o.toLowerCase()}`);e.setProperty(r,ce(n))}class ke{styleElement=null;styles=new Map;constructor(){}addStyle(e,t){this.styles.set(e,t),this.updateStyles()}removeStyle(e){this.styles.delete(e),this.updateStyles()}clearStyles(){if(this.styles.clear(),this.styleElement)this.styleElement.textContent=""}destroy(){if(this.clearStyles(),this.styleElement)this.styleElement.remove(),this.styleElement=null}ensureStyleElement(){if(!this.styleElement){let e=document.createElement("style");document.head.appendChild(e),this.styleElement=e}return this.styleElement}convertToCSS(e){return Object.entries(e).map(([t,n])=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${ce(n)};`).join(`
|
|
2
|
+
`)}updateStyles(){if(this.styles.size===0){if(this.styleElement)this.styleElement.textContent="";return}let e=this.ensureStyleElement(),t=et+`
|
|
3
3
|
`;this.styles.forEach((n)=>{if(t+=`${n.selector} {
|
|
4
4
|
${this.convertToCSS(n.properties)}
|
|
5
5
|
}
|
|
@@ -11,7 +11,7 @@ ${n.selector} {
|
|
|
11
11
|
${this.convertToCSS(o)}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
`})}),e.textContent=t}}class G{state;bindings=[];templateRegex=/{{(.*?)}}/g;constructor(e){this.state=e;if(!e||typeof e!=="object")throw Error("TemplateEngine requires a valid state object")}parseTemplate(e){if(typeof e!=="string")e=String(e);let t=document.createTextNode("");this.templateRegex.lastIndex=0;let n=Array.from(e.matchAll(this.templateRegex));if(n&&n.length>0)this.setupReactiveBindings(t,e,n);else t.textContent=e;return t}setupReactiveBindings(e,t,n){let r=new Set,o=this.evaluateTemplate(t,n,r);e.textContent=o;let i=N(()=>{try{let s=this.evaluateTemplate(t,n,r);if(e.textContent!==s)e.textContent=s}catch(s){console.error("Template update error:",s),e.textContent=`Error: ${s instanceof Error?s.message:"Unknown error"}`}});this.bindings.push({node:e,originalText:t,effect:i})}evaluateTemplate(e,t,n){let r=e;return t.forEach((o)=>{let i=o[1]?.trim();if(i){n.add(i);let s=this.getValueFromState(i),a=s===void 0||s===null?"":String(s);r=r.replace(o[0],a)}}),r}getValueFromState(e){if(!e)return;let t=e.split("."),n=this.state;for(let r of t){if(!n||typeof n!=="object")return;n=n[r]}return n}clearBindings(){this.bindings.forEach((e)=>{O(e.effect)}),this.bindings=[]}getBindingCount(){return this.bindings.length}hasExpressions(e){return this.templateRegex.lastIndex=0,this.templateRegex.test(e)}extractKeys(e){let t=[],n,r=new RegExp(this.templateRegex,"g");while((n=r.exec(e))!==null){let o=n[1]?.trim();if(o)t.push(o)}return t}evaluateTemplateValue(e){this.templateRegex.lastIndex=0;let t=Array.from(e.matchAll(this.templateRegex));if(!t||t.length===0)return e;let n=new Set;return this.evaluateTemplate(e,t,n)}}class K{props;vnode=null;el=null;renderer=new ae;templateEngine;childComponents=new Set;eventListeners={};providers=new Map;updateEffect;appContext=null;parentComponent=null;elementChangeListener=null;styleManager;state;mounted=!1;constructor(e={}){this.props=e;this.styleManager=new Pe,this.state=We(this.initState()??{}),this.templateEngine=new G(this.state),this.initStyles(),this.updateEffect=N(()=>{if(this.mounted)try{this.update()}catch(t){if(!this.dispatchError(t))throw t}},{throwOnError:!0,scheduler:(t)=>{xe.enqueue(t)}})}mount(e){if(!e||!(e instanceof HTMLElement))throw Error("Invalid container element");try{e.appendChild(this.mountToNode())}catch(t){throw console.error("组件渲染错误:",t),t}}mountToNode(){if(this.mounted&&this.el)return this.el;return this.beforeMount(),this.el=L.getInstance().runWithEffect(this.updateEffect,()=>{try{return this.vnode=this.render(),this.renderer.mount(this.vnode,this.createRenderContext())}catch(e){if(this.dispatchError(e))return document.createComment("error-boundary");throw e}}),this.mounted=!0,this.onMounted(),this.el}update(){if(!this.el||!this.vnode)return;this.beforeUpdate();let e=this.vnode,t=this.el;if(this.el=L.getInstance().runWithEffect(this.updateEffect,()=>{let n=this.render(),r=this.renderer.patch(e,n,t,this.createRenderContext());return this.vnode=n,r}),t!==this.el)this.elementChangeListener?.(t,this.el);this.onUpdated(),this.onPropsChange()}unmount(){if(!this.mounted)return;if(this.beforeUnmount(),this.vnode&&this.el)this.renderer.unmount(this.vnode,this.el,this.createRenderContext());if(this.childComponents.clear(),Object.keys(this.eventListeners).forEach((e)=>{this.eventListeners[e].clear(),delete this.eventListeners[e]}),this.providers.clear(),this.parentComponent=null,this.elementChangeListener=null,this.templateEngine.clearBindings(),this.styleManager.destroy(),O(this.updateEffect),this.el?.parentNode)this.el.parentNode.removeChild(this.el);this.el=null,this.vnode=null,this.mounted=!1,this.onUnmounted()}setProps(e){if(this.props={...this.props,...e},this.mounted)xe.enqueue(this.updateEffect)}setState(e){Object.assign(this.state,e)}setAppContext(e){this.appContext=e,this.childComponents.forEach((t)=>{t.setAppContext?.(e)})}setParentComponent(e){this.parentComponent=e}getParentComponent(){return this.parentComponent}setElementChangeListener(e){this.elementChangeListener=e}provide(e,t){this.providers.set(e,t)}inject(e,t){let n=this.resolveInjection(e);return n.found?n.value:t}resolveInjection(e){if(this.providers.has(e))return{found:!0,value:this.providers.get(e)};if(this.parentComponent?.resolveInjection)return this.parentComponent.resolveInjection(e);return this.resolveAppInjection(e)}getElement(){return this.el}beforeMount(){}onMounted(){}beforeUpdate(){}onUpdated(){}onPropsChange(){}beforeUnmount(){}onUnmounted(){}dispatchError(e){let t=this.getParentComponent();while(t){let n=t;if(typeof n.onErrorCaptured==="function"){if(n.onErrorCaptured(e,this)===!1)return!0}t=t.getParentComponent?.()??null}return!1}getContext(){return this.appContext}get router(){return this.getRouterFrom(this.appContext)??this.getRouterFromGlobalApp()}emit(e,...t){this.eventListeners[e]?.forEach((n)=>{n(...t)})}on(e,t){if(!this.eventListeners[e])this.eventListeners[e]=new Set;return this.eventListeners[e].add(t),()=>this.off(e,t)}off(e,t){this.eventListeners[e]?.delete(t)}createRenderContext(){return{appContext:this.appContext,templateEngine:this.templateEngine,renderer:this.renderer,slots:this.collectSlots(),registerChild:(e)=>{this.childComponents.add(e),e.setParentComponent?.(this),e.setAppContext?.(this.appContext)},unregisterChild:(e)=>{this.childComponents.delete(e),e.setParentComponent?.(null)}}}collectSlots(){let e={default:[]};return M(this.props.children).forEach((n)=>{let r=this.getSlotName(n);if(!e[r])e[r]=[];e[r].push(this.normalizeSlotChild(n))}),e}getSlotName(e){if(typeof e==="string")return"default";return"slot"in e&&typeof e.slot==="string"?e.slot:"default"}normalizeSlotChild(e){if(typeof e==="string"||!("slot"in e))return e;let t={...e};return delete t.slot,t}getRouterFrom(e){if(!e||typeof e!=="object"||!("router"in e))return;return e.router}getRouterFromGlobalApp(){let e=globalThis.__APP__;return this.getRouterFrom(e)}resolveAppInjection(e){if(!this.appContext||typeof this.appContext!=="object")return{found:!1,value:void 0};return this.appContext.app?.resolveInjection?.(e)??{found:!1,value:void 0}}}var Nt=null;function Qe(){return Nt}var Je="http://www.w3.org/2000/svg",Ot=new Set(["svg","g","defs","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","textPath","use","symbol","marker","linearGradient","radialGradient","stop","pattern","mask","clipPath","foreignObject"]);class ue{listeners=new WeakMap;effects=new WeakMap;modelBindings=new Se;matches(e){return typeof e==="object"&&e!==null&&je(e)}mount(e,t){if(e.directions?.if===!1)return document.createComment("if");let n=e.tag==="navigator",r=n?document.createElement("a"):Ot.has(e.tag)?document.createElementNS(Je,e.tag):document.createElement(e.tag),o=e.props??{};if(n){let{url:i,openType:s,...a}=o,l=typeof i==="string"?i:"#";r.setAttribute("href",l),r.addEventListener("click",(c)=>{let p=Qe();if(p)c.preventDefault(),p.push(r.getAttribute("href")??"#")}),this.applyProps(r,{},a,t)}else this.applyProps(r,{},o,t);return this.updateListeners(r,{},this.collectListeners(e)),this.mountChildren(r,e,t),this.applyDirections(r,void 0,e.directions,t),r}patch(e,t,n,r){if(e.tag!==t.tag||n.nodeType===Node.COMMENT_NODE){let i=this.mount(t,r);return n.parentNode?.replaceChild(i,n),this.unmount(e,n,r),i}if(!(n instanceof Element))return n;if(t.directions?.if===!1){let i=document.createComment("if");return n.parentNode?.replaceChild(i,n),this.unmount(e,n,r),i}if(t.tag==="navigator"||e.tag==="navigator"){let i=e.props??{},s=t.props??{},a=typeof i.url==="string"?i.url:"",l=typeof s.url==="string"?s.url:"";if(a!==l)n.setAttribute("href",l);let c={...s};delete c.url,delete c.openType,this.applyProps(n,i,c,r)}else this.applyProps(n,e.props??{},t.props??{},r);return this.updateListeners(n,this.collectListeners(e),this.collectListeners(t)),this.updateChildren(n,e,t,r),this.applyDirections(n,e.directions,t.directions,r),n}unmount(e,t,n){if(!(t instanceof Element))return;this.effects.get(t)?.forEach((r)=>O(r)),this.effects.delete(t),this.listeners.get(t)?.forEach(({eventName:r,listener:o})=>{t.removeEventListener(r,o)}),this.listeners.delete(t),this.modelBindings.cleanup(t),this.unmountChildren(t,e,n)}mountChildren(e,t,n){M(t.children).forEach((r)=>{e.appendChild(n.renderer.mount(r,n))})}updateChildren(e,t,n,r){this.updateOrdinaryChildren(e,M(t.children),M(n.children),r)}unmountChildren(e,t,n){M(t.children).forEach((r,o)=>{let i=e.childNodes[o];if(i)n.renderer.unmount(r,i,n)})}applyProps(e,t,n,r){Object.keys(t).forEach((o)=>{if(se(o)||o in n)return;if(o==="className"||o==="class")e.removeAttribute("class");else if(o==="style")e.removeAttribute("style");else if(o==="value"&&typeof e==="object"&&e!==null&&"value"in e)e.value="";else e.removeAttribute(le(o))}),Object.entries(n).forEach(([o,i])=>{if(se(o))return;if(t[o]===i)return;if(o==="className"||o==="class"){if(e.namespaceURI===Je)e.setAttribute("class",String(i??""));else e.className=String(i??"");return}if(o==="value"&&typeof e==="object"&&e!==null&&"value"in e){e.value=String(i??"");return}if(o==="style"&&typeof i==="object"&&i!==null){e.removeAttribute("style");let s=e.style;Object.entries(i).forEach(([a,l])=>{Ye(s,a,l)});return}if(i===!1||i===void 0||i===null){e.removeAttribute(le(o));return}if(i===!0){e.setAttribute(le(o),"");return}if(typeof i==="string"&&r.templateEngine.hasExpressions(i)){this.setupReactiveAttribute(e,o,i,r);return}e.setAttribute(le(o),String(i))})}applyDirections(e,t,n,r){if(n&&"show"in n)e.style.display=n.show?"":"none";else if(t&&"show"in t)e.style.display="";if(!n?.model){this.modelBindings.cleanup(e);return}this.modelBindings.bind(e,n.model,r.templateEngine.state)}updateOrdinaryChildren(e,t,n,r){if(this.assertNoDuplicateKeys(t),this.assertNoDuplicateKeys(n),this.hasOnlyKeyedChildren(t,n)){this.updateKeyedChildren(e,t,n,r);return}let o=Math.min(t.length,n.length);for(let i=0;i<o;i+=1){let s=e.childNodes[i];if(!s){e.appendChild(r.renderer.mount(n[i],r));continue}r.renderer.patch(t[i],n[i],s,r)}for(let i=o;i<n.length;i+=1)e.appendChild(r.renderer.mount(n[i],r));for(let i=t.length-1;i>=n.length;i-=1){let s=e.childNodes[i];if(s){if(r.renderer.unmount(t[i],s,r),s.parentNode===e)e.removeChild(s)}}}updateKeyedChildren(e,t,n,r){let o=t.map((a,l)=>({vnode:a,node:e.childNodes[l],index:l})),i=new Map,s=new Set;o.forEach((a)=>{let l=this.getVNodeKey(a.vnode);if(l!==void 0&&a.node)i.set(l,{vnode:a.vnode,node:a.node,index:a.index})}),n.forEach((a,l)=>{let c=this.getVNodeKey(a),p=c===void 0?void 0:i.get(c),u;if(p)u=r.renderer.patch(p.vnode,a,p.node,r),s.add(p.index);else u=r.renderer.mount(a,r);let d=e.childNodes[l]??null;if(u!==d)e.insertBefore(u,d)}),o.forEach((a)=>{if(!a.node||s.has(a.index))return;if(r.renderer.unmount(a.vnode,a.node,r),a.node.parentNode===e)e.removeChild(a.node)})}hasOnlyKeyedChildren(e,t){return[...e,...t].every((n)=>this.getVNodeKey(n)!==void 0)}assertNoDuplicateKeys(e){let t=new Set;e.forEach((n)=>{let r=this.getVNodeKey(n);if(r===void 0)return;if(t.has(r))throw Error(`Duplicate key "${r}"`);t.add(r)})}getVNodeKey(e){if(typeof e==="string")return;return e.key}collectListeners(e){let t={};return Object.entries(e.props??{}).forEach(([n,r])=>{if(se(n)&&typeof r==="function")t[Ge(n)]=r}),{...t,...e.listeners??{}}}updateListeners(e,t,n){let r=this.listeners.get(e)??new Map,o=new Set(Object.keys(t)),i=new Set(Object.keys(n));o.forEach((s)=>{if(!i.has(s)||t[s]!==n[s]){let a=r.get(s);if(a)e.removeEventListener(a.eventName,a.listener),r.delete(s)}}),i.forEach((s)=>{if(!o.has(s)||t[s]!==n[s]){let{eventName:a,modifiers:l}=Ke(s),c=typeof e.tagName==="string"&&e.tagName.toLowerCase()==="textarea",p=a==="confirm"&&!c?"keydown":a,u=Xe((d)=>{if(p==="keydown"){if(d.key!=="Enter")return}n[s](d)},l);e.addEventListener(p,u),r.set(s,{eventName:p,listener:u})}}),this.listeners.set(e,r)}setupReactiveAttribute(e,t,n,r){let o=N(()=>{e.setAttribute(t,r.templateEngine.evaluateTemplateValue(n))});this.trackEffect(e,o)}trackEffect(e,t){let n=this.effects.get(e)??new Set;n.add(t),this.effects.set(e,n)}}function le(e){if(e.startsWith("data")&&e.length>4)return`data${e.slice(4).replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}`;if(e==="tabIndex"||e==="colSpan"||e==="htmlFor")return e.toLowerCase();return e}class ae{strategies;constructor(){this.strategies=[new Ze,new et,new tt,new ue]}mount(e,t){return this.findStrategy(e).mount(e,t)}patch(e,t,n,r){let o=this.findStrategy(e),i=this.findStrategy(t);if(o!==i){let s=i.mount(t,r);return n.parentNode?.replaceChild(s,n),o.unmount(e,n,r),s}return o.patch(e,t,n,r)}unmount(e,t,n){this.findStrategy(e).unmount(e,t,n)}findStrategy(e){let t=this.strategies.find((n)=>n.matches(e));if(!t)throw Error("No render strategy found for vnode");return t}}class Ze{matches(e){return typeof e==="string"}mount(e,t){return t.templateEngine.parseTemplate(e)}patch(e,t,n,r){if(e===t)return n;let o=this.mount(t,r);return n.parentNode?.replaceChild(o,n),o}unmount(){}}class et{instances=new WeakMap;instanceNodes=new Map;emitterUnsubscribers=new WeakMap;matches(e){return typeof e==="object"&&e!==null&&Be(e)}mount(e,t){if(e.directions?.if===!1)return document.createComment("if");let r=new e.component(this.createProps(e));if(t.appContext&&r.setAppContext)r.setAppContext(t.appContext);this.syncEmitters(r,e.emitters??{}),t.registerChild(r);let o=r.mountToNode();return this.trackInstanceNode(r,o),r.setElementChangeListener?.((i,s)=>{this.trackInstanceNode(r,i),this.trackInstanceNode(r,s)}),o}patch(e,t,n,r){if(n.nodeType===Node.COMMENT_NODE){let s=this.mount(t,r);return n.parentNode?.replaceChild(s,n),s}if(t.directions?.if===!1){let s=document.createComment("if");return n.parentNode?.replaceChild(s,n),this.unmount(e,n,r),s}let o=this.instances.get(n);if(o&&e.component===t.component){this.syncEmitters(o,t.emitters??{}),o.setProps(this.createProps(t));let s=o.getElement()??n;return this.trackInstanceNode(o,s),s}let i=this.mount(t,r);return n.parentNode?.replaceChild(i,n),this.unmount(e,n,r),i}unmount(e,t,n){let r=this.instances.get(t);if(r)this.clearEmitters(r),r.unmount(),this.clearInstanceNodes(r),n.unregisterChild(r)}createProps(e){return{...e.props??{},children:M(e.children)}}syncEmitters(e,t){let n=this.emitterUnsubscribers.get(e)??new Map;n.forEach(({listener:r,unsubscribe:o},i)=>{let s=t[i];if(!s||s!==r)o(),n.delete(i)}),Object.entries(t).forEach(([r,o])=>{if(n.get(r)?.listener===o)return;n.set(r,{listener:o,unsubscribe:e.on(r,o)})}),this.emitterUnsubscribers.set(e,n)}clearEmitters(e){this.emitterUnsubscribers.get(e)?.forEach(({unsubscribe:t})=>{t()}),this.emitterUnsubscribers.delete(e)}trackInstanceNode(e,t){this.instances.set(t,e);let n=this.instanceNodes.get(e)??new Set;n.add(t),this.instanceNodes.set(e,n)}clearInstanceNodes(e){this.instanceNodes.get(e)?.forEach((t)=>{this.instances.delete(t)}),this.instanceNodes.delete(e)}}class tt{renderedChildren=new WeakMap;matches(e){return typeof e==="object"&&e!==null&&_e(e)}mount(e,t){if(e.directions?.if===!1)return document.createComment("if");let n=document.createElement("div");return n.setAttribute("data-slot",e.props.name),this.mountSlotChildren(n,this.resolveChildren(e,t),t),n}patch(e,t,n,r){if(n.nodeType===Node.COMMENT_NODE){let o=this.mount(t,r);return n.parentNode?.replaceChild(o,n),o}if(t.directions?.if===!1){let o=document.createComment("if");return n.parentNode?.replaceChild(o,n),this.unmount(e,n,r),o}if(n instanceof HTMLElement)n.setAttribute("data-slot",t.props.name),this.replaceSlotChildren(n,e,t,r);return n}unmount(e,t,n){if(!(t instanceof HTMLElement))return;this.unmountSlotChildren(t,n),this.renderedChildren.delete(t)}resolveChildren(e,t){return t.slots[e.props.name]??M(e.children)}replaceSlotChildren(e,t,n,r){let o=this.renderedChildren.get(e)??[],i=this.resolveChildren(n,r),s=Math.min(o.length,i.length);for(let a=0;a<s;a+=1){let l=e.childNodes[a];if(!l){e.appendChild(r.renderer.mount(i[a],r));continue}r.renderer.patch(o[a],i[a],l,r)}for(let a=s;a<i.length;a+=1)e.appendChild(r.renderer.mount(i[a],r));for(let a=o.length-1;a>=i.length;a-=1){let l=e.childNodes[a];if(l){if(r.renderer.unmount(o[a],l,r),l.parentNode===e)e.removeChild(l)}}this.renderedChildren.set(e,i)}mountSlotChildren(e,t,n){t.forEach((r)=>{e.appendChild(n.renderer.mount(r,n))}),this.renderedChildren.set(e,t)}unmountSlotChildren(e,t){(this.renderedChildren.get(e)??[]).forEach((r,o)=>{let i=e.childNodes[o];if(i)t.renderer.unmount(r,i,t)})}}class x extends Error{code;config;response;cause;constructor(e){super(e.message);this.name="RequestError",this.code=e.code,this.config=e.config,this.response=e.response,this.cause=e.cause}}var Ht=new Set(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"]);function pe(e){if(e===void 0)return"GET";let t=e.toUpperCase();if(!Ht.has(t))throw Error(`Unsupported HTTP method: ${e}`);return t}var qt=/^[a-z][a-z\d+.-]*:\/\//i;function Bt(e){return qt.test(e)}function jt(e,t){if(!e||Bt(t))return t;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function nt(e){if(e instanceof Date)return e.toISOString();if(typeof e==="object")return JSON.stringify(e);return String(e)}function _t(e){if(!e)return"";let t=[];return Object.keys(e).forEach((n)=>{let r=e[n];if(r===void 0||r===null)return;let o=encodeURIComponent(n);if(Array.isArray(r)){r.forEach((i)=>{if(i===void 0||i===null)return;t.push(`${o}=${encodeURIComponent(nt(i))}`)});return}t.push(`${o}=${encodeURIComponent(nt(r))}`)}),t.join("&")}function ce(e,t,n){let r=jt(e,t),o=_t(n);if(!o)return r;let i=r.includes("?")?"&":"?";return`${r}${i}${o}`}function Ft(e){if(e===void 0||e===null)return;return String(e)}function _(...e){let t={},n=new Map;return e.forEach((r)=>{if(!r)return;Object.keys(r).forEach((o)=>{let i=Ft(r[o]);if(i===void 0)return;let s=o.toLowerCase(),a=n.get(s);if(a!==void 0&&a!==o)delete t[a];n.set(s,o),t[o]=i})}),t}function Vt(e,t){return Object.keys(e).some((n)=>n.toLowerCase()===t.toLowerCase())}function rt(e,t,n){if(n==="GET"||n==="HEAD")return;if(e===void 0||e===null)return;if(typeof e==="string")return e;if(typeof FormData<"u"&&e instanceof FormData)return e;if(typeof Blob<"u"&&e instanceof Blob)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Vt(t,"Content-Type"))t["Content-Type"]="application/json";return JSON.stringify(e)}class Le{platform="web";async request(e){let t=pe(e.method),n=ce(e.baseURL,e.url,e.params),r=_(e.headers),o=rt(e.data,r,t),i=new AbortController,s=!1,a=!1,l;if(e.signal)if(e.signal.aborted)a=!0,i.abort();else e.signal.addEventListener("abort",()=>{a=!0,i.abort()},{once:!0});if(typeof e.timeout==="number"&&e.timeout>0)l=setTimeout(()=>{s=!0,i.abort()},e.timeout);let c=e.credentials??(e.withCredentials===!0?"include":"same-origin");try{let p=await fetch(n,{method:t,headers:r,body:o,signal:i.signal,credentials:c}),u={};return p.headers.forEach((h,m)=>{u[m]=h}),{data:await Wt(p,e),statusCode:p.status,statusText:p.statusText,headers:u,config:e}}catch(p){if(s)throw new x({code:"TIMEOUT",message:`Request timeout after ${String(e.timeout)}ms`,config:e,cause:p});if(a||i.signal.aborted)throw new x({code:"ABORTED",message:"Request aborted",config:e,cause:p});throw new x({code:"NETWORK_ERROR",message:p instanceof Error?p.message:String(p),config:e,cause:p})}finally{if(l!==void 0)clearTimeout(l)}}}async function Wt(e,t){if(t.responseType==="arraybuffer")return e.arrayBuffer();let n=await e.text();if(t.dataType==="text"||!n)return n;try{return JSON.parse(n)}catch{return n}}function $t(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global;return{}}function Me(e){let t=$t()[e];return typeof t==="object"&&t!==null?t:null}function de(){if(Ae("wx"))return"weixin";if(Ae("my"))return"alipay";if(Ae("tt"))return"bytedance";if(typeof fetch==="function")return"web";return"unknown"}function Ae(e){let t=Me(e);return t!==null&&typeof t.request==="function"}var ot={platform:"weixin",globalName:"wx",headerField:"header",statusField:"statusCode",responseHeaderField:"header"},it={platform:"alipay",globalName:"my",headerField:"headers",statusField:"status",responseHeaderField:"headers"},st={platform:"bytedance",globalName:"tt",headerField:"header",statusField:"statusCode",responseHeaderField:"header"};class X{dialect;platform;constructor(e){this.dialect=e;this.platform=e.platform}request(e){let t=Me(this.dialect.globalName);if(!t||typeof t.request!=="function")return Promise.reject(new x({code:"UNSUPPORTED_PLATFORM",message:`${this.dialect.globalName}.request is not available in current environment`,config:e}));let n=t.request;return new Promise((r,o)=>{let i=!1,s=!1,a,l,c=(u)=>{if(s)return;if(s=!0,l!==void 0)clearTimeout(l);u()},p={url:ce(e.baseURL,e.url,e.params),method:e.method??"GET",data:e.data,[this.dialect.headerField]:zt(e.headers),dataType:e.dataType??"json",...e.responseType!==void 0?{responseType:e.responseType}:{},...e.timeout!==void 0&&e.timeout>0?{timeout:e.timeout}:{},success:(u)=>{c(()=>{let d=u[this.dialect.statusField],h=Number(d??u.statusCode??0),m=Ut(u[this.dialect.responseHeaderField]);r({data:u.data,statusCode:h,headers:m,config:e,...Array.isArray(u.cookies)?{cookies:u.cookies}:{},...typeof u.errMsg==="string"?{errMsg:u.errMsg}:{}})})},fail:(u)=>{c(()=>{let d=Gt(u);o(new x({code:i?"TIMEOUT":Kt(d),message:d||"Network request failed",config:e,cause:u}))})}};if(e.timeout!==void 0&&e.timeout>0)l=setTimeout(()=>{i=!0,a?.abort?.()},e.timeout);if(a=n(p)??void 0,e.signal)if(e.signal.aborted)a?.abort?.();else e.signal.addEventListener("abort",()=>{a?.abort?.()},{once:!0})})}}function zt(e){return _(e)}function Ut(e){if(typeof e!=="object"||e===null)return{};let t={};return Object.keys(e).forEach((n)=>{let r=e[n];if(r!==void 0&&r!==null)t[n]=String(r)}),t}function Gt(e){if(typeof e.errMsg==="string")return e.errMsg;if(typeof e.errorMessage==="string")return e.errorMessage;if(typeof e.error==="string")return e.error;return""}function Kt(e){if(!e)return"UNKNOWN";if(/timeout/i.test(e))return"TIMEOUT";if(/abort/i.test(e))return"ABORTED";return"NETWORK_ERROR"}var at={web:new Le,weixin:new X(ot),alipay:new X(it),bytedance:new X(st)};function he(e){let t=at[e];if(!t)throw new x({code:"UNSUPPORTED_PLATFORM",message:`Unsupported request platform: ${String(e)}`,config:{url:""}});return t}async function Ie(e,t,n){if(e.platform!==void 0&&e.platform!=="auto")return he(e.platform);if(t!==void 0)return typeof t==="function"?await t(e):t;if(n!==void 0&&n!=="auto")return he(n);let r=de();if(r==="unknown")throw new x({code:"UNSUPPORTED_PLATFORM",message:"No supported request platform detected (web fetch / wx.request / my.request / tt.request)",config:e});return he(r)}class Y{handlers=[];use(e,t){return this.handlers.push({onFulfilled:e,onRejected:t}),this.handlers.length-1}eject(e){if(this.handlers[e]!==void 0)this.handlers[e]=null}clear(){this.handlers.length=0}forEach(e){this.handlers.forEach((t,n)=>{if(t!==null)e(t,n)})}}class me{interceptors={request:new Y,response:new Y};instanceDefaults;instanceAdapter;instancePlatform;constructor(e={}){let{adapter:t,platform:n,...r}=e;this.instanceAdapter=t,this.instancePlatform=n,this.instanceDefaults={...r}}request(e){let t;try{t=this.mergeConfig(e)}catch(i){return Promise.reject(i)}let n=[];this.interceptors.request.forEach((i)=>{n.push(i.onFulfilled,i.onRejected)}),n.push((i)=>this.dispatch(i),void 0);let r=[];this.interceptors.response.forEach((i)=>{r.push({onFulfilled:i.onFulfilled,onRejected:i.onRejected})});for(let i=r.length-1;i>=0;i-=1){let s=r[i];n.push(s.onFulfilled,s.onRejected)}let o=Promise.resolve(t);while(n.length>0){let i=n.shift(),s=n.shift();o=o.then(i,s)}return o}get(e,t){return this.request({...t,url:e,method:"GET"})}delete(e,t){return this.request({...t,url:e,method:"DELETE"})}head(e,t){return this.request({...t,url:e,method:"HEAD"})}options(e,t){return this.request({...t,url:e,method:"OPTIONS"})}post(e,t,n){return this.request({...n,url:e,method:"POST",data:t})}put(e,t,n){return this.request({...n,url:e,method:"PUT",data:t})}patch(e,t,n){return this.request({...n,url:e,method:"PATCH",data:t})}dispatch(e){return Ie(e,this.instanceAdapter,this.instancePlatform).then((t)=>t.request(e))}mergeConfig(e){if(!e||typeof e!=="object")throw new x({code:"BAD_REQUEST",message:"Request config must be an object",config:e});let t={...this.instanceDefaults,...e,headers:_(this.instanceDefaults.headers,e.headers),params:{...this.instanceDefaults.params,...e.params}};if(typeof t.url!=="string"||t.url.length===0)throw new x({code:"BAD_REQUEST",message:"Request url is required",config:t});try{t.method=pe(t.method)}catch(n){throw new x({code:"BAD_REQUEST",message:n.message,config:t,cause:n})}return t}}var Fi=new me;var Xt="tc-chart-canvas";class lt extends K{chart=null;destroyed=!1;initState(){return{canvasId:Xt}}initStyles(){this.styleManager.addStyle("tc-chart-canvas",{selector:".tc-chart__canvas",properties:{display:"block",height:"100%",width:"100%"}})}render(){return Fe("canvas",{id:this.state.canvasId,className:`tc-chart__canvas${this.props.className?` ${this.props.className}`:""}`,type:"2d"})}onMounted(){this.attachChart()}onUpdated(){if(this.chart&&!this.destroyed)this.chart.setOption(this.props.option).render();else if(!this.chart&&!this.destroyed)this.attachChart()}onUnmounted(){this.destroyed=!0,this.chart?.destroy(),this.chart=null}getChart(){return this.chart}attachChart(){if(this.destroyed)return;this.resolveContext().then((e)=>{if(this.destroyed)return;this.chart=U(e,this.props.option),this.chart.render()}).catch((e)=>{console.error("[TcChart] attach failed:",e)})}getElement(){return super.getElement()}resolveContext(){if(this.props.resolve)return Promise.resolve(this.props.resolve(this.getElement()));let e=oe();if(e){let t=`#${this.state.canvasId}`,n=(r)=>re({platform:e,instance:this,selector:t}).then((o)=>B(o)).catch((o)=>{if(r<=0)throw o;return new Promise((i)=>setTimeout(i,50)).then(()=>n(r-1))});return n(5)}return Promise.resolve(j(this.getElement()))}}export{ee as BarChart,J as CategoryScale,A as ChartBase,Ne as DEFAULT_AXIS_COLOR,Q as DEFAULT_FONT_FAMILY,ge as DEFAULT_GRID_COLOR,ke as DEFAULT_PALETTE,V as DEFAULT_TEXT_COLOR,Z as LineChart,W as LinearScale,te as PieChart,ne as RadarChart,lt as TcChart,ye as computeLayout,U as createChart,Rt as createMiniProgramChart,Ct as createWebChart,Ce as detectMiniProgramPixelRatio,q as detectPixelRatio,re as getMiniProgramCanvasNode,D as getMiniProgramGlobal,ut as isCanvas2DLike,Oe as niceTicks,B as resolveMiniProgramCanvas,qe as resolveNativeCanvas,j as resolveWebCanvas};
|
|
14
|
+
`})}),e.textContent=t}}class J{state;bindings=[];templateRegex=/{{(.*?)}}/g;constructor(e){this.state=e;if(!e||typeof e!=="object")throw Error("TemplateEngine requires a valid state object")}parseTemplate(e){if(typeof e!=="string")e=String(e);let t=document.createTextNode("");this.templateRegex.lastIndex=0;let n=Array.from(e.matchAll(this.templateRegex));if(n&&n.length>0)this.setupReactiveBindings(t,e,n);else t.textContent=e;return t}setupReactiveBindings(e,t,n){let r=new Set,o=this.evaluateTemplate(t,n,r);e.textContent=o;let i=B(()=>{try{let s=this.evaluateTemplate(t,n,r);if(e.textContent!==s)e.textContent=s}catch(s){console.error("Template update error:",s),e.textContent=`Error: ${s instanceof Error?s.message:"Unknown error"}`}});this.bindings.push({node:e,originalText:t,effect:i})}evaluateTemplate(e,t,n){let r=e;return t.forEach((o)=>{let i=o[1]?.trim();if(i){n.add(i);let s=this.getValueFromState(i),a=s===void 0||s===null?"":String(s);r=r.replace(o[0],a)}}),r}getValueFromState(e){if(!e)return;let t=e.split("."),n=this.state;for(let r of t){if(!n||typeof n!=="object")return;n=n[r]}return n}clearBindings(){this.bindings.forEach((e)=>{q(e.effect)}),this.bindings=[]}getBindingCount(){return this.bindings.length}hasExpressions(e){return this.templateRegex.lastIndex=0,this.templateRegex.test(e)}extractKeys(e){let t=[],n,r=new RegExp(this.templateRegex,"g");while((n=r.exec(e))!==null){let o=n[1]?.trim();if(o)t.push(o)}return t}evaluateTemplateValue(e){this.templateRegex.lastIndex=0;let t=Array.from(e.matchAll(this.templateRegex));if(!t||t.length===0)return e;let n=new Set;return this.evaluateTemplate(e,t,n)}}class Z{props;vnode=null;el=null;renderer=new de;templateEngine;childComponents=new Set;eventListeners={};providers=new Map;updateEffect;appContext=null;parentComponent=null;elementChangeListener=null;styleManager;state;mounted=!1;constructor(e={}){this.props=e;this.styleManager=new ke,this.state=Qe(this.initState()??{}),this.templateEngine=new J(this.state),this.initStyles(),this.updateEffect=B(()=>{if(this.mounted)try{this.update()}catch(t){if(!this.dispatchError(t))throw t}},{throwOnError:!0,scheduler:(t)=>{Le.enqueue(t)}})}mount(e){if(!e||!(e instanceof HTMLElement))throw Error("Invalid container element");try{e.appendChild(this.mountToNode())}catch(t){throw console.error("组件渲染错误:",t),t}}mountToNode(){if(this.mounted&&this.el)return this.el;return this.beforeMount(),this.el=A.getInstance().runWithEffect(this.updateEffect,()=>{try{return this.vnode=this.render(),this.renderer.mount(this.vnode,this.createRenderContext())}catch(e){if(this.dispatchError(e))return document.createComment("error-boundary");throw e}}),this.mounted=!0,this.onMounted(),this.el}update(){if(!this.el||!this.vnode)return;this.beforeUpdate();let e=this.vnode,t=this.el;if(this.el=A.getInstance().runWithEffect(this.updateEffect,()=>{let n=this.render(),r=this.renderer.patch(e,n,t,this.createRenderContext());return this.vnode=n,r}),t!==this.el)this.elementChangeListener?.(t,this.el);this.onUpdated(),this.onPropsChange()}unmount(){if(!this.mounted)return;if(this.beforeUnmount(),this.vnode&&this.el)this.renderer.unmount(this.vnode,this.el,this.createRenderContext());if(this.childComponents.clear(),Object.keys(this.eventListeners).forEach((e)=>{this.eventListeners[e].clear(),delete this.eventListeners[e]}),this.providers.clear(),this.parentComponent=null,this.elementChangeListener=null,this.templateEngine.clearBindings(),this.styleManager.destroy(),q(this.updateEffect),this.el?.parentNode)this.el.parentNode.removeChild(this.el);this.el=null,this.vnode=null,this.mounted=!1,this.onUnmounted()}setProps(e){if(this.props={...this.props,...e},this.mounted)Le.enqueue(this.updateEffect)}setState(e){Object.assign(this.state,e)}setAppContext(e){this.appContext=e,this.childComponents.forEach((t)=>{t.setAppContext?.(e)})}setParentComponent(e){this.parentComponent=e}getParentComponent(){return this.parentComponent}setElementChangeListener(e){this.elementChangeListener=e}provide(e,t){this.providers.set(e,t)}inject(e,t){let n=this.resolveInjection(e);return n.found?n.value:t}resolveInjection(e){if(this.providers.has(e))return{found:!0,value:this.providers.get(e)};if(this.parentComponent?.resolveInjection)return this.parentComponent.resolveInjection(e);return this.resolveAppInjection(e)}getElement(){return this.el}beforeMount(){}onMounted(){}beforeUpdate(){}onUpdated(){}onPropsChange(){}beforeUnmount(){}onUnmounted(){}dispatchError(e){let t=this.getParentComponent();while(t){let n=t;if(typeof n.onErrorCaptured==="function"){if(n.onErrorCaptured(e,this)===!1)return!0}t=t.getParentComponent?.()??null}return!1}getContext(){return this.appContext}get router(){return this.getRouterFrom(this.appContext)??this.getRouterFromGlobalApp()}emit(e,...t){this.eventListeners[e]?.forEach((n)=>{n(...t)})}on(e,t){if(!this.eventListeners[e])this.eventListeners[e]=new Set;return this.eventListeners[e].add(t),()=>this.off(e,t)}off(e,t){this.eventListeners[e]?.delete(t)}createRenderContext(){return{appContext:this.appContext,templateEngine:this.templateEngine,renderer:this.renderer,slots:this.collectSlots(),registerChild:(e)=>{this.childComponents.add(e),e.setParentComponent?.(this),e.setAppContext?.(this.appContext)},unregisterChild:(e)=>{this.childComponents.delete(e),e.setParentComponent?.(null)}}}collectSlots(){let e={default:[]};return O(this.props.children).forEach((n)=>{let r=this.getSlotName(n);if(!e[r])e[r]=[];e[r].push(this.normalizeSlotChild(n))}),e}getSlotName(e){if(typeof e==="string")return"default";return"slot"in e&&typeof e.slot==="string"?e.slot:"default"}normalizeSlotChild(e){if(typeof e==="string"||!("slot"in e))return e;let t={...e};return delete t.slot,t}getRouterFrom(e){if(!e||typeof e!=="object"||!("router"in e))return;return e.router}getRouterFromGlobalApp(){let e=globalThis.__APP__;return this.getRouterFrom(e)}resolveAppInjection(e){if(!this.appContext||typeof this.appContext!=="object")return{found:!1,value:void 0};return this.appContext.app?.resolveInjection?.(e)??{found:!1,value:void 0}}}var zt=null;function it(){return zt}var st="http://www.w3.org/2000/svg",_t=new Set(["svg","g","defs","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","textPath","use","symbol","marker","linearGradient","radialGradient","stop","pattern","mask","clipPath","foreignObject"]);class me{listeners=new WeakMap;effects=new WeakMap;modelBindings=new Oe;matches(e){return typeof e==="object"&&e!==null&&Ge(e)}mount(e,t){if(e.directions?.if===!1)return document.createComment("if");let n=e.tag==="navigator",r=n?document.createElement("a"):_t.has(e.tag)?document.createElementNS(st,e.tag):document.createElement(e.tag),o=e.props??{};if(n){let{url:i,openType:s,...a}=o,l=typeof i==="string"?i:"#";r.setAttribute("href",l),r.addEventListener("click",(c)=>{let p=it();if(p)c.preventDefault(),p.push(r.getAttribute("href")??"#")}),this.applyProps(r,{},a,t)}else this.applyProps(r,{},o,t);return this.updateListeners(r,{},this.collectListeners(e)),this.mountChildren(r,e,t),this.applyDirections(r,void 0,e.directions,t),r}patch(e,t,n,r){if(e.tag!==t.tag||n.nodeType===Node.COMMENT_NODE){let i=this.mount(t,r);return n.parentNode?.replaceChild(i,n),this.unmount(e,n,r),i}if(!(n instanceof Element))return n;if(t.directions?.if===!1){let i=document.createComment("if");return n.parentNode?.replaceChild(i,n),this.unmount(e,n,r),i}if(t.tag==="navigator"||e.tag==="navigator"){let i=e.props??{},s=t.props??{},a=typeof i.url==="string"?i.url:"",l=typeof s.url==="string"?s.url:"";if(a!==l)n.setAttribute("href",l);let c={...s};delete c.url,delete c.openType,this.applyProps(n,i,c,r)}else this.applyProps(n,e.props??{},t.props??{},r);return this.updateListeners(n,this.collectListeners(e),this.collectListeners(t)),this.updateChildren(n,e,t,r),this.applyDirections(n,e.directions,t.directions,r),n}unmount(e,t,n){if(!(t instanceof Element))return;this.effects.get(t)?.forEach((r)=>q(r)),this.effects.delete(t),this.listeners.get(t)?.forEach(({eventName:r,listener:o})=>{t.removeEventListener(r,o)}),this.listeners.delete(t),this.modelBindings.cleanup(t),this.unmountChildren(t,e,n)}mountChildren(e,t,n){O(t.children).forEach((r)=>{e.appendChild(n.renderer.mount(r,n))})}updateChildren(e,t,n,r){this.updateOrdinaryChildren(e,O(t.children),O(n.children),r)}unmountChildren(e,t,n){O(t.children).forEach((r,o)=>{let i=e.childNodes[o];if(i)n.renderer.unmount(r,i,n)})}applyProps(e,t,n,r){Object.keys(t).forEach((o)=>{if(pe(o)||o in n)return;if(o==="className"||o==="class")e.removeAttribute("class");else if(o==="style")e.removeAttribute("style");else if(o==="value"&&typeof e==="object"&&e!==null&&"value"in e)e.value="";else e.removeAttribute(he(o))}),Object.entries(n).forEach(([o,i])=>{if(pe(o))return;if(t[o]===i)return;if(o==="className"||o==="class"){if(e.namespaceURI===st)e.setAttribute("class",String(i??""));else e.className=String(i??"");return}if(o==="value"&&typeof e==="object"&&e!==null&&"value"in e){e.value=String(i??"");return}if(o==="style"&&typeof i==="object"&&i!==null){e.removeAttribute("style");let s=e.style;Object.entries(i).forEach(([a,l])=>{ot(s,a,l)});return}if(i===!1||i===void 0||i===null){e.removeAttribute(he(o));return}if(i===!0){e.setAttribute(he(o),"");return}if(typeof i==="string"&&r.templateEngine.hasExpressions(i)){this.setupReactiveAttribute(e,o,i,r);return}e.setAttribute(he(o),String(i))})}applyDirections(e,t,n,r){if(n&&"show"in n)e.style.display=n.show?"":"none";else if(t&&"show"in t)e.style.display="";if(!n?.model){this.modelBindings.cleanup(e);return}this.modelBindings.bind(e,n.model,r.templateEngine.state)}updateOrdinaryChildren(e,t,n,r){if(this.assertNoDuplicateKeys(t),this.assertNoDuplicateKeys(n),this.hasOnlyKeyedChildren(t,n)){this.updateKeyedChildren(e,t,n,r);return}let o=Math.min(t.length,n.length);for(let i=0;i<o;i+=1){let s=e.childNodes[i];if(!s){e.appendChild(r.renderer.mount(n[i],r));continue}r.renderer.patch(t[i],n[i],s,r)}for(let i=o;i<n.length;i+=1)e.appendChild(r.renderer.mount(n[i],r));for(let i=t.length-1;i>=n.length;i-=1){let s=e.childNodes[i];if(s){if(r.renderer.unmount(t[i],s,r),s.parentNode===e)e.removeChild(s)}}}updateKeyedChildren(e,t,n,r){let o=t.map((a,l)=>({vnode:a,node:e.childNodes[l],index:l})),i=new Map,s=new Set;o.forEach((a)=>{let l=this.getVNodeKey(a.vnode);if(l!==void 0&&a.node)i.set(l,{vnode:a.vnode,node:a.node,index:a.index})}),n.forEach((a,l)=>{let c=this.getVNodeKey(a),p=c===void 0?void 0:i.get(c),u;if(p)u=r.renderer.patch(p.vnode,a,p.node,r),s.add(p.index);else u=r.renderer.mount(a,r);let d=e.childNodes[l]??null;if(u!==d)e.insertBefore(u,d)}),o.forEach((a)=>{if(!a.node||s.has(a.index))return;if(r.renderer.unmount(a.vnode,a.node,r),a.node.parentNode===e)e.removeChild(a.node)})}hasOnlyKeyedChildren(e,t){return[...e,...t].every((n)=>this.getVNodeKey(n)!==void 0)}assertNoDuplicateKeys(e){let t=new Set;e.forEach((n)=>{let r=this.getVNodeKey(n);if(r===void 0)return;if(t.has(r))throw Error(`Duplicate key "${r}"`);t.add(r)})}getVNodeKey(e){if(typeof e==="string")return;return e.key}collectListeners(e){let t={};return Object.entries(e.props??{}).forEach(([n,r])=>{if(pe(n)&&typeof r==="function")t[tt(n)]=r}),{...t,...e.listeners??{}}}updateListeners(e,t,n){let r=this.listeners.get(e)??new Map,o=new Set(Object.keys(t)),i=new Set(Object.keys(n));o.forEach((s)=>{if(!i.has(s)||t[s]!==n[s]){let a=r.get(s);if(a)e.removeEventListener(a.eventName,a.listener),r.delete(s)}}),i.forEach((s)=>{if(!o.has(s)||t[s]!==n[s]){let{eventName:a,modifiers:l}=nt(s),c=typeof e.tagName==="string"&&e.tagName.toLowerCase()==="textarea",p=a==="confirm"&&!c?"keydown":a,u=rt((d)=>{if(p==="keydown"){if(d.key!=="Enter")return}n[s](d)},l);e.addEventListener(p,u),r.set(s,{eventName:p,listener:u})}}),this.listeners.set(e,r)}setupReactiveAttribute(e,t,n,r){let o=B(()=>{e.setAttribute(t,r.templateEngine.evaluateTemplateValue(n))});this.trackEffect(e,o)}trackEffect(e,t){let n=this.effects.get(e)??new Set;n.add(t),this.effects.set(e,n)}}function he(e){if(e.startsWith("data")&&e.length>4)return`data${e.slice(4).replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}`;if(e==="tabIndex"||e==="colSpan"||e==="htmlFor")return e.toLowerCase();return e}class de{strategies;constructor(){this.strategies=[new at,new lt,new ut,new me]}mount(e,t){return this.findStrategy(e).mount(e,t)}patch(e,t,n,r){let o=this.findStrategy(e),i=this.findStrategy(t);if(o!==i){let s=i.mount(t,r);return n.parentNode?.replaceChild(s,n),o.unmount(e,n,r),s}return o.patch(e,t,n,r)}unmount(e,t,n){this.findStrategy(e).unmount(e,t,n)}findStrategy(e){let t=this.strategies.find((n)=>n.matches(e));if(!t)throw Error("No render strategy found for vnode");return t}}class at{matches(e){return typeof e==="string"}mount(e,t){return t.templateEngine.parseTemplate(e)}patch(e,t,n,r){if(e===t)return n;let o=this.mount(t,r);return n.parentNode?.replaceChild(o,n),o}unmount(){}}class lt{instances=new WeakMap;instanceNodes=new Map;emitterUnsubscribers=new WeakMap;matches(e){return typeof e==="object"&&e!==null&&Ue(e)}mount(e,t){if(e.directions?.if===!1)return document.createComment("if");let r=new e.component(this.createProps(e));if(t.appContext&&r.setAppContext)r.setAppContext(t.appContext);this.syncEmitters(r,e.emitters??{}),t.registerChild(r);let o=r.mountToNode();return this.trackInstanceNode(r,o),r.setElementChangeListener?.((i,s)=>{this.trackInstanceNode(r,i),this.trackInstanceNode(r,s)}),o}patch(e,t,n,r){if(n.nodeType===Node.COMMENT_NODE){let s=this.mount(t,r);return n.parentNode?.replaceChild(s,n),s}if(t.directions?.if===!1){let s=document.createComment("if");return n.parentNode?.replaceChild(s,n),this.unmount(e,n,r),s}let o=this.instances.get(n);if(o&&e.component===t.component){this.syncEmitters(o,t.emitters??{}),o.setProps(this.createProps(t));let s=o.getElement()??n;return this.trackInstanceNode(o,s),s}let i=this.mount(t,r);return n.parentNode?.replaceChild(i,n),this.unmount(e,n,r),i}unmount(e,t,n){let r=this.instances.get(t);if(r)this.clearEmitters(r),r.unmount(),this.clearInstanceNodes(r),n.unregisterChild(r)}createProps(e){return{...e.props??{},children:O(e.children)}}syncEmitters(e,t){let n=this.emitterUnsubscribers.get(e)??new Map;n.forEach(({listener:r,unsubscribe:o},i)=>{let s=t[i];if(!s||s!==r)o(),n.delete(i)}),Object.entries(t).forEach(([r,o])=>{if(n.get(r)?.listener===o)return;n.set(r,{listener:o,unsubscribe:e.on(r,o)})}),this.emitterUnsubscribers.set(e,n)}clearEmitters(e){this.emitterUnsubscribers.get(e)?.forEach(({unsubscribe:t})=>{t()}),this.emitterUnsubscribers.delete(e)}trackInstanceNode(e,t){this.instances.set(t,e);let n=this.instanceNodes.get(e)??new Set;n.add(t),this.instanceNodes.set(e,n)}clearInstanceNodes(e){this.instanceNodes.get(e)?.forEach((t)=>{this.instances.delete(t)}),this.instanceNodes.delete(e)}}class ut{renderedChildren=new WeakMap;matches(e){return typeof e==="object"&&e!==null&&Ke(e)}mount(e,t){if(e.directions?.if===!1)return document.createComment("if");let n=document.createElement("div");return n.setAttribute("data-slot",e.props.name),this.mountSlotChildren(n,this.resolveChildren(e,t),t),n}patch(e,t,n,r){if(n.nodeType===Node.COMMENT_NODE){let o=this.mount(t,r);return n.parentNode?.replaceChild(o,n),o}if(t.directions?.if===!1){let o=document.createComment("if");return n.parentNode?.replaceChild(o,n),this.unmount(e,n,r),o}if(n instanceof HTMLElement)n.setAttribute("data-slot",t.props.name),this.replaceSlotChildren(n,e,t,r);return n}unmount(e,t,n){if(!(t instanceof HTMLElement))return;this.unmountSlotChildren(t,n),this.renderedChildren.delete(t)}resolveChildren(e,t){return t.slots[e.props.name]??O(e.children)}replaceSlotChildren(e,t,n,r){let o=this.renderedChildren.get(e)??[],i=this.resolveChildren(n,r),s=Math.min(o.length,i.length);for(let a=0;a<s;a+=1){let l=e.childNodes[a];if(!l){e.appendChild(r.renderer.mount(i[a],r));continue}r.renderer.patch(o[a],i[a],l,r)}for(let a=s;a<i.length;a+=1)e.appendChild(r.renderer.mount(i[a],r));for(let a=o.length-1;a>=i.length;a-=1){let l=e.childNodes[a];if(l){if(r.renderer.unmount(o[a],l,r),l.parentNode===e)e.removeChild(l)}}this.renderedChildren.set(e,i)}mountSlotChildren(e,t,n){t.forEach((r)=>{e.appendChild(n.renderer.mount(r,n))}),this.renderedChildren.set(e,t)}unmountSlotChildren(e,t){(this.renderedChildren.get(e)??[]).forEach((r,o)=>{let i=e.childNodes[o];if(i)t.renderer.unmount(r,i,t)})}}class E extends Error{code;config;response;cause;constructor(e){super(e.message);this.name="RequestError",this.code=e.code,this.config=e.config,this.response=e.response,this.cause=e.cause}}var Vt=new Set(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"]);function fe(e){if(e===void 0)return"GET";let t=e.toUpperCase();if(!Vt.has(t))throw Error(`Unsupported HTTP method: ${e}`);return t}var Wt=/^[a-z][a-z\d+.-]*:\/\//i;function $t(e){return Wt.test(e)}function Ut(e,t){if(!e||$t(t))return t;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function ct(e){if(e instanceof Date)return e.toISOString();if(typeof e==="object")return JSON.stringify(e);return String(e)}function Gt(e){if(!e)return"";let t=[];return Object.keys(e).forEach((n)=>{let r=e[n];if(r===void 0||r===null)return;let o=encodeURIComponent(n);if(Array.isArray(r)){r.forEach((i)=>{if(i===void 0||i===null)return;t.push(`${o}=${encodeURIComponent(ct(i))}`)});return}t.push(`${o}=${encodeURIComponent(ct(r))}`)}),t.join("&")}function ge(e,t,n){let r=Ut(e,t),o=Gt(n);if(!o)return r;let i=r.includes("?")?"&":"?";return`${r}${i}${o}`}function Kt(e){if(e===void 0||e===null)return;return String(e)}function K(...e){let t={},n=new Map;return e.forEach((r)=>{if(!r)return;Object.keys(r).forEach((o)=>{let i=Kt(r[o]);if(i===void 0)return;let s=o.toLowerCase(),a=n.get(s);if(a!==void 0&&a!==o)delete t[a];n.set(s,o),t[o]=i})}),t}function Xt(e,t){return Object.keys(e).some((n)=>n.toLowerCase()===t.toLowerCase())}function pt(e,t,n){if(n==="GET"||n==="HEAD")return;if(e===void 0||e===null)return;if(typeof e==="string")return e;if(typeof FormData<"u"&&e instanceof FormData)return e;if(typeof Blob<"u"&&e instanceof Blob)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e;if(!Xt(t,"Content-Type"))t["Content-Type"]="application/json";return JSON.stringify(e)}class Ne{platform="web";async request(e){let t=fe(e.method),n=ge(e.baseURL,e.url,e.params),r=K(e.headers),o=pt(e.data,r,t),i=new AbortController,s=!1,a=!1,l;if(e.signal)if(e.signal.aborted)a=!0,i.abort();else e.signal.addEventListener("abort",()=>{a=!0,i.abort()},{once:!0});if(typeof e.timeout==="number"&&e.timeout>0)l=setTimeout(()=>{s=!0,i.abort()},e.timeout);let c=e.credentials??(e.withCredentials===!0?"include":"same-origin");try{let p=await fetch(n,{method:t,headers:r,body:o,signal:i.signal,credentials:c}),u={};return p.headers.forEach((m,f)=>{u[f]=m}),{data:await Yt(p,e),statusCode:p.status,statusText:p.statusText,headers:u,config:e}}catch(p){if(s)throw new E({code:"TIMEOUT",message:`Request timeout after ${String(e.timeout)}ms`,config:e,cause:p});if(a||i.signal.aborted)throw new E({code:"ABORTED",message:"Request aborted",config:e,cause:p});throw new E({code:"NETWORK_ERROR",message:p instanceof Error?p.message:String(p),config:e,cause:p})}finally{if(l!==void 0)clearTimeout(l)}}}async function Yt(e,t){if(t.responseType==="arraybuffer")return e.arrayBuffer();let n=await e.text();if(t.dataType==="text"||!n)return n;try{return JSON.parse(n)}catch{return n}}function Qt(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof global<"u")return global;return{}}function He(e){let t=Qt()[e];return typeof t==="object"&&t!==null?t:null}function be(){if(De("wx"))return"weixin";if(De("my"))return"alipay";if(De("tt"))return"bytedance";if(typeof fetch==="function")return"web";return"unknown"}function De(e){let t=He(e);return t!==null&&typeof t.request==="function"}var dt={platform:"weixin",globalName:"wx",headerField:"header",statusField:"statusCode",responseHeaderField:"header"},ht={platform:"alipay",globalName:"my",headerField:"headers",statusField:"status",responseHeaderField:"headers"},mt={platform:"bytedance",globalName:"tt",headerField:"header",statusField:"statusCode",responseHeaderField:"header"};class ee{dialect;platform;constructor(e){this.dialect=e;this.platform=e.platform}request(e){let t=He(this.dialect.globalName);if(!t||typeof t.request!=="function")return Promise.reject(new E({code:"UNSUPPORTED_PLATFORM",message:`${this.dialect.globalName}.request is not available in current environment`,config:e}));let n=t.request;return new Promise((r,o)=>{let i=!1,s=!1,a,l,c=(u)=>{if(s)return;if(s=!0,l!==void 0)clearTimeout(l);u()},p={url:ge(e.baseURL,e.url,e.params),method:e.method??"GET",data:e.data,[this.dialect.headerField]:Jt(e.headers),dataType:e.dataType??"json",...e.responseType!==void 0?{responseType:e.responseType}:{},...e.timeout!==void 0&&e.timeout>0?{timeout:e.timeout}:{},success:(u)=>{c(()=>{let d=u[this.dialect.statusField],m=Number(d??u.statusCode??0),f=Zt(u[this.dialect.responseHeaderField]);r({data:u.data,statusCode:m,headers:f,config:e,...Array.isArray(u.cookies)?{cookies:u.cookies}:{},...typeof u.errMsg==="string"?{errMsg:u.errMsg}:{}})})},fail:(u)=>{c(()=>{let d=en(u);o(new E({code:i?"TIMEOUT":tn(d),message:d||"Network request failed",config:e,cause:u}))})}};if(e.timeout!==void 0&&e.timeout>0)l=setTimeout(()=>{i=!0,a?.abort?.()},e.timeout);if(a=n(p)??void 0,e.signal)if(e.signal.aborted)a?.abort?.();else e.signal.addEventListener("abort",()=>{a?.abort?.()},{once:!0})})}}function Jt(e){return K(e)}function Zt(e){if(typeof e!=="object"||e===null)return{};let t={};return Object.keys(e).forEach((n)=>{let r=e[n];if(r!==void 0&&r!==null)t[n]=String(r)}),t}function en(e){if(typeof e.errMsg==="string")return e.errMsg;if(typeof e.errorMessage==="string")return e.errorMessage;if(typeof e.error==="string")return e.error;return""}function tn(e){if(!e)return"UNKNOWN";if(/timeout/i.test(e))return"TIMEOUT";if(/abort/i.test(e))return"ABORTED";return"NETWORK_ERROR"}var ft={web:new Ne,weixin:new ee(dt),alipay:new ee(ht),bytedance:new ee(mt)};function ye(e){let t=ft[e];if(!t)throw new E({code:"UNSUPPORTED_PLATFORM",message:`Unsupported request platform: ${String(e)}`,config:{url:""}});return t}async function Be(e,t,n){if(e.platform!==void 0&&e.platform!=="auto")return ye(e.platform);if(t!==void 0)return typeof t==="function"?await t(e):t;if(n!==void 0&&n!=="auto")return ye(n);let r=be();if(r==="unknown")throw new E({code:"UNSUPPORTED_PLATFORM",message:"No supported request platform detected (web fetch / wx.request / my.request / tt.request)",config:e});return ye(r)}class te{handlers=[];use(e,t){return this.handlers.push({onFulfilled:e,onRejected:t}),this.handlers.length-1}eject(e){if(this.handlers[e]!==void 0)this.handlers[e]=null}clear(){this.handlers.length=0}forEach(e){this.handlers.forEach((t,n)=>{if(t!==null)e(t,n)})}}class ve{interceptors={request:new te,response:new te};instanceDefaults;instanceAdapter;instancePlatform;constructor(e={}){let{adapter:t,platform:n,...r}=e;this.instanceAdapter=t,this.instancePlatform=n,this.instanceDefaults={...r}}request(e){let t;try{t=this.mergeConfig(e)}catch(i){return Promise.reject(i)}let n=[];this.interceptors.request.forEach((i)=>{n.push(i.onFulfilled,i.onRejected)}),n.push((i)=>this.dispatch(i),void 0);let r=[];this.interceptors.response.forEach((i)=>{r.push({onFulfilled:i.onFulfilled,onRejected:i.onRejected})});for(let i=r.length-1;i>=0;i-=1){let s=r[i];n.push(s.onFulfilled,s.onRejected)}let o=Promise.resolve(t);while(n.length>0){let i=n.shift(),s=n.shift();o=o.then(i,s)}return o}get(e,t){return this.request({...t,url:e,method:"GET"})}delete(e,t){return this.request({...t,url:e,method:"DELETE"})}head(e,t){return this.request({...t,url:e,method:"HEAD"})}options(e,t){return this.request({...t,url:e,method:"OPTIONS"})}post(e,t,n){return this.request({...n,url:e,method:"POST",data:t})}put(e,t,n){return this.request({...n,url:e,method:"PUT",data:t})}patch(e,t,n){return this.request({...n,url:e,method:"PATCH",data:t})}dispatch(e){return Be(e,this.instanceAdapter,this.instancePlatform).then((t)=>t.request(e))}mergeConfig(e){if(!e||typeof e!=="object")throw new E({code:"BAD_REQUEST",message:"Request config must be an object",config:e});let t={...this.instanceDefaults,...e,headers:K(this.instanceDefaults.headers,e.headers),params:{...this.instanceDefaults.params,...e.params}};if(typeof t.url!=="string"||t.url.length===0)throw new E({code:"BAD_REQUEST",message:"Request url is required",config:t});try{t.method=fe(t.method)}catch(n){throw new E({code:"BAD_REQUEST",message:n.message,config:t,cause:n})}return t}}var Yi=new ve;var nn="tc-chart-canvas",rn=150;class gt extends Z{chart=null;destroyed=!1;resizeDebounced=null;resizeObserver=null;mpResizeHandler=null;hoverHandlers=[];initState(){return{canvasId:nn}}initStyles(){this.styleManager.addStyle("tc-chart-canvas",{selector:".tc-chart__canvas",properties:{display:"block",height:"100%",width:"100%"}})}render(){return Xe("canvas",{id:this.state.canvasId,className:`tc-chart__canvas${this.props.className?` ${this.props.className}`:""}`,type:"2d"})}onMounted(){this.attachChart(),this.setupAutoResize(),this.setupHoverEvents()}onUpdated(){if(this.chart&&!this.destroyed)this.chart.setOption(this.props.option).render();else if(!this.chart&&!this.destroyed)this.attachChart()}onUnmounted(){this.teardownAutoResize(),this.teardownHoverEvents(),this.destroyed=!0,this.chart?.destroy(),this.chart=null}getChart(){return this.chart}attachChart(){if(this.destroyed)return;this.resolveContext().then((e)=>{if(this.destroyed||!e)return;this.chart=Q(e,this.props.option),this.chart.render()}).catch((e)=>{console.error("[TcChart] attach failed:",e)})}getElement(){return this.el}setupHoverEvents(){if(this.destroyed||this.hoverHandlers.length>0)return;if(H())return;let e=this.getElement();if(!e||typeof e.addEventListener!=="function")return;let t=(r)=>{let o=this.chart;if(!o)return;let i=r,s=e.getBoundingClientRect(),a=i.clientX-s.left,l=i.clientY-s.top,c=s.width,p=s.height;if(c>0&&p>0)o.resize(c,p);o.setHover(a,l)},n=()=>{this.chart?.clearHover()};e.addEventListener("mousemove",t),e.addEventListener("mouseleave",n),this.hoverHandlers=[["mousemove",t],["mouseleave",n]]}teardownHoverEvents(){let e=this.getElement();for(let[t,n]of this.hoverHandlers)e?.removeEventListener(t,n);this.hoverHandlers=[]}setupAutoResize(){if(this.destroyed||this.resizeDebounced)return;this.resizeDebounced=xe(()=>this.handleResize(),rn);let e=H();if(e){let n=I(e);if(n&&typeof n.onWindowResize==="function")this.mpResizeHandler=()=>this.resizeDebounced.run(),n.onWindowResize(this.mpResizeHandler);return}let t=this.getElement();if(t&&typeof t.getContext==="function"&&typeof ResizeObserver==="function")this.resizeObserver=new ResizeObserver(()=>this.resizeDebounced.run()),this.resizeObserver.observe(t)}teardownAutoResize(){if(this.resizeObserver?.disconnect(),this.resizeObserver=null,this.resizeDebounced?.cancel(),this.resizeDebounced=null,this.mpResizeHandler){let e=H(),t=e?I(e):null;if(t&&typeof t.offWindowResize==="function")t.offWindowResize(this.mpResizeHandler);this.mpResizeHandler=null}}handleResize(){if(this.destroyed)return;if(H()){this.chart?.destroy(),this.chart=null,this.attachChart();return}let e=this.getElement();if(!e||typeof e.getContext!=="function")return;let t=e.clientWidth||0,n=e.clientHeight||0;if(t<=0||n<=0)return;if(!this.chart){this.attachChart();return}let r=D();e.width=Math.round(t*r),e.height=Math.round(n*r),this.chart.resize(t,n,r).render()}resolveContext(){if(this.props.resolve)return Promise.resolve(this.props.resolve(this.getElement()));let e=H();if(e){let n=`#${this.state.canvasId}`,r=(o)=>ue({platform:e,instance:this,selector:n}).then((i)=>U(i)).catch((i)=>{if(o<=0)throw i;return new Promise((s)=>setTimeout(s,50)).then(()=>r(o-1))});return r(5)}let t=this.getElement();if(!t||typeof t.getContext!=="function")return Promise.resolve(null);return Promise.resolve(G(t))}}export{ie as BarChart,re as CategoryScale,M as ChartBase,_e as DEFAULT_AXIS_COLOR,ne as DEFAULT_FONT_FAMILY,Ce as DEFAULT_GRID_COLOR,ze as DEFAULT_PALETTE,X as DEFAULT_TEXT_COLOR,oe as LineChart,Y as LinearScale,ae as PieChart,le as RadarChart,gt as TcChart,Re as computeLayout,Q as createChart,Lt as createMiniProgramChart,Pt as createWebChart,xe as debounce,Se as detectMiniProgramPixelRatio,D as detectPixelRatio,ue as getMiniProgramCanvasNode,I as getMiniProgramGlobal,bt as isCanvas2DLike,Fe as niceTicks,U as resolveMiniProgramCanvas,$e as resolveNativeCanvas,G as resolveWebCanvas};
|
|
15
15
|
|
|
16
|
-
//# debugId=
|
|
16
|
+
//# debugId=0275C413C5C4432664756E2164756E21
|
|
17
17
|
//# sourceMappingURL=index.js.map
|