ranuts 0.2.0-alpha.0 → 0.3.0-alpha.1
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/CLAUDE.md +107 -16
- package/README.md +7 -5
- package/README.zh-CN.md +7 -5
- package/dist/chain-CTywmh_H.js +1 -0
- package/dist/{color-CRdlaDqQ.js → color-Dohr9BXX.js} +1 -1
- package/dist/enums-BAgbyGdH.js +1 -0
- package/dist/i18n-Cf5TtRb4.js +1 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.js +1 -1
- package/dist/src/node/appendFile.d.ts +3 -3
- package/dist/src/node/fileInfo.d.ts +2 -2
- package/dist/src/node/index.js +1 -1
- package/dist/src/node/paresUrl.d.ts +1 -1
- package/dist/src/node/readFile.d.ts +3 -3
- package/dist/src/node/traverse.d.ts +2 -2
- package/dist/src/node/watchFile.d.ts +3 -3
- package/dist/src/node/writeFile.d.ts +3 -3
- package/dist/src/utils/async.d.ts +81 -0
- package/dist/src/utils/audioRecorder.d.ts +1 -1
- package/dist/src/utils/behavior.d.ts +12 -3
- package/dist/src/utils/bom.d.ts +68 -178
- package/dist/src/utils/bridge.d.ts +153 -0
- package/dist/src/utils/canvas.d.ts +54 -0
- package/dist/src/utils/chain.d.ts +80 -0
- package/dist/src/utils/color.d.ts +76 -4
- package/dist/src/utils/compose.d.ts +1 -1
- package/dist/src/utils/console.d.ts +19 -1
- package/dist/src/utils/debounce.d.ts +27 -5
- package/dist/src/utils/device.d.ts +31 -3
- package/dist/src/utils/dom.d.ts +5 -84
- package/dist/src/utils/error.d.ts +18 -1
- package/dist/src/utils/event.d.ts +61 -0
- package/dist/src/utils/file.d.ts +30 -0
- package/dist/src/utils/i18n/index.js +1 -0
- package/dist/src/utils/i18n.d.ts +69 -0
- package/dist/src/utils/idb.d.ts +178 -0
- package/dist/src/utils/img.d.ts +60 -4
- package/dist/src/utils/index.d.ts +48 -16
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/lang.d.ts +69 -0
- package/dist/src/utils/localePath.d.ts +62 -0
- package/dist/src/utils/memoize.d.ts +53 -5
- package/dist/src/utils/monitor.d.ts +55 -26
- package/dist/src/utils/number.d.ts +46 -9
- package/dist/src/utils/obj.d.ts +56 -31
- package/dist/src/utils/prefetch.d.ts +81 -0
- package/dist/src/utils/queue.d.ts +53 -23
- package/dist/src/utils/report.d.ts +51 -3
- package/dist/src/utils/request.d.ts +26 -7
- package/dist/src/utils/script.d.ts +26 -4
- package/dist/src/utils/segment.d.ts +62 -0
- package/dist/src/utils/signal.d.ts +35 -3
- package/dist/src/utils/storage.d.ts +57 -0
- package/dist/src/utils/str.d.ts +112 -88
- package/dist/src/utils/style.d.ts +31 -0
- package/dist/src/utils/subscribe.d.ts +5 -5
- package/dist/src/utils/throttle.d.ts +26 -13
- package/dist/src/utils/time.d.ts +38 -6
- package/dist/src/utils/tween.d.ts +40 -0
- package/dist/src/utils/visual/application.d.ts +4 -4
- package/dist/src/utils/visual/enums.d.ts +4 -4
- package/dist/src/utils/visual/graphics/graphics.d.ts +25 -25
- package/dist/src/utils/visual/graphics/graphicsData.d.ts +1 -1
- package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +6 -6
- package/dist/src/utils/visual/index.js +1 -1
- package/dist/src/utils/visual/math/matrix.d.ts +8 -8
- package/dist/src/utils/visual/math/transform.d.ts +1 -1
- package/dist/src/utils/visual/render/batchRenderer.d.ts +20 -18
- package/dist/src/utils/visual/render/utils/batch/index.d.ts +13 -13
- package/dist/src/utils/visual/render/utils/float.d.ts +13 -13
- package/dist/src/utils/visual/render/utils/verticy.d.ts +3 -3
- package/dist/src/utils/visual/render/utils/webgl/initShader.d.ts +3 -2
- package/dist/src/utils/visual/render/utils/webgpu/shaders.d.ts +2 -2
- package/dist/src/utils/visual/render/webGPURenderer.d.ts +8 -8
- package/dist/src/utils/visual/vertex/container.d.ts +17 -16
- package/dist/src/utils/worker.d.ts +76 -0
- package/dist/src/utils/zip.d.ts +162 -0
- package/dist/src/vnode/index.d.ts +1 -1
- package/dist/src/vnode/index.js +1 -1
- package/dist/src/vnode/is.d.ts +4 -0
- package/dist/test/canvas.test.d.ts +1 -0
- package/dist/test/color.test.d.ts +1 -0
- package/dist/test/tween.test.d.ts +1 -0
- package/dist/test/utils/async.test.d.ts +1 -0
- package/dist/test/utils/file-read.test.d.ts +1 -0
- package/dist/test/utils/format.test.d.ts +1 -0
- package/dist/test/utils/idb.test.d.ts +1 -0
- package/dist/test/utils/instrumentation.test.d.ts +1 -0
- package/dist/test/utils/lang.test.d.ts +1 -0
- package/dist/test/utils/locale-path.test.d.ts +1 -0
- package/dist/test/utils/media-query.test.d.ts +1 -0
- package/dist/test/utils/number-parse.test.d.ts +1 -0
- package/dist/test/utils/prefetch.test.d.ts +1 -0
- package/dist/test/utils/query-storage.test.d.ts +1 -0
- package/dist/test/utils/queue.test.d.ts +1 -0
- package/dist/test/utils/report-config.test.d.ts +1 -0
- package/dist/test/utils/report-image.test.d.ts +1 -0
- package/dist/test/utils/segment.test.d.ts +1 -0
- package/dist/test/utils/signal-once.test.d.ts +1 -0
- package/dist/test/utils/single-flight.test.d.ts +1 -0
- package/dist/test/utils/timing.test.d.ts +1 -0
- package/dist/test/utils/worker-client.test.d.ts +1 -0
- package/dist/test/utils/zip.test.d.ts +1 -0
- package/dist/umd/index.umd.cjs +1 -1
- package/dist/umd/node/node.umd.cjs +1 -1
- package/dist/umd/utils/utils.umd.cjs +1 -1
- package/dist/utils-BDtXHcK8.js +1 -0
- package/docs/API.md +306 -147
- package/package.json +32 -14
- package/dist/src/vnode/chainDom.d.ts +0 -47
- package/dist/subscribe-CINWsor3.js +0 -1
- package/dist/utils-_OxsVZmz.js +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: A set of easing functions. Each is a pure mathematical mapping — it does not
|
|
3
|
+
* touch the DOM and brings no RAF loop of its own; the caller feeds in the elapsed time from
|
|
4
|
+
* its own animation frame and gets back the value for that frame.
|
|
5
|
+
*
|
|
6
|
+
* Parameters follow Robert Penner's classic convention:
|
|
7
|
+
* - t: current time (how much has elapsed)
|
|
8
|
+
* - b: beginning value
|
|
9
|
+
* - c: change in value (the final value is b + c)
|
|
10
|
+
* - d: duration
|
|
11
|
+
*
|
|
12
|
+
* Every function clamps at `t >= d`, so calling past the duration returns the final value rather than extrapolating.
|
|
13
|
+
*
|
|
14
|
+
* With thanks to Zhang Xinxu — https://github.com/zhangxinxu/Tween
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const start = performance.now();
|
|
19
|
+
* const tick = (now: number) => {
|
|
20
|
+
* const x = cubic.easeOut(now - start, 0, 300, 600); // 0 → 300 over 600ms
|
|
21
|
+
* el.style.transform = `translateX(${x}px)`;
|
|
22
|
+
* if (now - start < 600) requestAnimationFrame(tick);
|
|
23
|
+
* };
|
|
24
|
+
* requestAnimationFrame(tick);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
/** One easing function: (elapsed, from, delta, duration) => current value */
|
|
28
|
+
export type EasingFn = (t: number, b: number, c: number, d: number) => number;
|
|
29
|
+
/** The ease-in / ease-out pair of one easing family */
|
|
30
|
+
export interface SpeedType {
|
|
31
|
+
easeIn: EasingFn;
|
|
32
|
+
easeOut: EasingFn;
|
|
33
|
+
}
|
|
34
|
+
export declare const quad: SpeedType;
|
|
35
|
+
export declare const cubic: SpeedType;
|
|
36
|
+
export declare const quart: SpeedType;
|
|
37
|
+
export declare const quint: SpeedType;
|
|
38
|
+
export declare const sine: SpeedType;
|
|
39
|
+
export declare const expo: SpeedType;
|
|
40
|
+
export declare const circ: SpeedType;
|
|
@@ -9,11 +9,11 @@ export declare class Application {
|
|
|
9
9
|
eventSystem: EventSystem;
|
|
10
10
|
constructor(options: IApplicationOptions);
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Create and initialise an Application.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Prefer this async factory over `new Application()`: the WebGPU backend initialises its
|
|
15
|
+
* device asynchronously and must finish before the first render. The Canvas and WebGL
|
|
16
|
+
* backends resolve immediately, so the factory is safe and consistent for all of them.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* const app = await Application.create({ view, prefer: RENDERER_TYPE.WEB_GPU });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare enum SHAPE_TYPE {
|
|
2
|
-
RECTANGLE = "rectangle",//
|
|
3
|
-
POLYGON = "polygon",//
|
|
4
|
-
CIRCLE = "circle",//
|
|
5
|
-
ELLIPSE = "ellipse",//
|
|
2
|
+
RECTANGLE = "rectangle",// rectangle
|
|
3
|
+
POLYGON = "polygon",// polygon
|
|
4
|
+
CIRCLE = "circle",// circle
|
|
5
|
+
ELLIPSE = "ellipse",// ellipse
|
|
6
6
|
ROUNDED_RECTANGLE = "rounded rectangle"
|
|
7
7
|
}
|
|
8
8
|
export declare enum LINE_CAP {
|
|
@@ -18,49 +18,49 @@ export declare class Graphics extends Container {
|
|
|
18
18
|
resetLineStyle: () => void;
|
|
19
19
|
protected drawShape: (shape: Shape) => Graphics;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Finish the current path and start a new one
|
|
22
22
|
*/
|
|
23
23
|
protected startPoly: () => void;
|
|
24
24
|
beginFill: (color?: string, alpha?: number) => Graphics;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Leave fill mode
|
|
27
27
|
*/
|
|
28
28
|
endFill: () => Graphics;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* @param x x
|
|
32
|
-
* @param y y
|
|
33
|
-
* @param width
|
|
34
|
-
* @param height
|
|
30
|
+
* Draw a rectangle
|
|
31
|
+
* @param x x coordinate
|
|
32
|
+
* @param y y coordinate
|
|
33
|
+
* @param width width
|
|
34
|
+
* @param height height
|
|
35
35
|
*/
|
|
36
36
|
drawRect: (x: number, y: number, width: number, height: number) => Graphics;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @param x
|
|
40
|
-
* @param y
|
|
41
|
-
* @param radius
|
|
38
|
+
* Draw a circle
|
|
39
|
+
* @param x x of the centre
|
|
40
|
+
* @param y y of the centre
|
|
41
|
+
* @param radius radius
|
|
42
42
|
*/
|
|
43
43
|
drawCircle: (x: number, y: number, radius: number) => Graphics;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @param x x
|
|
47
|
-
* @param y y
|
|
48
|
-
* @param width
|
|
49
|
-
* @param height
|
|
50
|
-
* @param radius
|
|
45
|
+
* Draw a rounded rectangle
|
|
46
|
+
* @param x x coordinate
|
|
47
|
+
* @param y y coordinate
|
|
48
|
+
* @param width width
|
|
49
|
+
* @param height height
|
|
50
|
+
* @param radius corner radius
|
|
51
51
|
*/
|
|
52
52
|
drawRoundedRect: (x: number, y: number, width: number, height: number, radius: number) => Graphics;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @param x
|
|
56
|
-
* @param y
|
|
57
|
-
* @param radiusX
|
|
58
|
-
* @param radiusY
|
|
54
|
+
* Draw an ellipse
|
|
55
|
+
* @param x x of the ellipse's centre
|
|
56
|
+
* @param y y of the ellipse's centre
|
|
57
|
+
* @param radiusX x-axis radius
|
|
58
|
+
* @param radiusY y-axis radius
|
|
59
59
|
*/
|
|
60
60
|
drawEllipse: (x: number, y: number, radiusX: number, radiusY: number) => Graphics;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
* @param points
|
|
62
|
+
* Draw a polygon
|
|
63
|
+
* @param points the polygon's vertices; every 2 elements are one (x, y)
|
|
64
64
|
*/
|
|
65
65
|
drawPolygon: (points: number[]) => Graphics;
|
|
66
66
|
moveTo: (x: number, y: number) => Graphics;
|
|
@@ -73,7 +73,7 @@ export declare class Graphics extends Container {
|
|
|
73
73
|
arcTo: (x1: number, y1: number, x2: number, y2: number, radius: number) => Graphics;
|
|
74
74
|
clear: () => Graphics;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Draw itself through the Canvas API
|
|
77
77
|
*/
|
|
78
78
|
protected renderCanvas: (render: CanvasRenderer) => void;
|
|
79
79
|
buildBatches: (batchRenderer: BatchRenderer) => void;
|
|
@@ -10,25 +10,25 @@ export declare class GraphicsGeometry {
|
|
|
10
10
|
private dirty;
|
|
11
11
|
shapeIndex: number;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Each batchPart is one fill or one stroke
|
|
14
14
|
*/
|
|
15
15
|
batchParts: BatchPart[];
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Vertex array; every 2 elements are one vertex
|
|
18
18
|
*/
|
|
19
19
|
vertices: CustomFloatArray;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Index array; each element is one vertex index
|
|
22
22
|
*/
|
|
23
23
|
indices: CustomIntArray;
|
|
24
24
|
drawShape(shape: Shape, fillStyle: Fill, lineStyle: Line): void;
|
|
25
25
|
/**
|
|
26
|
-
* @param p
|
|
27
|
-
* @returns {boolean}
|
|
26
|
+
* @param p the point to test
|
|
27
|
+
* @returns {boolean} whether the point falls inside one of the sub-shapes
|
|
28
28
|
*/
|
|
29
29
|
containsPoint(p: Point): boolean;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Turn every sub-shape into vertices and triangulate them
|
|
32
32
|
*/
|
|
33
33
|
buildVerticesAndTriangulate(): void;
|
|
34
34
|
clear(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t}from"../../../subscribe-CINWsor3.js";var e,s=/* @__PURE__ */function(t){return t.RECTANGLE="rectangle",t.POLYGON="polygon",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.ROUNDED_RECTANGLE="rounded rectangle",t}({}),i=/* @__PURE__ */function(t){return t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t}({}),r=/* @__PURE__ */function(t){return t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t}({}),n=/* @__PURE__ */function(t){return t.WEB_GL="webgl",t.CANVAS="canvas",t.WEB_GPU="webgpu",t}({}),a=65536,h=12,o=class{},c=class extends o{x;y;width;height;type=s.RECTANGLE;constructor(t=0,e=0,s=0,i=0){super(),this.x=t,this.y=e,this.width=s,this.height=i}contains(t){return t.x>this.x&&t.x<this.x+this.width&&t.y>this.y&&t.y<this.y+this.height}},l=class{canvasEle;screen=new c;constructor(t){const{view:e}=t;this.canvasEle=e,this.screen.width=e.width,this.screen.height=e.height}resizeView(t,e){this.canvasEle.width=t,this.canvasEle.height=e}async init(){return Promise.resolve()}},u=class extends l{ctx;backgroundColor;backgroundAlpha;constructor(t){super(t),t.debug;const{backgroundColor:e,backgroundAlpha:s}=t;this.backgroundColor=e,this.backgroundAlpha=s,this.ctx=this.canvasEle.getContext("2d")}render(t){t.updateTransform(),this.ctx.save(),this.ctx.clearRect(0,0,this.screen.width,this.screen.height),this.backgroundAlpha&&(this.ctx.globalAlpha=this.backgroundAlpha),this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor),this.ctx.fillRect(0,0,this.screen.width,this.screen.height),t.renderCanvasRecursive(this),this.ctx.restore()}},p=(t,e)=>{if(e.worldAlpha<=0||!e.visible)return;e.buildBatches(t);const s=e.children;for(let i=0;i<s.length;i++)p(t,s[i])},f=(t,e)=>{if(e.worldAlpha<=0||!e.visible)return;e.updateBatches(t);const s=e.children;for(let i=0;i<s.length;i++)f(t,s[i])},d=class{vertexCount=0;indexCount=0;rgba=0;vertexStart=0;indexStart=0},x=class{style;vertexStart=0;indexStart=0;vertexCount=0;indexCount=0;constructor(t){this.style=t}start(t,e){this.vertexStart=t,this.indexStart=e}end(t,e){this.vertexCount=t,this.indexCount=e}},g=class{idx=0;reset(){this.idx=0}},y=class extends g{batches=[];constructor(){super()}getOne(){return this.batches[this.idx]||(this.batches[this.idx]=new v),this.batches[this.idx++]}},v=class extends d{vertexOffset=0;indexOffset=0;graphics;packVertices(t,e){const s=this.graphics.geometry.vertices.data,i=this.vertexOffset;for(let r=0;r<this.vertexCount;r++){const n=s[2*(i+r)],a=s[2*(i+r)+1],{a:h,b:o,c:c,d:l,tx:u,ty:p}=this.graphics.worldTransform,f=h*n+c*a+u,d=o*n+l*a+p,x=3*(this.vertexStart+r);t[x]=f,t[x+1]=d,e[x+2]=this.rgba}}packIndices(t){const e=this.graphics.geometry.indices.data,s=this.indexOffset;for(let i=0;i<this.indexCount;i++)t[this.indexStart+i]=e[i+s]+this.vertexStart}updateVertices(t){const e=this.graphics.geometry.vertices.data,s=this.vertexOffset,{a:i,b:r,c:n,d:a,tx:h,ty:o}=this.graphics.worldTransform;for(let c=0;c<this.vertexCount;c++){const l=e[2*(s+c)],u=e[2*(s+c)+1],p=3*(this.vertexStart+c);t[p]=i*l+n*u+h,t[p+1]=r*l+a*u+o}}},m=new class{batchesMap={graphics:new y};get(t){return this.batchesMap[t].getOne()}reset(){Object.values(this.batchesMap).forEach(t=>{t.reset()})}},b=class extends l{builtVersion=-1;vertexCount=0;indexCount=0;batches=[];batchesCount=0;vertFloatView;vertIntView;indexBuffer;curVertBufferLength=0;curIndexBufferLength=0;constructor(t){super(t);const e=/* @__PURE__ */new ArrayBuffer(3072);this.vertFloatView=new Float32Array(e),this.vertIntView=new Uint32Array(e),this.indexBuffer=/* @__PURE__ */new Uint32Array(256)}addBatch(t){t.vertexStart=this.vertexCount,t.indexStart=this.indexCount,this.vertexCount+=t.vertexCount,this.indexCount+=t.indexCount,this.batches[this.batchesCount]=t,this.batchesCount++}startBuild(){this.vertexCount=0,this.indexCount=0,this.batchesCount=0,m.reset()}buildEnd(){this.resizeBufferIfNeeded(),this.packData()}resizeBufferIfNeeded(){if(12*this.vertexCount>this.vertFloatView.byteLength){const t=new ArrayBuffer(12*this.vertexCount);this.vertFloatView=new Float32Array(t),this.vertIntView=new Uint32Array(t)}this.indexCount>this.indexBuffer.length&&(this.indexBuffer=new Uint32Array(this.indexCount))}packData(){for(let t=0;t<this.batchesCount;t++){const e=this.batches[t];this.batches[t]=void 0,e?.packVertices(this.vertFloatView,this.vertIntView),e?.packIndices(this.indexBuffer)}}updateChildrenTransform(t){t.sortChildren();const e=t.transform.shouldUpdateLocalTransform;if(t.transform.updateLocalTransform(),e){const{a:e,b:s,c:i,d:r,tx:n,ty:a}=t.transform.localTransform;this.setRootTransform(e,s,i,r,n,a)}t.worldAlpha=t.alpha;const s=t.children;for(let i=0;i<s.length;i++)s[i].updateTransform()}render(t){this.updateChildrenTransform(t),this.builtVersion!==t.structureVersion?(this.startBuild(),p(this,t),this.buildEnd(),this.builtVersion=t.structureVersion):f(this.vertFloatView,t),this.updateBuffer(),this.draw()}},w="\nprecision highp float;\nattribute vec2 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\nuniform mat3 u_root_transform;\nuniform mat3 u_projection_matrix;\nvoid main(){\n v_color = a_color;\n gl_Position = vec4((u_projection_matrix * u_root_transform * vec3(a_position, 1.0)).xy, 0.0, 1.0);\n}\n".trim(),M="\nprecision mediump float;\nvarying vec4 v_color;\nvoid main(){\n gl_FragColor = v_color;\n}\n".trim(),P=(t,e,s)=>{const i=t.createShader(e);if(t.shaderSource(i,s),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS))return i;{const e=t.getShaderInfoLog(i);throw t.deleteShader(i),console.error(`编译 shader 错误:${e}`),new Error(`编译 shader 错误:${e}`)}},T=t=>{const e=t.gl,s=((t,e,s)=>{const i=t.createProgram();if(!i)throw console.error("创建 program 失败"),new Error("创建 program 失败");if(t.attachShader(i,e),t.attachShader(i,s),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)){const r=t.getProgramInfoLog(i);throw console.error(`link 出错:${r}`),t.deleteProgram(i),t.deleteShader(e),t.deleteShader(s),new Error(`link 出错:${r}`)}return t.useProgram(i),i})(e,P(e,e.VERTEX_SHADER,w),P(e,e.FRAGMENT_SHADER,M));return e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),s},_=/* @__PURE__ */new Map,E=t=>{const s=_.get(t);if(s)return s;let i;if(/^#?[0-9a-fA-F]{3}$/.test(t)){const e=t.replace("#","");i=[parseInt(e[0]+e[0],16),parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16)]}else if(/^#?[0-9a-fA-F]{6}$/.test(t)){const e=parseInt(t.replace("#",""),16);i=[e>>16&255,e>>8&255,255&e]}else i=(t=>{if(void 0===e&&(e="undefined"!=typeof document?document.createElement("canvas").getContext("2d"):null),!e)return[0,0,0];e.fillStyle="#000",e.fillStyle=t,e.fillRect(0,0,1,1);const[s,i,r]=e.getImageData(0,0,1,1).data;return[s,i,r]})(t);return _.set(t,i),i},B=(t,e)=>{const[s,i,r]=E(t).map(t=>Math.round(t*e));let n=0;return n+=Math.round(255*e)<<24,n+=r<<16,n+=i<<8,n+=s,n},I=t=>{const[e,s,i]=E(t);return[e/255,s/255,i/255]},A=class extends b{gl;program;glVertexBuffer;glIndexBuffer;unifLoc;constructor(t){super(t),t.debug,this.gl=this.canvasEle.getContext("webgl",{antialias:!0}),this.gl.getExtension("OES_element_index_uint"),this.program=T(this),this.glVertexBuffer=this.gl.createBuffer(),this.glIndexBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.glVertexBuffer),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.glIndexBuffer),((t,e)=>{const s=t.getAttribLocation(e,"a_position");t.vertexAttribPointer(s,2,t.FLOAT,!1,12,0),t.enableVertexAttribArray(s);const i=t.getAttribLocation(e,"a_color");t.vertexAttribPointer(i,4,t.UNSIGNED_BYTE,!0,12,8),t.enableVertexAttribArray(i)})(this.gl,this.program),this.unifLoc={u_root_transform:this.gl.getUniformLocation(this.program,"u_root_transform"),u_projection_matrix:this.gl.getUniformLocation(this.program,"u_projection_matrix")};const e=t.backgroundAlpha??0,[s,i,r]=I(t.backgroundColor??"");this.gl.clearColor(s*e,i*e,r*e,e),this.setRootTransform(1,0,0,1,0,0),this.setProjectionMatrix()}setProjectionMatrix(){const t=1/this.canvasEle.width*2,e=1/this.canvasEle.height*2;this.gl.uniformMatrix3fv(this.unifLoc.u_projection_matrix,!1,new Float32Array([t,0,0,0,-e,0,-1,1,1]))}setRootTransform(t,e,s,i,r,n){this.gl.uniformMatrix3fv(this.unifLoc.u_root_transform,!1,new Float32Array([t,e,0,s,i,0,r,n,1]))}updateBuffer(){const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,this.glVertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertFloatView,t.DYNAMIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.glIndexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer,t.DYNAMIC_DRAW)}draw(){const t=this.gl;t.clear(t.COLOR_BUFFER_BIT),t.drawElements(t.TRIANGLES,this.indexCount,t.UNSIGNED_INT,0)}},S=class extends b{gpu;device;pipeline;renderPassDescriptor;options;gpuVertexBuffer;gpuIndexBuffer;projectionMatBuffer;stageMatBuffer;uniformBindGroup;constructor(t){super(t),t.debug,this.options=t,this.gpu=this.canvasEle.getContext("webgpu"),this.curVertBufferLength=256,this.curIndexBufferLength=256}async init(){await this.initDevice(),this.initGpuBuffer(),this.initRenderPassDescriptor(),this.createPipeline(),this.initUniformBindGroup(),this.setRootTransform(1,0,0,1,0,0),this.setProjectionMatrix()}draw(){const{device:t,renderPassDescriptor:e,gpuVertexBuffer:s,gpuIndexBuffer:i,gpu:r,uniformBindGroup:n,indexCount:a,pipeline:h}=this,o=t.createCommandEncoder(),c=[...e.colorAttachments];c?.[0]?.view&&(c[0].view=r.getCurrentTexture().createView());const l=o.beginRenderPass(e);l.setPipeline(h),l.setVertexBuffer(0,s),l.setIndexBuffer(i,"uint32"),l.setBindGroup(0,n),l.drawIndexed(a),l.end();const u=o.finish();t.queue.submit([u])}initUniformBindGroup(){const t=this.device;this.stageMatBuffer=t.createBuffer({label:"stage-matrix-uniform-buffer",size:12*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.projectionMatBuffer=t.createBuffer({label:"projection-matrix-uniform-buffer",size:12*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.uniformBindGroup=this.device.createBindGroup({label:"my-uniform-bind-group",layout:this.pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.stageMatBuffer}},{binding:1,resource:{buffer:this.projectionMatBuffer}}]})}initGpuBuffer(){const t=this.device;this.gpuVertexBuffer=t.createBuffer({label:"my-gpu-vertex-buffer",size:12*this.curVertBufferLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST}),this.gpuIndexBuffer=t.createBuffer({label:"my-gpu-index-buffer",size:this.curIndexBufferLength*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST})}updateBuffer(){const t=this.device;this.vertexCount>this.curVertBufferLength&&(this.gpuVertexBuffer.destroy(),this.gpuVertexBuffer=t.createBuffer({label:"my-gpu-vertex-buffer",size:12*this.vertexCount,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST}),this.curVertBufferLength=this.vertexCount),t.queue.writeBuffer(this.gpuVertexBuffer,0,this.vertFloatView.buffer),this.indexCount>this.curIndexBufferLength&&(this.gpuIndexBuffer.destroy(),this.gpuIndexBuffer=t.createBuffer({label:"my-gpu-index-buffer",size:this.indexCount*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST}),this.curIndexBufferLength=this.indexCount),t.queue.writeBuffer(this.gpuIndexBuffer,0,this.indexBuffer.buffer)}setRootTransform(t,e,s,i,r,n){this.device.queue.writeBuffer(this.stageMatBuffer,0,new Float32Array([t,e,0,0,s,i,0,0,r,n,1,0]))}setProjectionMatrix(){const t=1/this.canvasEle.width*2,e=1/this.canvasEle.height*2;this.device.queue.writeBuffer(this.projectionMatBuffer,0,new Float32Array([t,0,0,0,0,-e,0,0,-1,1,1,0]))}createPipeline(){this.pipeline=this.device.createRenderPipeline({layout:"auto",label:"my-render-pipeline",vertex:{module:this.device.createShaderModule({code:"\n@group(0) @binding(0) var<uniform> u_root_transform: mat3x3<f32>;\n@group(0) @binding(1) var<uniform> u_projection_matrix: mat3x3<f32>;\n\nstruct VertOutput {\n @builtin(position) v_position: vec4<f32>,\n @location(0) v_color : vec4<f32>,\n};\n\n@vertex\nfn main(\n @location(0) a_position: vec2<f32>,\n @location(1) a_color: vec4<f32>,\n) -> VertOutput {\n let v_position = vec4<f32>((u_projection_matrix * u_root_transform * vec3<f32>(a_position, 1.0)).xy, 0.0, 1.0);\n\n let v_color = a_color;\n\n return VertOutput(v_position, v_color);\n}\n",label:"my-vert-shader-module"}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,format:"float32x2",offset:0},{shaderLocation:1,format:"unorm8x4",offset:2*Float32Array.BYTES_PER_ELEMENT}]}]},fragment:{module:this.device.createShaderModule({code:"\n@fragment\nfn main(\n @location(0) v_color : vec4<f32>,\n) -> @location(0) vec4<f32> {\n return v_color;\n}\n",label:"my-frag-shader-module"}),entryPoint:"main",targets:[{format:navigator.gpu.getPreferredCanvasFormat(),blend:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list"}})}async initDevice(){const t=await((await navigator.gpu.requestAdapter())?.requestDevice());t&&(this.gpu.configure({device:t,format:navigator.gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),this.device=t)}initRenderPassDescriptor(){const{backgroundColor:t="",backgroundAlpha:e=1}=this.options,s=e,[i,r,n]=I(t).map(t=>t*s);this.renderPassDescriptor={label:"my-render-pass-descriptor",colorAttachments:[{view:this.gpu.getCurrentTexture().createView(),storeOp:"store",loadOp:"clear",clearValue:[i,r,n,s]}]}}},C=class t{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t=0,e=t){this.x=t,this.y=e}clone=()=>new t(this.x,this.y)},L=class{_x;_y;cb;constructor(t,e=0,s=0){this._x=e,this._y=s,this.cb=t}set(t=0,e=t){this._x=t,this._y=e,this.cb(this._x,this._y)}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb(this._x,this._y))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb(this._x,this._y))}},R=Math.PI/180,U=180/Math.PI,F=2*Math.PI,N=class t{a;b;c;d;tx;ty;array=null;constructor(t=1,e=0,s=0,i=1,r=0,n=0){this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n}set=(t,e,s,i,r,n)=>(this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n,this);append=t=>{const{a:e,b:s,c:i,d:r,tx:n,ty:a}=this,{a:h,b:o,c:c,d:l,tx:u,ty:p}=t;return this.a=e*h+i*o,this.b=s*h+r*o,this.c=e*c+i*l,this.d=s*c+r*l,this.tx=e*u+i*p+n,this.ty=s*u+r*p+a,this};fromArray=t=>{this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]};translate=(t,e)=>(this.tx+=t,this.ty+=e,this);scale=(t,e)=>(this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this);setTransform=(t,e,s,i,r,n,a,h,o)=>(this.a=Math.cos(a+o)*r,this.b=Math.sin(a+o)*r,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this);rotate=t=>{const e=Math.cos(t),s=Math.sin(t),i=this.a,r=this.c,n=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=r*e-this.d*s,this.d=r*s+this.d*e,this.tx=n*e-this.ty*s,this.ty=n*s+this.ty*e,this};equals=t=>t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty;identity=()=>(this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this);decompose=t=>{const e=this.a,s=this.b,i=this.c,r=this.d,n=t.pivot,a=-Math.atan2(-i,r),h=Math.atan2(s,e),o=Math.abs(a+h);return o<1e-5||Math.abs(F-o)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+r*r),t.position.x=this.tx+(n.x*e+n.y*i),t.position.y=this.ty+(n.x*s+n.y*r),t};apply=t=>{const e=new C,s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e};applyInverse=t=>{const e=new C,s=1/(this.a*this.d+this.c*-this.b),i=t.x,r=t.y;return e.x=this.d*s*i+-this.c*s*r+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*r+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e};prepend=t=>{const{a:e,b:s,c:i,d:r,tx:n,ty:a}=t,{a:h,b:o,c:c,d:l,tx:u,ty:p}=this;return this.a=e*h+i*o,this.b=s*h+r*o,this.c=e*c+i*l,this.d=s*c+r*l,this.tx=e*u+i*p+n,this.ty=s*u+r*p+a,this};clone=()=>{const e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e};toArray=(t,e)=>{this.array||(this.array=/* @__PURE__ */new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}},V=class{localTransform=new N;worldTransform=new N;position;scale;pivot;skew;_rotation=0;rotateMatrix=new N;skewMatrix=new N;scaleMatrix=new N;localMatrix=new N;shouldUpdateLocalTransform=!1;worldId=0;parentId=0;constructor(){this.position=new L(this.onChange),this.scale=new L(this.onScaleChange,1,1),this.pivot=new L(this.onChange),this.skew=new L(this.onSkewChange)}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this.rotateMatrix.set(Math.cos(this.rotation),Math.sin(this.rotation),-Math.sin(this.rotation),Math.cos(this.rotation),0,0),this.shouldUpdateLocalTransform=!0}onSkewChange=(t,e)=>{this.skewMatrix.set(Math.cos(e),Math.sin(e),Math.sin(t),Math.cos(t),0,0),this.shouldUpdateLocalTransform=!0};onScaleChange=(t,e)=>{this.scaleMatrix.set(t,0,0,e,0,0),this.shouldUpdateLocalTransform=!0};onChange=()=>{this.shouldUpdateLocalTransform=!0};updateLocalTransform(){if(!this.shouldUpdateLocalTransform)return;const{a:t,b:e,c:s,d:i}=this.localMatrix.set(1,0,0,1,0,0).append(this.rotateMatrix).append(this.skewMatrix).append(this.scaleMatrix),r=t*this.pivot.x+s*this.pivot.y,n=e*this.pivot.x+i*this.pivot.y,a=this.position.x-r,h=this.position.y-n;this.localTransform.set(t,e,s,i,a,h),this.shouldUpdateLocalTransform=!1,this.parentId=-1}updateTransform(t){if(this.updateLocalTransform(),this.parentId!==t.worldId){const{a:e,b:s,c:i,d:r,tx:n,ty:a}=t.worldTransform,{a:h,b:o,c:c,d:l,tx:u,ty:p}=this.localTransform;this.worldTransform.set(e*h+i*o,s*h+r*o,e*c+i*l,s*c+r*l,e*u+i*p+n,s*u+r*p+a),this.parentId=t.worldId,this.worldId++}}},D=class extends t{_zIndex=0;parent=void 0;visible=!0;transform=new V;alpha=1;worldAlpha=1;hitArea=null;cursor="auto";get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.isSort=!0)}get position(){return this.transform.position}get localTransform(){return this.transform.localTransform}get worldTransform(){return this.transform.worldTransform}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get scale(){return this.transform.scale}get pivot(){return this.transform.pivot}get skew(){return this.transform.skew}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*U}set angle(t){this.transform.rotation=t*R}updateTransform(){const t=this.parent?.transform||new V;this.transform.updateTransform(t),this.worldAlpha=this.alpha*(this.parent?.worldAlpha||1)}addEventListener=(t,e,s)=>{const i="boolean"==typeof s&&s||"object"==typeof s&&s.capture?`${t}capture`:t;"object"==typeof s&&s.once?this.once(i,e):this.tap(i,e)};removeEventListener=(t,e,s)=>{const i=s?`${t}capture`:t;this.off(i,e)}},k=class extends D{isSort=!1;type="container";children=[];worldId=0;batches=[];batchCount=0;structureVersion=0;constructor(){super()}markStructureDirty=()=>{let t=this.parent??this;for(;t.parent;)t=t.parent;t.structureVersion++};addChild=t=>{t.parent?.removeChild(t),this.children.push(t),t.parent=this,this.isSort=!0,this.markStructureDirty()};removeChild=t=>{for(let e=0;e<this.children.length;e++)if(this.children[e]===t)return this.children.splice(e,1),t.parent=void 0,void this.markStructureDirty()};sortChildren=()=>{this.isSort&&(this.children.sort((t,e)=>t.zIndex-e.zIndex),this.isSort=!1)};renderCanvas(t){}renderCanvasRecursive=t=>{if(!(this.worldAlpha<=0)&&this.visible){this.renderCanvas(t);for(let e=0;e<this.children.length;e++)this.children[e].renderCanvasRecursive(t)}};updateTransform=()=>{this.sortChildren();const t=this.parent?.transform||new V;if(this.transform.updateTransform(t),this.worldAlpha=(this.parent?.worldAlpha||1)*this.alpha,!(this.worldAlpha<=0)&&this.visible)for(let e=0;e<this.children.length;e++)this.children[e].updateTransform()};containsPoint=t=>!!this.hitArea&&this.hitArea.contains(t);buildBatches(t){}updateBatches(t){}},O=/* @__PURE__ */function(t){return t[t.NONE=0]="NONE",t[t.CAPTURING=1]="CAPTURING",t[t.AT_TARGET=2]="AT_TARGET",t[t.BUBBLING=3]="BUBBLING",t}({}),G=class{isTrusted=!0;timeStamp=0;type="mousemove";button=0;buttons=0;global=new C;propagationStopped=!1;eventPhase=0;target=new k;currentTarget=new k;stopPropagation(){this.propagationStopped=!0}},j=class{rootContainer;hasFoundTarget=!1;hitTarget=null;cursor="auto";eventHandlerMap={};pressTargetsMap={};overTargets=[];constructor(t){this.rootContainer=t,this.eventHandlerMap.mousemove=this.fireMouseMove,this.eventHandlerMap.mousedown=this.fireMouseDown,this.eventHandlerMap.mouseup=this.fireMouseUp}hitTestRecursive=(t,e)=>{if(!t.visible)return;if(this.hasFoundTarget)return;for(let i=t.children.length-1;i>=0;i--){const s=t.children[i];this.hitTestRecursive(s,e)}if(this.hasFoundTarget)return;const s=t.worldTransform.applyInverse(e);t.containsPoint(s)&&(this.hitTarget=t,this.hasFoundTarget=!0)};hitTest=t=>(this.hasFoundTarget=!1,this.hitTarget=null,this.hitTestRecursive(this.rootContainer,t),this.hitTarget);fireEvent=t=>{this.eventHandlerMap[t.type]?.(t)};fireMouseMove=t=>{const e=this.hitTest(t.global),s=this.overTargets.length>0?this.overTargets[this.overTargets.length-1]:null;if(s&&s!==e&&(t.target=s,t.type="mouseout",this.dispatchEvent(t),!e||!this.composePath(e).includes(s)))if(t.type="mouseleave",t.eventPhase=O.AT_TARGET,e){let i=s;for(;i&&!this.composePath(e).includes(i);)t.target=i,t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t),i=i.parent}else for(let i=this.overTargets.length-1;i>=0;i--)t.target=this.overTargets[i],t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t);if(e&&s!==e){t.target=e,t.type="mouseover",this.dispatchEvent(t);const i=this.composePath(e);if(t.type="mouseenter",t.eventPhase=O.AT_TARGET,s){let e=i.length-1;for(;e>=0&&!this.composePath(s).includes(i[e]);e--);for(let s=e+1;s<i.length;s++)t.target=i[s],t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t)}else for(let e=0;e<i.length;e++)t.target=i[e],t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t)}e&&(t.target=e,t.type="mousemove",this.dispatchEvent(t)),this.overTargets=e?this.composePath(e):[],this.cursor=e?e.cursor:"auto"};fireMouseDown=t=>{const e=this.hitTest(t.global);e&&(t.target=e,this.dispatchEvent(t),this.pressTargetsMap[t.button]=this.composePath(e))};fireMouseUp=t=>{const e=this.hitTest(t.global);if(!e)return;t.target=e,this.dispatchEvent(t);const s=this.pressTargetsMap[t.button];if(!s)return;let i=s[s.length-1];const r=this.composePath(e);for(;i&&!r.includes(i);)i.parent&&(i=i.parent);t.type="click",t.target=i,this.dispatchEvent(t),delete this.pressTargetsMap[t.button]};notifyTarget=t=>{t.eventPhase===O.CAPTURING?t.currentTarget.call(`${t.type}capture`,t):t.currentTarget.call(t.type,t)};propagate=t=>{const e=this.composePath(t.target);t.eventPhase=O.CAPTURING;for(let s=0;s<e.length-1;s++)if(t.currentTarget=e[s],this.notifyTarget(t),t.propagationStopped)return;if(t.eventPhase=O.AT_TARGET,t.currentTarget=t.target,t.currentTarget.call(`${t.type}capture`,t),!t.propagationStopped&&(t.currentTarget.call(t.type,t),!t.propagationStopped)){t.eventPhase=O.BUBBLING;for(let s=e.length-2;s>=0;s--)if(t.currentTarget=e[s],this.notifyTarget(t),t.propagationStopped)return}};dispatchEvent=t=>{t.propagationStopped=!1,this.propagate(t)};composePath=t=>{const e=[];let s=t;for(;s;)e.unshift(s),s=s.parent;return e}},Y=class{canvasEle;eventBoundary;rootEvent=new G;constructor(t,e){this.canvasEle=t,this.eventBoundary=new j(e),this.addEvents()}addEvents=()=>{this.canvasEle.addEventListener("pointermove",this.onPointerMove,!0),this.canvasEle.addEventListener("pointerleave",this.onPointerLeave,!0),this.canvasEle.addEventListener("pointerdown",this.onPointerDown,!0),this.canvasEle.addEventListener("pointerup",this.onPointerup,!0)};onPointerMove=t=>{this.bootstrapEvent(t),this.eventBoundary.fireEvent(this.rootEvent),this.setCursor()};onPointerLeave=()=>{this.eventBoundary.overTargets=[]};onPointerDown=t=>{this.bootstrapEvent(t),this.eventBoundary.fireEvent(this.rootEvent)};onPointerup=t=>{this.bootstrapEvent(t),this.eventBoundary.fireEvent(this.rootEvent)};bootstrapEvent=t=>{this.rootEvent.isTrusted=t.isTrusted,this.rootEvent.timeStamp=performance.now(),this.rootEvent.type=t.type.replace("pointer","mouse"),this.rootEvent.button=t.button,this.rootEvent.buttons=t.buttons,this.rootEvent.global.x=t.offsetX,this.rootEvent.global.y=t.offsetY};setCursor=()=>{this.canvasEle.style.cursor=this.eventBoundary.cursor}},z=class t{renderer;stage;view;animationFrameId;eventSystem;constructor(t){const{view:e=document.createElement("canvas")}=t;this.view=e,this.renderer=(t=>{const{prefer:e}=t;switch(e){case n.CANVAS:return new u(t);case n.WEB_GL:return new A(t);case n.WEB_GPU:return new S(t);default:return new u(t)}})({...t,view:e}),this.stage=new k,this.eventSystem=new Y(this.view,this.stage)}static async create(e){const s=new t(e);return await s.renderer.init(),s}render(){this.renderer.render(this.stage)}start(){const t=()=>{this.render(),this.animationFrameId=requestAnimationFrame(t)};t()}stop(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}},q=class extends o{points=[];closeStroke=!1;type=s.POLYGON;constructor(t=[]){super(),this.points=t}isIntersect(t,e,s,i,r,n){if(i>e&&n>e)return!1;if(i<e&&n<e)return!1;if(s<t&&r<t)return!1;if(s>t&&r>t)return!0;return r-(r-s)/(i-n)*(e-n)>t}contains(t){const e=this.points.length;let s=0;for(let h=2;h<=e-2;h+=2){const e=this.points[h-2],i=this.points[h-1],r=this.points[h],n=this.points[h+1];this.isIntersect(t.x,t.y,e,i,r,n)&&s++}const i=this.points[0],r=this.points[1],n=this.points[e-2],a=this.points[e-1];return this.isIntersect(t.x,t.y,i,r,n,a)&&s++,s%2!=0}},Z=class t{color="#ffffff";alpha=1;visible=!1;constructor(){this.reset()}clone(){const e=new t;return e.color=this.color,e.alpha=this.alpha,e.visible=this.visible,e}reset(){this.color="#ffffff",this.alpha=1,this.visible=!1}},$=class t extends Z{width=0;cap=i.BUTT;join=r.MITER;miterLimit=10;clone(){const e=new t;return e.color=this.color,e.alpha=this.alpha,e.visible=this.visible,e.width=this.width,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e}reset(){super.reset(),this.color="#ffffff",this.width=0,this.cap=i.BUTT,this.join=r.MITER,this.miterLimit=10}},X=class{shape;lineStyle;fillStyle;vertices=[];constructor(t,e,s){this.shape=t,this.lineStyle=s,this.fillStyle=e}},H=class{_oldLength=-1;_length=0;curMaxLen=16;float32=new Float32Array(16);_data;get length(){return this._length}concat(t){const e=this._length+t.length;for(;e>this.curMaxLen;)this.expandCapacity();for(let s=0;s<t.length;s++)this.float32[this._length]=t[s],this._length++}push(t){this._length>=this.curMaxLen&&this.expandCapacity(),this.float32[this._length]=t,this._length++}expandCapacity(){this.curMaxLen*=2;const t=new Float32Array(this.curMaxLen);t.set(this.float32),this.float32=t}get data(){return this._oldLength!==this._length&&(this._data=new Float32Array(this.float32.buffer,0,this._length),this._oldLength=this._length),this._data}clear(){this._length=0}},W=class{_oldLength=-1;_length=0;curMaxLen=8;int32=new Uint32Array(8);_data;get length(){return this._length}concat(t){const e=this.length+t.length;for(;e>this.curMaxLen;)this.expandCapacity();for(let s=0;s<t.length;s++)this.int32[this._length]=t[s],this._length++}concatUInt16(t){const e=this.length+t.length;for(;e>this.curMaxLen;)this.expandCapacity();this.int32.set(t,this._length),this._length=e}expandCapacity(){this.curMaxLen*=2;const t=new Uint32Array(this.curMaxLen);t.set(this.int32),this.int32=t}get data(){return this._oldLength!==this._length&&(this._data=new Uint32Array(this.int32.buffer,0,this._length),this._oldLength=this._length),this._data}clear(){this._length=0}},Q=/* @__PURE__ */new Set,J=!1;function K(t,e,s=2){const i=e&&e.length,r=i?e[0]*s:t.length;Q.size&&Q.clear();let n=tt(t,0,r,s,!0);const a=[];if(!n||n.next===n.prev)return a;let h=0,o=0,c=0;if(i&&(n=function(t,e,s,i){const r=[];for(let n=0,a=e.length;n<a;n++){const s=tt(t,e[n]*i,n<a-1?e[n+1]*i:t.length,i,!1);s===s.next&&Q.add(s),r.push(Et(s))}r.sort(ot),function(t,e){const s=Math.ceil((t+2*e)/lt)+e+2;ut.length<4*s&&(ut=new Float64Array(4*s));pt=0}(t.length/i,e.length),xt(s,s),ht=!0;for(let n=0;n<r.length;n++)s=ct(r[n],s);return ht=!1,et(s)}(t,e,n,s)),t.length>80*s){h=t[0],o=t[1];let e=h,i=o;for(let n=s;n<r;n+=s){const s=t[n],r=t[n+1];s<h&&(h=s),r<o&&(o=r),s>e&&(e=s),r>i&&(i=r)}c=Math.max(e-h,i-o),c=0!==c?32767/c:0}return st(n,a,h,o,c),a}function tt(t,e,s,i,r){let n=null;if(r===function(t,e,s,i){let r=0;for(let n=e,a=s-i;n<s;n+=i)r+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return r}(t,e,s,i)>0)for(let a=e;a<s;a+=i)n=Ft(a/i|0,t[a],t[a+1],n);else for(let a=s-i;a>=e;a-=i)n=Ft(a/i|0,t[a],t[a+1],n);return n&&St(n,n.next)&&(Nt(n),n=n.next),n}function et(t,e=t){const s=e===t;let i,r=t;do{i=!1,r===r.next||0!==Q.size&&Q.has(r)||!St(r,r.next)&&0!==At(r.prev,r,r.next)?(s||r!==e)&&(r=r.next,i=!s):((s||r===e)&&(e=r.prev),J=!0,Nt(r),r=r.prev,i=!0)}while(i||r!==e);return e}function st(t,e,s,i,r){r&&function(t,e,s,i){let r=t,n=0;do{r.z=_t(r.x,r.y,e,s,i),mt[n++]=r,r=r.next}while(r!==t);!function(t){if(t<=32){for(let e=1;e<t;e++){const t=mt[e],s=t.z;let i=e-1;for(;i>=0&&mt[i].z>s;)mt[i+1]=mt[i],i--;mt[i+1]=t}return}wt.length<t&&(wt=new Uint32Array(t),Mt=new Uint32Array(t),bt=new Array(t));for(let e=0;e<t;e++)wt[e]=mt[e].z;Tt(t,mt,wt,bt,Mt,0),Tt(t,bt,Mt,mt,wt,8),Tt(t,mt,wt,bt,Mt,16),Tt(t,bt,Mt,mt,wt,24)}(n);let a=null;for(let h=0;h<n;h++){const t=mt[h];t.prevZ=a,a&&(a.nextZ=t),a=t}a.nextZ=null}(t,s,i,r);let n=t,a=!1;for(;t.prev!==t.next;){const h=t.prev,o=t.next;if(At(h,t,o)<0&&(r?rt(t,s,i,r):it(t)))e.push(h.i,t.i,o.i),Nt(t),t=o,n=o;else if((t=o)===n){if(J=!1,t=et(t),J){n=t;continue}if(!a){n=t=nt(t,e),a=!0;continue}at(t,e,s,i,r);break}}}function it(t){const e=t.prev,s=t,i=t.next,r=e.x,n=s.x,a=i.x,h=e.y,o=s.y,c=i.y,l=Math.min(r,n,a),u=Math.min(h,o,c),p=Math.max(r,n,a),f=Math.max(h,o,c);let d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=p&&d.y>=u&&d.y<=f&&(r!==d.x||h!==d.y)&&Bt(r,h,n,o,a,c,d.x,d.y)&&At(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function rt(t,e,s,i){const r=t.prev,n=t,a=t.next,h=r.x,o=n.x,c=a.x,l=r.y,u=n.y,p=a.y,f=Math.min(h,o,c),d=Math.min(l,u,p),x=Math.max(h,o,c),g=Math.max(l,u,p),y=_t(f,d,e,s,i),v=_t(x,g,e,s,i);let m=t.prevZ;for(;m&&m.z>=y;){if(m.x>=f&&m.x<=x&&m.y>=d&&m.y<=g&&m!==a&&(h!==m.x||l!==m.y)&&Bt(h,l,o,u,c,p,m.x,m.y)&&At(m.prev,m,m.next)>=0)return!1;m=m.prevZ}let b=t.nextZ;for(;b&&b.z<=v;){if(b.x>=f&&b.x<=x&&b.y>=d&&b.y<=g&&b!==a&&(h!==b.x||l!==b.y)&&Bt(h,l,o,u,c,p,b.x,b.y)&&At(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function nt(t,e){let s=t,i=!1;do{const r=s.prev,n=s.next.next;Ct(r,s,s.next,n,!1)&&Rt(r,n)&&Rt(n,r)&&(e.push(r.i,s.i,n.i),Nt(s),Nt(s.next),s=t=n,i=!0),s=s.next}while(s!==t);return i?et(s):s}function at(t,e,s,i,r){let n=t;do{let t=n.next.next;for(;t!==n.prev;){if(n.i!==t.i&&It(n,t)){let a=Ut(n,t);return n=et(n,n.next),a=et(a,a.next),st(n,e,s,i,r),void st(a,e,s,i,r)}t=t.next}n=n.next}while(n!==t)}var ht=!1;function ot(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function ct(t,e){const s=function(t,e){let s=e;const i=t.x,r=t.y;let n,a=-1/0;if(St(t,s))return s;for(let p=0,f=0;p<pt;p++,f+=4){if(r<ut[f+1]||r>ut[f+3]||ut[f]>i||ut[f+2]<=a)continue;const e=gt(p);s=yt(p);do{if(s.prev.next===s){if(St(t,s.next))return s.next;if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){const t=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=i&&t>a&&(a=t,n=s.x<s.next.x?s:s.next,t===i))return n}}s=s.next}while(s!==e)}if(!n)return null;const h=n.x,o=n.y,c=Math.min(r,o),l=Math.max(r,o);let u=1/0;for(let p=0,f=0;p<pt;p++,f+=4){if(ut[f+2]<h||ut[f]>i||ut[f+3]<c||ut[f+1]>l)continue;const e=gt(p);s=yt(p);do{if(s.prev.next===s&&i>=s.x&&s.x>=h&&i!==s.x&&Bt(r<o?i:a,r,h,o,r<o?a:i,r,s.x,s.y)){const e=Math.abs(r-s.y)/(i-s.x);(Rt(s,t)||s.y===r&&s.next.y===r&&s.next.x>i)&&(e<u||e===u&&(s.x>n.x||s.x===n.x&&vt(n,s)))&&(n=s,u=e)}s=s.next}while(s!==e)}return n}(t,e);if(!s)return e;const i=Ut(s,t);return xt(s,i.next.next),et(i,i.next),et(s,s.next)}var lt=16,ut=/* @__PURE__ */new Float64Array(0),pt=0,ft=[],dt=[];function xt(t,e){let s=t;do{const t=pt++;ft[t]=s;let i=1/0,r=1/0,n=-1/0,a=-1/0,h=0;do{const e=s.next;s.z=t,s.x<i&&(i=s.x),s.x>n&&(n=s.x),s.y<r&&(r=s.y),s.y>a&&(a=s.y),e.x<i&&(i=e.x),e.x>n&&(n=e.x),e.y<r&&(r=e.y),e.y>a&&(a=e.y),s=e}while(++h<lt&&s!==e);dt[t]=s;const o=4*t;ut[o]=i,ut[o+1]=r,ut[o+2]=n,ut[o+3]=a}while(s!==e)}function gt(t){let e=dt[t];for(;e.prev.next!==e;)e=e.next;return dt[t]=e,e}function yt(t){let e=ft[t];for(;e.prev.next!==e;)e=e.next;return ft[t]=e,e}function vt(t,e){return At(t.prev,t,e.prev)<0&&At(e.next,t,t.next)<0}var mt=[],bt=[],wt=/* @__PURE__ */new Uint32Array(0),Mt=/* @__PURE__ */new Uint32Array(0),Pt=/* @__PURE__ */new Uint32Array(256);function Tt(t,e,s,i,r,n){Pt.fill(0);for(let h=0;h<t;h++)Pt[s[h]>>>n&255]++;let a=0;for(let h=0;h<256;h++){const t=Pt[h];Pt[h]=a,a+=t}for(let h=0;h<t;h++){const t=s[h],a=Pt[t>>>n&255]++;i[a]=e[h],r[a]=t}}function _t(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Et(t){let e=t,s=t;do{(e.x<s.x||e.x===s.x&&e.y<s.y)&&(s=e),e=e.next}while(e!==t);return s}function Bt(t,e,s,i,r,n,a,h){return(r-a)*(e-h)>=(t-a)*(n-h)&&(t-a)*(i-h)>=(s-a)*(e-h)&&(s-a)*(n-h)>=(r-a)*(i-h)}function It(t,e){const s=St(t,e)&&At(t.prev,t,t.next)>0&&At(e.prev,e,e.next)>0;return t.next.i!==e.i&&(s||Rt(t,e)&&Rt(e,t)&&(0!==At(t.prev,t,e.prev)||0!==At(t,e.prev,e)))&&!function(t,e){const s=Math.min(t.x,e.x),i=Math.max(t.x,e.x),r=Math.min(t.y,e.y),n=Math.max(t.y,e.y);let a=t;do{const h=a.next;if(a.x>i&&h.x>i||a.x<s&&h.x<s||a.y>n&&h.y>n||a.y<r&&h.y<r)a=h;else{if(a.i!==t.i&&h.i!==t.i&&a.i!==e.i&&h.i!==e.i&&Ct(a,h,t,e))return!0;a=h}}while(a!==t);return!1}(t,e)&&(s||function(t,e){let s=t,i=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{const t=s.next;s.y>n!=t.y>n&&r<(t.x-s.x)*(n-s.y)/(t.y-s.y)+s.x&&(i=!i),s=t}while(s!==t);return i}(t,e))}function At(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function St(t,e){return t.x===e.x&&t.y===e.y}function Ct(t,e,s,i,r=!0){const n=At(t,e,s),a=At(t,e,i),h=At(s,i,t),o=At(s,i,e);return(n>0&&a<0||n<0&&a>0)&&(h>0&&o<0||h<0&&o>0)||!!r&&(!(0!==n||!Lt(t,s,e))||(!(0!==a||!Lt(t,i,e))||(!(0!==h||!Lt(s,t,i))||!(0!==o||!Lt(s,e,i)))))}function Lt(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function Rt(t,e){return At(t.prev,t,t.next)<0?At(t,e,t.next)>=0&&At(t,t.prev,e)>=0:At(t,e,t.prev)<0||At(t,t.next,e)<0}function Ut(t,e){const s=Vt(t.i,t.x,t.y),i=Vt(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}function Ft(t,e,s,i){const r=Vt(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Nt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),ht&&function(t,e){const s=4*t.z;e.x<ut[s]&&(ut[s]=e.x),e.y<ut[s+1]&&(ut[s+1]=e.y),e.x>ut[s+2]&&(ut[s+2]=e.x),e.y>ut[s+3]&&(ut[s+3]=e.y)}(t.prev,t.next)}function Vt(t,e,s){return{i:t,x:e,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null}}var Dt=class extends o{x;y;radius;type=s.CIRCLE;constructor(t=0,e=0,s=0){super(),this.x=t,this.y=e,this.radius=s}contains(t){return(t.x-this.x)*(t.x-this.x)+(t.y-this.y)*(t.y-this.y)<this.radius*this.radius}},kt=class extends o{x;y;radiusX;radiusY;type=s.ELLIPSE;constructor(t=0,e=0,s=0,i=0){super(),this.x=t,this.y=e,this.radiusX=s,this.radiusY=i}contains(t){return(t.x-this.x)*(t.x-this.x)/(this.radiusX*this.radiusX)+(t.y-this.y)*(t.y-this.y)/(this.radiusY*this.radiusY)<1}},Ot=class extends o{x;y;width;height;radius;type=s.ROUNDED_RECTANGLE;constructor(t=0,e=0,s=0,i=0,r=20){super(),this.x=t,this.y=e,this.width=s,this.height=i;const n=Math.min(s,i)/2;this.radius=r>n?n:r}contains(t){if(!(t.x>this.x&&t.x<this.x+this.width&&t.y>this.y&&t.y<this.y+this.height))return!1;const e=this.x+this.radius,s=this.y+this.radius;if(t.x<e&&t.y<s)return(t.x-e)*(t.x-e)+(t.y-s)*(t.y-s)<this.radius*this.radius;const i=this.x+this.radius,r=this.y+this.height-this.radius;if(t.x<i&&t.y>r)return(t.x-i)*(t.x-i)+(t.y-r)*(t.y-r)<this.radius*this.radius;const n=this.x+this.width-this.radius,a=this.y+this.radius;if(t.x>n&&t.y<a)return(t.x-n)*(t.x-n)+(t.y-a)*(t.y-a)<this.radius*this.radius;const h=this.x+this.width-this.radius,o=this.y+this.height-this.radius;return!(t.x>h&&t.y<o)||(t.x-h)*(t.x-h)+(t.y-o)*(t.y-o)<this.radius*this.radius}},Gt=t=>{const{shape:e,vertices:s}=t;if(e instanceof c){const{x:t,y:i,width:r,height:n}=e;s.push(t,i,t+r,i,t+r,i+n,t,i+n)}e instanceof Dt&&((t,e)=>{const{x:s,y:i,radius:r}=t,n=2*Math.PI*r,a=Math.min(Math.ceil(n/5),2048);for(let h=0;h<a;h++){const t=h/a*Math.PI*2,n=s+r*Math.cos(t),o=i+r*Math.sin(t);e.vertices.push(n,o)}})(e,t),e instanceof Ot&&((t,e)=>{const{x:s,y:i,width:r,height:n,radius:a}=t,h=2*Math.PI*a/4,o=Math.min(Math.ceil(h/4),2048);for(let c=0;c<o;c++){const t=c/o*Math.PI*.5,h=a*Math.cos(t),l=a*Math.sin(t);e.vertices.push(s+r-a+h,i+n-a+l)}for(let c=0;c<o;c++){const t=c/o*Math.PI*.5+Math.PI/2,r=a*Math.cos(t),h=a*Math.sin(t);e.vertices.push(s+a+r,i+n-a+h)}for(let c=0;c<o;c++){const t=c/o*Math.PI*.5+Math.PI,r=a*Math.cos(t),n=a*Math.sin(t);e.vertices.push(s+a+r,i+a+n)}for(let c=0;c<o;c++){const t=c/o*Math.PI*.5+1.5*Math.PI,n=a*Math.cos(t),h=a*Math.sin(t);e.vertices.push(s+r-a+n,i+a+h)}})(e,t),e instanceof kt&&((t,e)=>{const{x:s,y:i,radiusX:r,radiusY:n}=t,a=Math.PI*Math.sqrt(2*(r*r+n*n)),h=Math.min(Math.ceil(a/5),2048);for(let o=0;o<h;o++){const t=o/h*Math.PI*2,a=s+r*Math.cos(t),c=i+n*Math.sin(t);e.vertices.push(a,c)}})(e,t),e instanceof q&&(t.vertices=e.points)},jt=t=>{const e=[],s=t.length/2+1;for(let i=1;i<s-1;i++)e.push(0,i,i+1);return e.push(0,s-1,1),e},Yt=(t,e)=>{const{shape:s,vertices:i,fillStyle:r}=t,n=new x(r);if(e.batchParts.push(n),n.start(e.vertices.length/2,e.indices.length),s instanceof c&&(e.vertices.concat(i),e.indices.concat([0,1,2,0,2,3]),n.end(4,6)),s instanceof Dt){const{x:t,y:r}=s;e.vertices.push(t),e.vertices.push(r),e.vertices.concat(i);const a=jt(i);e.indices.concat(a),n.end(i.length/2+1,a.length)}if(s instanceof Ot){const{x:t,y:r,width:a,height:h}=s;e.vertices.push(t+a/2),e.vertices.push(r+h/2),e.vertices.concat(i);const o=jt(i);e.indices.concat(o),n.end(i.length/2+1,o.length)}if(s instanceof kt){const{x:t,y:r}=s;e.vertices.push(t),e.vertices.push(r),e.vertices.concat(i);const a=jt(i);e.indices.concat(a),n.end(i.length/2+1,a.length)}if(s instanceof q){e.vertices.concat(i);const t=K(i);e.indices.concat(t),n.end(i.length/2,t.length)}},zt=(t,e,s,i,r,n,a,h)=>{let o=0,c=0,l=0,u=0,p=0,f=0;if(Math.abs(s-t)<=Number.EPSILON)o=1,c=0,p=s;else{const r=(i-e)/(s-t);o=r,c=-1,p=-(i-r*s)}if(Math.abs(a-r)<=Number.EPSILON)l=1,u=0,f=a;else{const t=(h-n)/(a-r);l=t,u=-1,f=-(h-t*a)}return[(p*u-c*f)/(o*u-c*l),(o*f-p*l)/(o*u-c*l)]},qt=(t,e,s)=>{const i=e,r=-t,n=s/2/Math.sqrt(t*t+e*e);return[i*n,r*n]},Zt=(t,e,s,i,r,n,a,h)=>{const o=s-t,c=i-e,l=r-t,u=n-e;let p=0;p=0===o?c>0?.5*Math.PI:1.5*Math.PI:0===c?o>0?0:Math.PI:o>=0&&c>=0?Math.atan(c/o):o<=0&&c>=0?Math.atan(-o/c)+.5*Math.PI:o<=0&&c<=0?Math.atan(c/o)+Math.PI:Math.atan(o/-c)+1.5*Math.PI;let f=0;f=0===l?u>0?.5*Math.PI:1.5*Math.PI:0===u?l>0?0:Math.PI:l>=0&&u>=0?Math.atan(u/l):l<=0&&u>=0?Math.atan(-l/u)+.5*Math.PI:l<=0&&u<=0?Math.atan(u/l)+Math.PI:Math.atan(l/-u)+1.5*Math.PI,p>f&&(p-=2*Math.PI);const d=Math.sqrt((s-t)*(s-t)+(i-e)*(i-e)),x=2*Math.PI*d/3,g=a.length/2;a.push(t,e,s,i);for(let y=1;y<x;y++){const s=p+y/x*(f-p),i=t+d*Math.cos(s),r=e+d*Math.sin(s);a.push(i,r)}a.push(r,n);for(let y=1;y<a.length/2-g-1;y++)h.push(0+g,y+g,y+1+g)},$t=(t,e)=>{const{vertices:s,shape:n,lineStyle:a}=t,{width:h,cap:o,join:c,miterLimit:l}=a;let u=0,p=!1;if(n instanceof q?n.closeStroke&&(p=!0):p=!0,p){const t=s[0],e=s[1],i=s[s.length-2],r=s[s.length-1];Math.abs(t-i)<1e-4&&Math.abs(e-r)<1e-4&&(s.pop(),s.pop());const n=(t+s[s.length-2])/2,a=(e+s[s.length-1])/2;s.unshift(n,a),s.push(n,a)}const f=new x(a);e.batchParts.push(f),f.start(e.vertices.length/2,e.indices.length);const d=[],g=[],y=s[0],v=s[1],m=s[2],b=s[3],[w,M]=qt(m-y,b-v,h);if(!p){if(o===i.SQUARE){const t=M,e=-w;d.push(y+w,v+M,y+w+t,v+M+e,y-w+t,v-M+e,y-w,v-M),g.push(0,1,2,0,2,3)}o===i.ROUND&&Zt(y,v,y-w,v-M,y+w,v+M,d,g),i.BUTT}u=d.length/2,d.push(y-w,v-M,y+w,v+M);for(let i=2;i<s.length-2;i+=2){const t=s[i-2],e=s[i-1],n=s[i],a=s[i+1],o=s[i+2],p=s[i+3],[f,x]=qt(n-t,a-e,h),[y,v]=qt(o-n,p-a,h),m=n-t,b=a-e,w=o-n,M=p-a,P=w*b-m*M,T=m*w+b*M;if(Math.abs(P)<.001*Math.abs(T)){d.push(n+f,a+x,n-f,a-x),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,T>0?d.push(n-f,a-x,n+f,a+x):(c===r.ROUND&&(Zt(n,a,n+f,a+x,n-f,a-x,d,g),u=d.length/2),c===r.BEVEL||r.MITER,d.push(n+f,a+x,n-f,a-x));continue}const[_,E]=zt(t+f,e+x,n+f,a+x,n+y,a+v,o+y,p+v),[B,I]=zt(t-f,e-x,n-f,a-x,n-y,a-v,o-y,p-v);let A=c;c===r.MITER&&(((B-_)**2+(I-E)**2)/h**2<=l**2||(A=r.BEVEL));const S=m*m+b*b+(h/2)**2,C=w*w+M*M+(h/2)**2;(B-n)**2+(I-a)**2<Math.min(S,C)?(A===r.BEVEL&&(P>0?(d.push(_,E,n-f,a-x),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(_,E,n-f,a-x,n-y,a-v),g.push(0+u,1+u,2+u),u=d.length/2,d.push(n-y,a-v,_,E)):(d.push(n+f,a+x,B,I),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(B,I,n+f,a+x,n+y,a+v),g.push(0+u,1+u,2+u),u=d.length/2,d.push(B,I,n+y,a+v))),A===r.MITER&&(d.push(_,E,B,I),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(B,I,_,E)),A===r.ROUND&&(P<0?(d.push(n+f,a+x,B,I),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(B,I,n+f,a+x,n,a),g.push(0+u,1+u,2+u),u=d.length/2,d.push(B,I,n+y,a+v,n,a),g.push(0+u,1+u,2+u),u=d.length/2,Zt(n,a,n+f,a+x,n+y,a+v,d,g),u=d.length/2,d.push(B,I,n+y,a+v)):(d.push(_,E,n-f,a-x),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(_,E,n-f,a-x,n,a),g.push(0+u,1+u,2+u),u=d.length/2,d.push(_,E,n-y,a-v,n,a),g.push(0+u,1+u,2+u),u=d.length/2,Zt(n,a,n-y,a-v,n-f,a-x,d,g),u=d.length/2,d.push(n-y,a-v,_,E)))):(d.push(n+f,a+x,n-f,a-x),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,A===r.BEVEL&&(P>0?(d.push(n,a,n-f,a-x,n-y,a-v),g.push(0+u,1+u,2+u)):(d.push(n,a,n+f,a+x,n+y,a+v),g.push(0+u,1+u,2+u))),A===r.MITER&&(P>0?(d.push(n,a,n-f,a-x,B,I,n-y,a-v),g.push(0+u,1+u,2+u,0+u,2+u,3+u)):(d.push(n,a,n+f,a+x,_,E,n+y,a+v),g.push(0+u,1+u,2+u,0+u,2+u,3+u))),A===r.ROUND&&(P>0?Zt(n,a,n-y,a-v,n-f,a-x,d,g):Zt(n,a,n+f,a+x,n+y,a+v,d,g)),u=d.length/2,d.push(n-y,a-v,n+y,a+v))}const P=s[s.length-2],T=s[s.length-1],_=s[s.length-4],E=s[s.length-3],[B,I]=qt(P-_,T-E,h);if(d.push(P+B,T+I,P-B,T-I),g.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,!p){const t=s[s.length-2],e=s[s.length-1],r=s[s.length-4],n=s[s.length-3],[a,c]=qt(t-r,e-n,h);if(o===i.SQUARE){const s=-c,i=a;d.push(t+a,e+c,t+a+s,e+c+i,t-a+s,e-c+i,t-a,e-c),g.push(0+u,1+u,2+u,0+u,2+u,3+u)}o===i.ROUND&&Zt(t,e,t+a,e+c,t-a,e-c,d,g)}e.vertices.concat(d),e.indices.concat(g),f.end(d.length/2,g.length)},Xt=class{graphicsData=[];dirty=!1;shapeIndex=0;batchParts=[];vertices=new H;indices=new W;drawShape(t,e,s){const i=new X(t,e,s);this.graphicsData.push(i),this.dirty=!0}containsPoint(t){for(let e=0;e<this.graphicsData.length;e++){const{shape:s,fillStyle:i}=this.graphicsData[e];if(i.visible&&s.contains(t))return!0}return!1}buildVerticesAndTriangulate(){if(this.dirty){this.dirty=!1;for(let t=this.shapeIndex;t<this.graphicsData.length;t++){const e=this.graphicsData[t];Gt(e),e.fillStyle.visible&&Yt(e,this),e.lineStyle.visible&&$t(e,this)}this.shapeIndex=this.graphicsData.length}}clear(){this.graphicsData=[],this.vertices.clear(),this.indices.clear(),this.batchParts=[],this.shapeIndex=0,this.dirty=!1}},Ht=class extends k{_lineStyle=new $;_fillStyle=new Z;geometry=new Xt;currentPath=new q;type;constructor(){super(),this.type="graphics"}lineStyle(t,e="#000000",s=1){if(this.startPoly(),"object"==typeof t)Object.assign(this._lineStyle,t);else{const i={width:t,color:e,alpha:s};Object.assign(this._lineStyle,i)}return this._lineStyle.visible=!0,this}resetLineStyle=()=>{this._lineStyle.reset()};drawShape=t=>(this.geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone()),this.markStructureDirty(),this);startPoly=()=>{this.currentPath.points.length>2&&this.drawShape(this.currentPath),this.currentPath=new q};beginFill=(t="#000000",e=1)=>(this.startPoly(),this._fillStyle.color=t,this._fillStyle.alpha=e,this._fillStyle.alpha>0&&(this._fillStyle.visible=!0),this);endFill=()=>(this.startPoly(),this._fillStyle.reset(),this);drawRect=(t,e,s,i)=>this.drawShape(new c(t,e,s,i));drawCircle=(t,e,s)=>this.drawShape(new Dt(t,e,s));drawRoundedRect=(t,e,s,i,r)=>this.drawShape(new Ot(t,e,s,i,r));drawEllipse=(t,e,s,i)=>this.drawShape(new kt(t,e,s,i));drawPolygon=t=>{const e=new q(t);return e.closeStroke=!0,this.drawShape(e)};moveTo=(t,e)=>(this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this);lineTo=(t,e)=>{if(0===this.currentPath.points.length)return this.moveTo(t,e),this;const s=this.currentPath.points,i=s[s.length-2],r=s[s.length-1];return i===t&&r===e||s.push(t,e),this};closePath=()=>(this.currentPath.closeStroke=!0,this.startPoly(),this);containsPoint=t=>this.hitArea?this.hitArea.contains(t):this.geometry.containsPoint(t);quadraticCurveTo=(t,e,s,i)=>{const r=this.currentPath.points.length;0===r&&(this.currentPath.points=[0,0]);const n=this.currentPath.points[r-2],a=this.currentPath.points[r-1],h=t,o=e,c=s,l=i,u=((t,e,s,i,r,n)=>{const a=2*(t-2*s+r),h=-2*(t-s),o=2*(e-2*i+n),c=-2*(e-i),l=a*a+o*o,u=2*(a*h+o*c),p=h*h+c*c,f=Math.sqrt((4*l*p-u*u)/4),d=(l/2+u/4)*Math.sqrt((l+u/2)*(l+u/2)+f*f)+f*f/2*Math.log(Math.abs(l+u/2+Math.sqrt((l+u/2)*(l+u/2)+f*f))),x=u/4*Math.sqrt(u*u/4+f*f)+f*f/2*Math.log(u/2+Math.sqrt(u*u/4+f*f));return 1/(Math.sqrt(l)*l)*(d-x)})(n,a,h,o,c,l);let p=Math.ceil(u/10);p>2048&&(p=2048),p<8&&(p=8);for(let f=1;f<=p;f++){const t=f/p,e=(1-t)*(1-t)*n+2*t*(1-t)*h+t*t*c,s=(1-t)*(1-t)*a+2*t*(1-t)*o+t*t*l;this.currentPath.points.push(e,s)}return this};bezierCurveTo=(t,e,s,i,r,n)=>{const a=this.currentPath.points.length;0===a&&(this.currentPath.points=[0,0]);const h=this.currentPath.points[a-2],o=this.currentPath.points[a-1],c=t,l=e,u=s,p=i,f=r,d=n,x=((t,e,s,i,r,n,a,h)=>{let o=t,c=e,l=0;for(let u=1;u<=10;u++){const p=u/10,f=(1-p)*(1-p)*(1-p)*t+3*p*(1-p)*(1-p)*s+3*p*p*(1-p)*r+p*p*p*a,d=(1-p)*(1-p)*(1-p)*e+3*p*(1-p)*(1-p)*i+3*p*p*(1-p)*n+p*p*p*h,x=f-o,g=d-c;l+=Math.sqrt(x*x+g*g),o=f,c=d}return l})(h,o,c,l,u,p,f,d);let g=Math.ceil(x/10);g>2048&&(g=2048),g<8&&(g=8);for(let y=1;y<=g;y++){const t=y/g,e=(1-t)*(1-t)*(1-t)*h+3*t*(1-t)*(1-t)*c+3*t*t*(1-t)*u+t*t*t*f,s=(1-t)*(1-t)*(1-t)*o+3*t*(1-t)*(1-t)*l+3*t*t*(1-t)*p+t*t*t*d;this.currentPath.points.push(e,s)}return this};arc=(t,e,s,i,r,n=!1)=>{if(!n){for(;r<i;)r+=2*Math.PI;r-i>2*Math.PI&&(r=i+2*Math.PI)}if(n){for(;r>i;)i+=2*Math.PI;i-r>2*Math.PI&&(r=i-2*Math.PI)}const a=r-i;if(0===a)return this;const h=t+Math.cos(i)*s,o=e+Math.sin(i)*s;this.lineTo(h,o);const c=Math.abs(a)*s;let l=Math.ceil(c/10);l>2048&&(l=2048),l<8&&(l=8);for(let u=1;u<=l;u++){const r=i+a*(u/l),n=t+Math.cos(r)*s,h=e+Math.sin(r)*s;this.lineTo(n,h)}return this};arcTo=(t,e,s,i,r)=>{if(!this.currentPath)return this;const n=this.currentPath.points.length;if(0===n||0===r)return this.lineTo(t,e),this;const a=this.currentPath.points[n-1]-e,h=this.currentPath.points[n-2]-t,o=i-e,c=s-t,l=a*c-h*o,u=Math.abs(l);if(u<1e-8)return this.lineTo(t,e),this;const p=a*a+h*h,f=o*o+c*c,d=a*o+h*c,x=r*Math.sqrt(p)/u,g=r*Math.sqrt(f)/u,y=x*d/p,v=g*d/f,m=x*c+g*h,b=x*o+g*a,w=h*(g+y),M=a*(g+y),P=c*(x+v),T=o*(x+v),_=Math.atan2(M-b,w-m),E=Math.atan2(T-b,P-m),B=h*o>c*a;return this.arc(m+t,b+e,r,_,E,B)};clear=()=>(this.geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this.currentPath=new q,this.batches=[],this.batchCount=0,this.markStructureDirty(),this);renderCanvas=t=>{this.startPoly();const e=t.ctx,{a:s,b:i,c:r,d:n,tx:a,ty:h}=this.transform.worldTransform;e.setTransform(s,i,r,n,a,h);const o=this.geometry.graphicsData;for(let l=0;l<o.length;l++){const{lineStyle:t,fillStyle:s,shape:i}=o[l];if(s.visible&&(e.fillStyle=s.color),t.visible&&(e.lineWidth=t.width,e.lineCap=t.cap,e.lineJoin=t.join,e.strokeStyle=t.color),e.beginPath(),i instanceof c){const{x:r,y:n,width:a,height:h}=i;s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fillRect(r,n,a,h)),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.strokeRect(r,n,a,h))}if(i instanceof Dt){const{x:r,y:n,radius:a}=i;e.arc(r,n,a,0,2*Math.PI),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}if(i instanceof Ot){const{x:r,y:n,width:a,height:h,radius:o}=i;e.moveTo(r+o,n),e.arc(r+o,n+o,o,1.5*Math.PI,Math.PI,!0),e.lineTo(r,n+h-o),e.arc(r+o,n+h-o,o,Math.PI,Math.PI/2,!0),e.lineTo(r+a-o,n+h),e.arc(r+a-o,n+h-o,o,Math.PI/2,0,!0),e.lineTo(r+a,n+o),e.arc(r+a-o,n+o,o,0,1.5*Math.PI,!0),e.closePath(),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}if(i instanceof kt){const{x:r,y:n,radiusX:a,radiusY:h}=i;e.ellipse(r,n,a,h,0,0,2*Math.PI),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}if(i instanceof q){const{points:r,closeStroke:n}=i;e.moveTo(r[0],r[1]);for(let t=2;t<r.length;t+=2)e.lineTo(r[t],r[t+1]);n&&e.closePath(),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}}};buildBatches=t=>{this.startPoly(),this.worldId=this.transform.worldId,this.geometry.buildVerticesAndTriangulate();const e=this.geometry.batchParts;for(let s=0;s<e.length;s++){const{style:i,vertexStart:r,vertexCount:n,indexStart:a,indexCount:h}=e[s],{color:o,alpha:c}=i,l=B(o,c*this.worldAlpha),u=m.get(this.type);u.vertexCount=n,u.indexCount=h,u.rgba=l,u.vertexOffset=r,u.indexOffset=a,u.graphics=this,this.batches[s]=u,t.addBatch(this.batches[s])}this.batchCount=e.length};updateBatches=t=>{if(this.worldId!==this.transform.worldId){this.worldId=this.transform.worldId;for(let e=0;e<this.batchCount;e++)this.batches[e].updateVertices(t)}}};export{z as Application,h as BYTES_PER_VERTEX,k as Container,Ht as Graphics,i as LINE_CAP,r as LINE_JOIN,a as MAX_VERTEX_COUNT,n as RENDERER_TYPE,s as SHAPE_TYPE};
|
|
1
|
+
import{i as t,n as e,r as s,t as i}from"../../../enums-BAgbyGdH.js";var r,n=/* @__PURE__ */function(t){return t.RECTANGLE="rectangle",t.POLYGON="polygon",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.ROUNDED_RECTANGLE="rounded rectangle",t}({}),a=/* @__PURE__ */function(t){return t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t}({}),h=/* @__PURE__ */function(t){return t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t}({}),o=/* @__PURE__ */function(t){return t.WEB_GL="webgl",t.CANVAS="canvas",t.WEB_GPU="webgpu",t}({}),c=65536,l=12,u=class{},p=class extends u{x;y;width;height;type=n.RECTANGLE;constructor(t=0,e=0,s=0,i=0){super(),this.x=t,this.y=e,this.width=s,this.height=i}contains(t){return t.x>this.x&&t.x<this.x+this.width&&t.y>this.y&&t.y<this.y+this.height}},f=class{canvasEle;screen=new p;constructor(t){const{view:e}=t;this.canvasEle=e,this.screen.width=e.width,this.screen.height=e.height}resizeView(t,e){this.canvasEle.width=t,this.canvasEle.height=e}async init(){return Promise.resolve()}},d=class extends f{ctx;backgroundColor;backgroundAlpha;constructor(t){super(t),t.debug;const{backgroundColor:e,backgroundAlpha:s}=t;this.backgroundColor=e,this.backgroundAlpha=s,this.ctx=this.canvasEle.getContext("2d")}render(t){t.updateTransform(),this.ctx.save(),this.ctx.clearRect(0,0,this.screen.width,this.screen.height),this.backgroundAlpha&&(this.ctx.globalAlpha=this.backgroundAlpha),this.backgroundColor&&(this.ctx.fillStyle=this.backgroundColor),this.ctx.fillRect(0,0,this.screen.width,this.screen.height),t.renderCanvasRecursive(this),this.ctx.restore()}},x=(t,e)=>{if(e.worldAlpha<=0||!e.visible)return;e.buildBatches(t);const s=e.children;for(let i=0;i<s.length;i++)x(t,s[i])},g=(t,e)=>{if(e.worldAlpha<=0||!e.visible)return;e.updateBatches(t);const s=e.children;for(let i=0;i<s.length;i++)g(t,s[i])},y=class{vertexCount=0;indexCount=0;rgba=0;vertexStart=0;indexStart=0},v=class{style;vertexStart=0;indexStart=0;vertexCount=0;indexCount=0;constructor(t){this.style=t}start(t,e){this.vertexStart=t,this.indexStart=e}end(t,e){this.vertexCount=t,this.indexCount=e}},m=class{idx=0;reset(){this.idx=0}},b=class extends m{batches=[];constructor(){super()}getOne(){return this.batches[this.idx]||(this.batches[this.idx]=new w),this.batches[this.idx++]}},w=class extends y{vertexOffset=0;indexOffset=0;graphics;packVertices(t,e){const s=this.graphics.geometry.vertices.data,i=this.vertexOffset;for(let r=0;r<this.vertexCount;r++){const n=s[2*(i+r)],a=s[2*(i+r)+1],{a:h,b:o,c:c,d:l,tx:u,ty:p}=this.graphics.worldTransform,f=h*n+c*a+u,d=o*n+l*a+p,x=3*(this.vertexStart+r);t[x]=f,t[x+1]=d,e[x+2]=this.rgba}}packIndices(t){const e=this.graphics.geometry.indices.data,s=this.indexOffset;for(let i=0;i<this.indexCount;i++)t[this.indexStart+i]=e[i+s]+this.vertexStart}updateVertices(t){const e=this.graphics.geometry.vertices.data,s=this.vertexOffset,{a:i,b:r,c:n,d:a,tx:h,ty:o}=this.graphics.worldTransform;for(let c=0;c<this.vertexCount;c++){const l=e[2*(s+c)],u=e[2*(s+c)+1],p=3*(this.vertexStart+c);t[p]=i*l+n*u+h,t[p+1]=r*l+a*u+o}}},M=new class{batchesMap={graphics:new b};get(t){return this.batchesMap[t].getOne()}reset(){Object.values(this.batchesMap).forEach(t=>{t.reset()})}},P=class extends f{builtVersion=-1;vertexCount=0;indexCount=0;batches=[];batchesCount=0;vertFloatView;vertIntView;indexBuffer;curVertBufferLength=0;curIndexBufferLength=0;constructor(t){super(t);const e=/* @__PURE__ */new ArrayBuffer(3072);this.vertFloatView=new Float32Array(e),this.vertIntView=new Uint32Array(e),this.indexBuffer=/* @__PURE__ */new Uint32Array(256)}addBatch(t){t.vertexStart=this.vertexCount,t.indexStart=this.indexCount,this.vertexCount+=t.vertexCount,this.indexCount+=t.indexCount,this.batches[this.batchesCount]=t,this.batchesCount++}startBuild(){this.vertexCount=0,this.indexCount=0,this.batchesCount=0,M.reset()}buildEnd(){this.resizeBufferIfNeeded(),this.packData()}resizeBufferIfNeeded(){if(12*this.vertexCount>this.vertFloatView.byteLength){const t=new ArrayBuffer(12*this.vertexCount);this.vertFloatView=new Float32Array(t),this.vertIntView=new Uint32Array(t)}this.indexCount>this.indexBuffer.length&&(this.indexBuffer=new Uint32Array(this.indexCount))}packData(){for(let t=0;t<this.batchesCount;t++){const e=this.batches[t];this.batches[t]=void 0,e?.packVertices(this.vertFloatView,this.vertIntView),e?.packIndices(this.indexBuffer)}}updateChildrenTransform(t){t.sortChildren();const e=t.transform.shouldUpdateLocalTransform;if(t.transform.updateLocalTransform(),e){const{a:e,b:s,c:i,d:r,tx:n,ty:a}=t.transform.localTransform;this.setRootTransform(e,s,i,r,n,a)}t.worldAlpha=t.alpha;const s=t.children;for(let i=0;i<s.length;i++)s[i].updateTransform()}render(t){this.updateChildrenTransform(t),this.builtVersion!==t.structureVersion?(this.startBuild(),x(this,t),this.buildEnd(),this.builtVersion=t.structureVersion):g(this.vertFloatView,t),this.updateBuffer(),this.draw()}},T="\nprecision highp float;\nattribute vec2 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\nuniform mat3 u_root_transform;\nuniform mat3 u_projection_matrix;\nvoid main(){\n v_color = a_color;\n gl_Position = vec4((u_projection_matrix * u_root_transform * vec3(a_position, 1.0)).xy, 0.0, 1.0);\n}\n".trim(),_="\nprecision mediump float;\nvarying vec4 v_color;\nvoid main(){\n gl_FragColor = v_color;\n}\n".trim(),E=(t,e,s)=>{const i=t.createShader(e);if(t.shaderSource(i,s),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS))return i;{const e=t.getShaderInfoLog(i);throw t.deleteShader(i),console.error(`shader compilation failed: ${e}`),new Error(`shader compilation failed: ${e}`)}},B=t=>{const e=t.gl,s=((t,e,s)=>{const i=t.createProgram();if(!i)throw console.error("failed to create the program"),new Error("failed to create the program");if(t.attachShader(i,e),t.attachShader(i,s),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)){const r=t.getProgramInfoLog(i);throw console.error(`link failed: ${r}`),t.deleteProgram(i),t.deleteShader(e),t.deleteShader(s),new Error(`link failed: ${r}`)}return t.useProgram(i),i})(e,E(e,e.VERTEX_SHADER,T),E(e,e.FRAGMENT_SHADER,_));return e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),s},A=/* @__PURE__ */new Map,I=t=>{const e=A.get(t);if(e)return e;let s;if(/^#?[0-9a-fA-F]{3}$/.test(t)){const e=t.replace("#","");s=[parseInt(e[0]+e[0],16),parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16)]}else if(/^#?[0-9a-fA-F]{6}$/.test(t)){const e=parseInt(t.replace("#",""),16);s=[e>>16&255,e>>8&255,255&e]}else s=(t=>{if(void 0===r&&(r="undefined"!=typeof document?document.createElement("canvas").getContext("2d"):null),!r)return[0,0,0];r.fillStyle="#000",r.fillStyle=t,r.fillRect(0,0,1,1);const[e,s,i]=r.getImageData(0,0,1,1).data;return[e,s,i]})(t);return A.set(t,s),s},S=(t,e)=>{const[s,i,r]=I(t).map(t=>Math.round(t*e));let n=0;return n+=Math.round(255*e)<<24,n+=r<<16,n+=i<<8,n+=s,n},C=t=>{const[e,s,i]=I(t);return[e/255,s/255,i/255]},L=class extends P{gl;program;glVertexBuffer;glIndexBuffer;unifLoc;constructor(t){super(t),t.debug,this.gl=this.canvasEle.getContext("webgl",{antialias:!0}),this.gl.getExtension("OES_element_index_uint"),this.program=B(this),this.glVertexBuffer=this.gl.createBuffer(),this.glIndexBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.glVertexBuffer),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.glIndexBuffer),((t,e)=>{const s=t.getAttribLocation(e,"a_position");t.vertexAttribPointer(s,2,t.FLOAT,!1,12,0),t.enableVertexAttribArray(s);const i=t.getAttribLocation(e,"a_color");t.vertexAttribPointer(i,4,t.UNSIGNED_BYTE,!0,12,8),t.enableVertexAttribArray(i)})(this.gl,this.program),this.unifLoc={u_root_transform:this.gl.getUniformLocation(this.program,"u_root_transform"),u_projection_matrix:this.gl.getUniformLocation(this.program,"u_projection_matrix")};const e=t.backgroundAlpha??0,[s,i,r]=C(t.backgroundColor??"");this.gl.clearColor(s*e,i*e,r*e,e),this.setRootTransform(1,0,0,1,0,0),this.setProjectionMatrix()}setProjectionMatrix(){const t=1/this.canvasEle.width*2,e=1/this.canvasEle.height*2;this.gl.uniformMatrix3fv(this.unifLoc.u_projection_matrix,!1,new Float32Array([t,0,0,0,-e,0,-1,1,1]))}setRootTransform(t,e,s,i,r,n){this.gl.uniformMatrix3fv(this.unifLoc.u_root_transform,!1,new Float32Array([t,e,0,s,i,0,r,n,1]))}updateBuffer(){const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,this.glVertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertFloatView,t.DYNAMIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.glIndexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer,t.DYNAMIC_DRAW)}draw(){const t=this.gl;t.clear(t.COLOR_BUFFER_BIT),t.drawElements(t.TRIANGLES,this.indexCount,t.UNSIGNED_INT,0)}},R=class extends P{gpu;device;pipeline;renderPassDescriptor;options;gpuVertexBuffer;gpuIndexBuffer;projectionMatBuffer;stageMatBuffer;uniformBindGroup;constructor(t){super(t),t.debug,this.options=t,this.gpu=this.canvasEle.getContext("webgpu"),this.curVertBufferLength=256,this.curIndexBufferLength=256}async init(){await this.initDevice(),this.initGpuBuffer(),this.initRenderPassDescriptor(),this.createPipeline(),this.initUniformBindGroup(),this.setRootTransform(1,0,0,1,0,0),this.setProjectionMatrix()}draw(){const{device:t,renderPassDescriptor:e,gpuVertexBuffer:s,gpuIndexBuffer:i,gpu:r,uniformBindGroup:n,indexCount:a,pipeline:h}=this,o=t.createCommandEncoder(),c=[...e.colorAttachments];c?.[0]?.view&&(c[0].view=r.getCurrentTexture().createView());const l=o.beginRenderPass(e);l.setPipeline(h),l.setVertexBuffer(0,s),l.setIndexBuffer(i,"uint32"),l.setBindGroup(0,n),l.drawIndexed(a),l.end();const u=o.finish();t.queue.submit([u])}initUniformBindGroup(){const t=this.device;this.stageMatBuffer=t.createBuffer({label:"stage-matrix-uniform-buffer",size:12*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.projectionMatBuffer=t.createBuffer({label:"projection-matrix-uniform-buffer",size:12*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.uniformBindGroup=this.device.createBindGroup({label:"my-uniform-bind-group",layout:this.pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.stageMatBuffer}},{binding:1,resource:{buffer:this.projectionMatBuffer}}]})}initGpuBuffer(){const t=this.device;this.gpuVertexBuffer=t.createBuffer({label:"my-gpu-vertex-buffer",size:12*this.curVertBufferLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST}),this.gpuIndexBuffer=t.createBuffer({label:"my-gpu-index-buffer",size:this.curIndexBufferLength*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST})}updateBuffer(){const t=this.device;this.vertexCount>this.curVertBufferLength&&(this.gpuVertexBuffer.destroy(),this.gpuVertexBuffer=t.createBuffer({label:"my-gpu-vertex-buffer",size:12*this.vertexCount,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST}),this.curVertBufferLength=this.vertexCount),t.queue.writeBuffer(this.gpuVertexBuffer,0,this.vertFloatView.buffer),this.indexCount>this.curIndexBufferLength&&(this.gpuIndexBuffer.destroy(),this.gpuIndexBuffer=t.createBuffer({label:"my-gpu-index-buffer",size:this.indexCount*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST}),this.curIndexBufferLength=this.indexCount),t.queue.writeBuffer(this.gpuIndexBuffer,0,this.indexBuffer.buffer)}setRootTransform(t,e,s,i,r,n){this.device.queue.writeBuffer(this.stageMatBuffer,0,new Float32Array([t,e,0,0,s,i,0,0,r,n,1,0]))}setProjectionMatrix(){const t=1/this.canvasEle.width*2,e=1/this.canvasEle.height*2;this.device.queue.writeBuffer(this.projectionMatBuffer,0,new Float32Array([t,0,0,0,0,-e,0,0,-1,1,1,0]))}createPipeline(){this.pipeline=this.device.createRenderPipeline({layout:"auto",label:"my-render-pipeline",vertex:{module:this.device.createShaderModule({code:"\n@group(0) @binding(0) var<uniform> u_root_transform: mat3x3<f32>;\n@group(0) @binding(1) var<uniform> u_projection_matrix: mat3x3<f32>;\n\nstruct VertOutput {\n @builtin(position) v_position: vec4<f32>,\n @location(0) v_color : vec4<f32>,\n};\n\n@vertex\nfn main(\n @location(0) a_position: vec2<f32>,\n @location(1) a_color: vec4<f32>,\n) -> VertOutput {\n let v_position = vec4<f32>((u_projection_matrix * u_root_transform * vec3<f32>(a_position, 1.0)).xy, 0.0, 1.0);\n\n let v_color = a_color;\n\n return VertOutput(v_position, v_color);\n}\n",label:"my-vert-shader-module"}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,format:"float32x2",offset:0},{shaderLocation:1,format:"unorm8x4",offset:2*Float32Array.BYTES_PER_ELEMENT}]}]},fragment:{module:this.device.createShaderModule({code:"\n@fragment\nfn main(\n @location(0) v_color : vec4<f32>,\n) -> @location(0) vec4<f32> {\n return v_color;\n}\n",label:"my-frag-shader-module"}),entryPoint:"main",targets:[{format:navigator.gpu.getPreferredCanvasFormat(),blend:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list"}})}async initDevice(){const t=await((await navigator.gpu.requestAdapter())?.requestDevice());t&&(this.gpu.configure({device:t,format:navigator.gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),this.device=t)}initRenderPassDescriptor(){const{backgroundColor:t="",backgroundAlpha:e=1}=this.options,s=e,[i,r,n]=C(t).map(t=>t*s);this.renderPassDescriptor={label:"my-render-pass-descriptor",colorAttachments:[{view:this.gpu.getCurrentTexture().createView(),storeOp:"store",loadOp:"clear",clearValue:[i,r,n,s]}]}}},U=class t{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t=0,e=t){this.x=t,this.y=e}clone=()=>new t(this.x,this.y)},F=class{_x;_y;cb;constructor(t,e=0,s=0){this._x=e,this._y=s,this.cb=t}set(t=0,e=t){this._x=t,this._y=e,this.cb(this._x,this._y)}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb(this._x,this._y))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb(this._x,this._y))}},N=class t{a;b;c;d;tx;ty;array=null;constructor(t=1,e=0,s=0,i=1,r=0,n=0){this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n}set=(t,e,s,i,r,n)=>(this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n,this);append=t=>{const{a:e,b:s,c:i,d:r,tx:n,ty:a}=this,{a:h,b:o,c:c,d:l,tx:u,ty:p}=t;return this.a=e*h+i*o,this.b=s*h+r*o,this.c=e*c+i*l,this.d=s*c+r*l,this.tx=e*u+i*p+n,this.ty=s*u+r*p+a,this};fromArray=t=>{this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]};translate=(t,e)=>(this.tx+=t,this.ty+=e,this);scale=(t,e)=>(this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this);setTransform=(t,e,s,i,r,n,a,h,o)=>(this.a=Math.cos(a+o)*r,this.b=Math.sin(a+o)*r,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this);rotate=t=>{const e=Math.cos(t),s=Math.sin(t),i=this.a,r=this.c,n=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=r*e-this.d*s,this.d=r*s+this.d*e,this.tx=n*e-this.ty*s,this.ty=n*s+this.ty*e,this};equals=t=>t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty;identity=()=>(this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this);decompose=t=>{const s=this.a,i=this.b,r=this.c,n=this.d,a=t.pivot,h=-Math.atan2(-r,n),o=Math.atan2(i,s),c=Math.abs(h+o);return c<1e-5||Math.abs(e-c)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=o),t.scale.x=Math.sqrt(s*s+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*s+a.y*r),t.position.y=this.ty+(a.x*i+a.y*n),t};apply=t=>{const e=new U,s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e};applyInverse=t=>{const e=new U,s=1/(this.a*this.d+this.c*-this.b),i=t.x,r=t.y;return e.x=this.d*s*i+-this.c*s*r+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*r+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e};prepend=t=>{const{a:e,b:s,c:i,d:r,tx:n,ty:a}=t,{a:h,b:o,c:c,d:l,tx:u,ty:p}=this;return this.a=e*h+i*o,this.b=s*h+r*o,this.c=e*c+i*l,this.d=s*c+r*l,this.tx=e*u+i*p+n,this.ty=s*u+r*p+a,this};clone=()=>{const e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e};toArray=(t,e)=>{this.array||(this.array=/* @__PURE__ */new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}},V=class{localTransform=new N;worldTransform=new N;position;scale;pivot;skew;_rotation=0;rotateMatrix=new N;skewMatrix=new N;scaleMatrix=new N;localMatrix=new N;shouldUpdateLocalTransform=!1;worldId=0;parentId=0;constructor(){this.position=new F(this.onChange),this.scale=new F(this.onScaleChange,1,1),this.pivot=new F(this.onChange),this.skew=new F(this.onSkewChange)}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this.rotateMatrix.set(Math.cos(this.rotation),Math.sin(this.rotation),-Math.sin(this.rotation),Math.cos(this.rotation),0,0),this.shouldUpdateLocalTransform=!0}onSkewChange=(t,e)=>{this.skewMatrix.set(Math.cos(e),Math.sin(e),Math.sin(t),Math.cos(t),0,0),this.shouldUpdateLocalTransform=!0};onScaleChange=(t,e)=>{this.scaleMatrix.set(t,0,0,e,0,0),this.shouldUpdateLocalTransform=!0};onChange=()=>{this.shouldUpdateLocalTransform=!0};updateLocalTransform(){if(!this.shouldUpdateLocalTransform)return;const{a:t,b:e,c:s,d:i}=this.localMatrix.set(1,0,0,1,0,0).append(this.rotateMatrix).append(this.skewMatrix).append(this.scaleMatrix),r=t*this.pivot.x+s*this.pivot.y,n=e*this.pivot.x+i*this.pivot.y,a=this.position.x-r,h=this.position.y-n;this.localTransform.set(t,e,s,i,a,h),this.shouldUpdateLocalTransform=!1,this.parentId=-1}updateTransform(t){if(this.updateLocalTransform(),this.parentId!==t.worldId){const{a:e,b:s,c:i,d:r,tx:n,ty:a}=t.worldTransform,{a:h,b:o,c:c,d:l,tx:u,ty:p}=this.localTransform;this.worldTransform.set(e*h+i*o,s*h+r*o,e*c+i*l,s*c+r*l,e*u+i*p+n,s*u+r*p+a),this.parentId=t.worldId,this.worldId++}}},D=class extends t{_zIndex=0;parent=void 0;visible=!0;transform=new V;alpha=1;worldAlpha=1;hitArea=null;cursor="auto";get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.isSort=!0)}get position(){return this.transform.position}get localTransform(){return this.transform.localTransform}get worldTransform(){return this.transform.worldTransform}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get scale(){return this.transform.scale}get pivot(){return this.transform.pivot}get skew(){return this.transform.skew}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*s}set angle(t){this.transform.rotation=t*i}updateTransform(){const t=this.parent?.transform||new V;this.transform.updateTransform(t),this.worldAlpha=this.alpha*(this.parent?.worldAlpha||1)}addEventListener=(t,e,s)=>{const i="boolean"==typeof s&&s||"object"==typeof s&&s.capture?`${t}capture`:t;"object"==typeof s&&s.once?this.once(i,e):this.tap(i,e)};removeEventListener=(t,e,s)=>{const i=s?`${t}capture`:t;this.off(i,e)}},k=class extends D{isSort=!1;type="container";children=[];worldId=0;batches=[];batchCount=0;structureVersion=0;constructor(){super()}markStructureDirty=()=>{let t=this.parent??this;for(;t.parent;)t=t.parent;t.structureVersion++};addChild=t=>{t.parent?.removeChild(t),this.children.push(t),t.parent=this,this.isSort=!0,this.markStructureDirty()};removeChild=t=>{for(let e=0;e<this.children.length;e++)if(this.children[e]===t)return this.children.splice(e,1),t.parent=void 0,void this.markStructureDirty()};sortChildren=()=>{this.isSort&&(this.children.sort((t,e)=>t.zIndex-e.zIndex),this.isSort=!1)};renderCanvas(t){}renderCanvasRecursive=t=>{if(!(this.worldAlpha<=0)&&this.visible){this.renderCanvas(t);for(let e=0;e<this.children.length;e++)this.children[e].renderCanvasRecursive(t)}};updateTransform=()=>{this.sortChildren();const t=this.parent?.transform||new V;if(this.transform.updateTransform(t),this.worldAlpha=(this.parent?.worldAlpha||1)*this.alpha,!(this.worldAlpha<=0)&&this.visible)for(let e=0;e<this.children.length;e++)this.children[e].updateTransform()};containsPoint=t=>!!this.hitArea&&this.hitArea.contains(t);buildBatches(t){}updateBatches(t){}},O=/* @__PURE__ */function(t){return t[t.NONE=0]="NONE",t[t.CAPTURING=1]="CAPTURING",t[t.AT_TARGET=2]="AT_TARGET",t[t.BUBBLING=3]="BUBBLING",t}({}),G=class{isTrusted=!0;timeStamp=0;type="mousemove";button=0;buttons=0;global=new U;propagationStopped=!1;eventPhase=0;target=new k;currentTarget=new k;stopPropagation(){this.propagationStopped=!0}},j=class{rootContainer;hasFoundTarget=!1;hitTarget=null;cursor="auto";eventHandlerMap={};pressTargetsMap={};overTargets=[];constructor(t){this.rootContainer=t,this.eventHandlerMap.mousemove=this.fireMouseMove,this.eventHandlerMap.mousedown=this.fireMouseDown,this.eventHandlerMap.mouseup=this.fireMouseUp}hitTestRecursive=(t,e)=>{if(!t.visible)return;if(this.hasFoundTarget)return;for(let i=t.children.length-1;i>=0;i--){const s=t.children[i];this.hitTestRecursive(s,e)}if(this.hasFoundTarget)return;const s=t.worldTransform.applyInverse(e);t.containsPoint(s)&&(this.hitTarget=t,this.hasFoundTarget=!0)};hitTest=t=>(this.hasFoundTarget=!1,this.hitTarget=null,this.hitTestRecursive(this.rootContainer,t),this.hitTarget);fireEvent=t=>{this.eventHandlerMap[t.type]?.(t)};fireMouseMove=t=>{const e=this.hitTest(t.global),s=this.overTargets.length>0?this.overTargets[this.overTargets.length-1]:null;if(s&&s!==e&&(t.target=s,t.type="mouseout",this.dispatchEvent(t),!e||!this.composePath(e).includes(s)))if(t.type="mouseleave",t.eventPhase=O.AT_TARGET,e){let i=s;for(;i&&!this.composePath(e).includes(i);)t.target=i,t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t),i=i.parent}else for(let i=this.overTargets.length-1;i>=0;i--)t.target=this.overTargets[i],t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t);if(e&&s!==e){t.target=e,t.type="mouseover",this.dispatchEvent(t);const i=this.composePath(e);if(t.type="mouseenter",t.eventPhase=O.AT_TARGET,s){let e=i.length-1;for(;e>=0&&!this.composePath(s).includes(i[e]);e--);for(let s=e+1;s<i.length;s++)t.target=i[s],t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t)}else for(let e=0;e<i.length;e++)t.target=i[e],t.currentTarget=t.target,t.target.call(`${t.type}capture`,t),t.target.call(t.type,t)}e&&(t.target=e,t.type="mousemove",this.dispatchEvent(t)),this.overTargets=e?this.composePath(e):[],this.cursor=e?e.cursor:"auto"};fireMouseDown=t=>{const e=this.hitTest(t.global);e&&(t.target=e,this.dispatchEvent(t),this.pressTargetsMap[t.button]=this.composePath(e))};fireMouseUp=t=>{const e=this.hitTest(t.global);if(!e)return;t.target=e,this.dispatchEvent(t);const s=this.pressTargetsMap[t.button];if(!s)return;let i=s[s.length-1];const r=this.composePath(e);for(;i&&!r.includes(i);)i.parent&&(i=i.parent);t.type="click",t.target=i,this.dispatchEvent(t),delete this.pressTargetsMap[t.button]};notifyTarget=t=>{t.eventPhase===O.CAPTURING?t.currentTarget.call(`${t.type}capture`,t):t.currentTarget.call(t.type,t)};propagate=t=>{const e=this.composePath(t.target);t.eventPhase=O.CAPTURING;for(let s=0;s<e.length-1;s++)if(t.currentTarget=e[s],this.notifyTarget(t),t.propagationStopped)return;if(t.eventPhase=O.AT_TARGET,t.currentTarget=t.target,t.currentTarget.call(`${t.type}capture`,t),!t.propagationStopped&&(t.currentTarget.call(t.type,t),!t.propagationStopped)){t.eventPhase=O.BUBBLING;for(let s=e.length-2;s>=0;s--)if(t.currentTarget=e[s],this.notifyTarget(t),t.propagationStopped)return}};dispatchEvent=t=>{t.propagationStopped=!1,this.propagate(t)};composePath=t=>{const e=[];let s=t;for(;s;)e.unshift(s),s=s.parent;return e}},Y=class{canvasEle;eventBoundary;rootEvent=new G;constructor(t,e){this.canvasEle=t,this.eventBoundary=new j(e),this.addEvents()}addEvents=()=>{this.canvasEle.addEventListener("pointermove",this.onPointerMove,!0),this.canvasEle.addEventListener("pointerleave",this.onPointerLeave,!0),this.canvasEle.addEventListener("pointerdown",this.onPointerDown,!0),this.canvasEle.addEventListener("pointerup",this.onPointerup,!0)};onPointerMove=t=>{this.bootstrapEvent(t),this.eventBoundary.fireEvent(this.rootEvent),this.setCursor()};onPointerLeave=()=>{this.eventBoundary.overTargets=[]};onPointerDown=t=>{this.bootstrapEvent(t),this.eventBoundary.fireEvent(this.rootEvent)};onPointerup=t=>{this.bootstrapEvent(t),this.eventBoundary.fireEvent(this.rootEvent)};bootstrapEvent=t=>{this.rootEvent.isTrusted=t.isTrusted,this.rootEvent.timeStamp=performance.now(),this.rootEvent.type=t.type.replace("pointer","mouse"),this.rootEvent.button=t.button,this.rootEvent.buttons=t.buttons,this.rootEvent.global.x=t.offsetX,this.rootEvent.global.y=t.offsetY};setCursor=()=>{this.canvasEle.style.cursor=this.eventBoundary.cursor}},z=class t{renderer;stage;view;animationFrameId;eventSystem;constructor(t){const{view:e=document.createElement("canvas")}=t;this.view=e,this.renderer=(t=>{const{prefer:e}=t;switch(e){case o.CANVAS:return new d(t);case o.WEB_GL:return new L(t);case o.WEB_GPU:return new R(t);default:return new d(t)}})({...t,view:e}),this.stage=new k,this.eventSystem=new Y(this.view,this.stage)}static async create(e){const s=new t(e);return await s.renderer.init(),s}render(){this.renderer.render(this.stage)}start(){const t=()=>{this.render(),this.animationFrameId=requestAnimationFrame(t)};t()}stop(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0)}},q=class extends u{points=[];closeStroke=!1;type=n.POLYGON;constructor(t=[]){super(),this.points=t}isIntersect(t,e,s,i,r,n){if(i>e&&n>e)return!1;if(i<e&&n<e)return!1;if(s<t&&r<t)return!1;if(s>t&&r>t)return!0;return r-(r-s)/(i-n)*(e-n)>t}contains(t){const e=this.points.length;let s=0;for(let h=2;h<=e-2;h+=2){const e=this.points[h-2],i=this.points[h-1],r=this.points[h],n=this.points[h+1];this.isIntersect(t.x,t.y,e,i,r,n)&&s++}const i=this.points[0],r=this.points[1],n=this.points[e-2],a=this.points[e-1];return this.isIntersect(t.x,t.y,i,r,n,a)&&s++,s%2!=0}},Z=class t{color="#ffffff";alpha=1;visible=!1;constructor(){this.reset()}clone(){const e=new t;return e.color=this.color,e.alpha=this.alpha,e.visible=this.visible,e}reset(){this.color="#ffffff",this.alpha=1,this.visible=!1}},$=class t extends Z{width=0;cap=a.BUTT;join=h.MITER;miterLimit=10;clone(){const e=new t;return e.color=this.color,e.alpha=this.alpha,e.visible=this.visible,e.width=this.width,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e}reset(){super.reset(),this.color="#ffffff",this.width=0,this.cap=a.BUTT,this.join=h.MITER,this.miterLimit=10}},X=class{shape;lineStyle;fillStyle;vertices=[];constructor(t,e,s){this.shape=t,this.lineStyle=s,this.fillStyle=e}},H=class{_oldLength=-1;_length=0;curMaxLen=16;float32=new Float32Array(16);_data;get length(){return this._length}concat(t){const e=this._length+t.length;for(;e>this.curMaxLen;)this.expandCapacity();for(let s=0;s<t.length;s++)this.float32[this._length]=t[s],this._length++}push(t){this._length>=this.curMaxLen&&this.expandCapacity(),this.float32[this._length]=t,this._length++}expandCapacity(){this.curMaxLen*=2;const t=new Float32Array(this.curMaxLen);t.set(this.float32),this.float32=t}get data(){return this._oldLength!==this._length&&(this._data=new Float32Array(this.float32.buffer,0,this._length),this._oldLength=this._length),this._data}clear(){this._length=0}},W=class{_oldLength=-1;_length=0;curMaxLen=8;int32=new Uint32Array(8);_data;get length(){return this._length}concat(t){const e=this.length+t.length;for(;e>this.curMaxLen;)this.expandCapacity();for(let s=0;s<t.length;s++)this.int32[this._length]=t[s],this._length++}concatUInt16(t){const e=this.length+t.length;for(;e>this.curMaxLen;)this.expandCapacity();this.int32.set(t,this._length),this._length=e}expandCapacity(){this.curMaxLen*=2;const t=new Uint32Array(this.curMaxLen);t.set(this.int32),this.int32=t}get data(){return this._oldLength!==this._length&&(this._data=new Uint32Array(this.int32.buffer,0,this._length),this._oldLength=this._length),this._data}clear(){this._length=0}},Q=/* @__PURE__ */new Set,J=!1;function K(t,e,s=2){const i=e&&e.length,r=i?e[0]*s:t.length;Q.size&&Q.clear();let n=tt(t,0,r,s,!0);const a=[];if(!n||n.next===n.prev)return a;let h=0,o=0,c=0;if(i&&(n=function(t,e,s,i){const r=[];for(let n=0,a=e.length;n<a;n++){const s=tt(t,e[n]*i,n<a-1?e[n+1]*i:t.length,i,!1);s===s.next&&Q.add(s),r.push(Et(s))}r.sort(ot),function(t,e){const s=Math.ceil((t+2*e)/lt)+e+2;ut.length<4*s&&(ut=new Float64Array(4*s));pt=0}(t.length/i,e.length),xt(s,s),ht=!0;for(let n=0;n<r.length;n++)s=ct(r[n],s);return ht=!1,et(s)}(t,e,n,s)),t.length>80*s){h=t[0],o=t[1];let e=h,i=o;for(let n=s;n<r;n+=s){const s=t[n],r=t[n+1];s<h&&(h=s),r<o&&(o=r),s>e&&(e=s),r>i&&(i=r)}c=Math.max(e-h,i-o),c=0!==c?32767/c:0}return st(n,a,h,o,c),a}function tt(t,e,s,i,r){let n=null;if(r===function(t,e,s,i){let r=0;for(let n=e,a=s-i;n<s;n+=i)r+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return r}(t,e,s,i)>0)for(let a=e;a<s;a+=i)n=Ft(a/i|0,t[a],t[a+1],n);else for(let a=s-i;a>=e;a-=i)n=Ft(a/i|0,t[a],t[a+1],n);return n&&St(n,n.next)&&(Nt(n),n=n.next),n}function et(t,e=t){const s=e===t;let i,r=t;do{i=!1,r===r.next||0!==Q.size&&Q.has(r)||!St(r,r.next)&&0!==It(r.prev,r,r.next)?(s||r!==e)&&(r=r.next,i=!s):((s||r===e)&&(e=r.prev),J=!0,Nt(r),r=r.prev,i=!0)}while(i||r!==e);return e}function st(t,e,s,i,r){r&&function(t,e,s,i){let r=t,n=0;do{r.z=_t(r.x,r.y,e,s,i),mt[n++]=r,r=r.next}while(r!==t);!function(t){if(t<=32){for(let e=1;e<t;e++){const t=mt[e],s=t.z;let i=e-1;for(;i>=0&&mt[i].z>s;)mt[i+1]=mt[i],i--;mt[i+1]=t}return}wt.length<t&&(wt=new Uint32Array(t),Mt=new Uint32Array(t),bt=new Array(t));for(let e=0;e<t;e++)wt[e]=mt[e].z;Tt(t,mt,wt,bt,Mt,0),Tt(t,bt,Mt,mt,wt,8),Tt(t,mt,wt,bt,Mt,16),Tt(t,bt,Mt,mt,wt,24)}(n);let a=null;for(let h=0;h<n;h++){const t=mt[h];t.prevZ=a,a&&(a.nextZ=t),a=t}a.nextZ=null}(t,s,i,r);let n=t,a=!1;for(;t.prev!==t.next;){const h=t.prev,o=t.next;if(It(h,t,o)<0&&(r?rt(t,s,i,r):it(t)))e.push(h.i,t.i,o.i),Nt(t),t=o,n=o;else if((t=o)===n){if(J=!1,t=et(t),J){n=t;continue}if(!a){n=t=nt(t,e),a=!0;continue}at(t,e,s,i,r);break}}}function it(t){const e=t.prev,s=t,i=t.next,r=e.x,n=s.x,a=i.x,h=e.y,o=s.y,c=i.y,l=Math.min(r,n,a),u=Math.min(h,o,c),p=Math.max(r,n,a),f=Math.max(h,o,c);let d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=p&&d.y>=u&&d.y<=f&&(r!==d.x||h!==d.y)&&Bt(r,h,n,o,a,c,d.x,d.y)&&It(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function rt(t,e,s,i){const r=t.prev,n=t,a=t.next,h=r.x,o=n.x,c=a.x,l=r.y,u=n.y,p=a.y,f=Math.min(h,o,c),d=Math.min(l,u,p),x=Math.max(h,o,c),g=Math.max(l,u,p),y=_t(f,d,e,s,i),v=_t(x,g,e,s,i);let m=t.prevZ;for(;m&&m.z>=y;){if(m.x>=f&&m.x<=x&&m.y>=d&&m.y<=g&&m!==a&&(h!==m.x||l!==m.y)&&Bt(h,l,o,u,c,p,m.x,m.y)&&It(m.prev,m,m.next)>=0)return!1;m=m.prevZ}let b=t.nextZ;for(;b&&b.z<=v;){if(b.x>=f&&b.x<=x&&b.y>=d&&b.y<=g&&b!==a&&(h!==b.x||l!==b.y)&&Bt(h,l,o,u,c,p,b.x,b.y)&&It(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function nt(t,e){let s=t,i=!1;do{const r=s.prev,n=s.next.next;Ct(r,s,s.next,n,!1)&&Rt(r,n)&&Rt(n,r)&&(e.push(r.i,s.i,n.i),Nt(s),Nt(s.next),s=t=n,i=!0),s=s.next}while(s!==t);return i?et(s):s}function at(t,e,s,i,r){let n=t;do{let t=n.next.next;for(;t!==n.prev;){if(n.i!==t.i&&At(n,t)){let a=Ut(n,t);return n=et(n,n.next),a=et(a,a.next),st(n,e,s,i,r),void st(a,e,s,i,r)}t=t.next}n=n.next}while(n!==t)}var ht=!1;function ot(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function ct(t,e){const s=function(t,e){let s=e;const i=t.x,r=t.y;let n,a=-1/0;if(St(t,s))return s;for(let p=0,f=0;p<pt;p++,f+=4){if(r<ut[f+1]||r>ut[f+3]||ut[f]>i||ut[f+2]<=a)continue;const e=gt(p);s=yt(p);do{if(s.prev.next===s){if(St(t,s.next))return s.next;if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){const t=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=i&&t>a&&(a=t,n=s.x<s.next.x?s:s.next,t===i))return n}}s=s.next}while(s!==e)}if(!n)return null;const h=n.x,o=n.y,c=Math.min(r,o),l=Math.max(r,o);let u=1/0;for(let p=0,f=0;p<pt;p++,f+=4){if(ut[f+2]<h||ut[f]>i||ut[f+3]<c||ut[f+1]>l)continue;const e=gt(p);s=yt(p);do{if(s.prev.next===s&&i>=s.x&&s.x>=h&&i!==s.x&&Bt(r<o?i:a,r,h,o,r<o?a:i,r,s.x,s.y)){const e=Math.abs(r-s.y)/(i-s.x);(Rt(s,t)||s.y===r&&s.next.y===r&&s.next.x>i)&&(e<u||e===u&&(s.x>n.x||s.x===n.x&&vt(n,s)))&&(n=s,u=e)}s=s.next}while(s!==e)}return n}(t,e);if(!s)return e;const i=Ut(s,t);return xt(s,i.next.next),et(i,i.next),et(s,s.next)}var lt=16,ut=/* @__PURE__ */new Float64Array(0),pt=0,ft=[],dt=[];function xt(t,e){let s=t;do{const t=pt++;ft[t]=s;let i=1/0,r=1/0,n=-1/0,a=-1/0,h=0;do{const e=s.next;s.z=t,s.x<i&&(i=s.x),s.x>n&&(n=s.x),s.y<r&&(r=s.y),s.y>a&&(a=s.y),e.x<i&&(i=e.x),e.x>n&&(n=e.x),e.y<r&&(r=e.y),e.y>a&&(a=e.y),s=e}while(++h<lt&&s!==e);dt[t]=s;const o=4*t;ut[o]=i,ut[o+1]=r,ut[o+2]=n,ut[o+3]=a}while(s!==e)}function gt(t){let e=dt[t];for(;e.prev.next!==e;)e=e.next;return dt[t]=e,e}function yt(t){let e=ft[t];for(;e.prev.next!==e;)e=e.next;return ft[t]=e,e}function vt(t,e){return It(t.prev,t,e.prev)<0&&It(e.next,t,t.next)<0}var mt=[],bt=[],wt=/* @__PURE__ */new Uint32Array(0),Mt=/* @__PURE__ */new Uint32Array(0),Pt=/* @__PURE__ */new Uint32Array(256);function Tt(t,e,s,i,r,n){Pt.fill(0);for(let h=0;h<t;h++)Pt[s[h]>>>n&255]++;let a=0;for(let h=0;h<256;h++){const t=Pt[h];Pt[h]=a,a+=t}for(let h=0;h<t;h++){const t=s[h],a=Pt[t>>>n&255]++;i[a]=e[h],r[a]=t}}function _t(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Et(t){let e=t,s=t;do{(e.x<s.x||e.x===s.x&&e.y<s.y)&&(s=e),e=e.next}while(e!==t);return s}function Bt(t,e,s,i,r,n,a,h){return(r-a)*(e-h)>=(t-a)*(n-h)&&(t-a)*(i-h)>=(s-a)*(e-h)&&(s-a)*(n-h)>=(r-a)*(i-h)}function At(t,e){const s=St(t,e)&&It(t.prev,t,t.next)>0&&It(e.prev,e,e.next)>0;return t.next.i!==e.i&&(s||Rt(t,e)&&Rt(e,t)&&(0!==It(t.prev,t,e.prev)||0!==It(t,e.prev,e)))&&!function(t,e){const s=Math.min(t.x,e.x),i=Math.max(t.x,e.x),r=Math.min(t.y,e.y),n=Math.max(t.y,e.y);let a=t;do{const h=a.next;if(a.x>i&&h.x>i||a.x<s&&h.x<s||a.y>n&&h.y>n||a.y<r&&h.y<r)a=h;else{if(a.i!==t.i&&h.i!==t.i&&a.i!==e.i&&h.i!==e.i&&Ct(a,h,t,e))return!0;a=h}}while(a!==t);return!1}(t,e)&&(s||function(t,e){let s=t,i=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{const t=s.next;s.y>n!=t.y>n&&r<(t.x-s.x)*(n-s.y)/(t.y-s.y)+s.x&&(i=!i),s=t}while(s!==t);return i}(t,e))}function It(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function St(t,e){return t.x===e.x&&t.y===e.y}function Ct(t,e,s,i,r=!0){const n=It(t,e,s),a=It(t,e,i),h=It(s,i,t),o=It(s,i,e);return(n>0&&a<0||n<0&&a>0)&&(h>0&&o<0||h<0&&o>0)||!!r&&(!(0!==n||!Lt(t,s,e))||(!(0!==a||!Lt(t,i,e))||(!(0!==h||!Lt(s,t,i))||!(0!==o||!Lt(s,e,i)))))}function Lt(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function Rt(t,e){return It(t.prev,t,t.next)<0?It(t,e,t.next)>=0&&It(t,t.prev,e)>=0:It(t,e,t.prev)<0||It(t,t.next,e)<0}function Ut(t,e){const s=Vt(t.i,t.x,t.y),i=Vt(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}function Ft(t,e,s,i){const r=Vt(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Nt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),ht&&function(t,e){const s=4*t.z;e.x<ut[s]&&(ut[s]=e.x),e.y<ut[s+1]&&(ut[s+1]=e.y),e.x>ut[s+2]&&(ut[s+2]=e.x),e.y>ut[s+3]&&(ut[s+3]=e.y)}(t.prev,t.next)}function Vt(t,e,s){return{i:t,x:e,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null}}var Dt=class extends u{x;y;radius;type=n.CIRCLE;constructor(t=0,e=0,s=0){super(),this.x=t,this.y=e,this.radius=s}contains(t){return(t.x-this.x)*(t.x-this.x)+(t.y-this.y)*(t.y-this.y)<this.radius*this.radius}},kt=class extends u{x;y;radiusX;radiusY;type=n.ELLIPSE;constructor(t=0,e=0,s=0,i=0){super(),this.x=t,this.y=e,this.radiusX=s,this.radiusY=i}contains(t){return(t.x-this.x)*(t.x-this.x)/(this.radiusX*this.radiusX)+(t.y-this.y)*(t.y-this.y)/(this.radiusY*this.radiusY)<1}},Ot=class extends u{x;y;width;height;radius;type=n.ROUNDED_RECTANGLE;constructor(t=0,e=0,s=0,i=0,r=20){super(),this.x=t,this.y=e,this.width=s,this.height=i;const n=Math.min(s,i)/2;this.radius=r>n?n:r}contains(t){if(!(t.x>this.x&&t.x<this.x+this.width&&t.y>this.y&&t.y<this.y+this.height))return!1;const e=this.x+this.radius,s=this.y+this.radius;if(t.x<e&&t.y<s)return(t.x-e)*(t.x-e)+(t.y-s)*(t.y-s)<this.radius*this.radius;const i=this.x+this.radius,r=this.y+this.height-this.radius;if(t.x<i&&t.y>r)return(t.x-i)*(t.x-i)+(t.y-r)*(t.y-r)<this.radius*this.radius;const n=this.x+this.width-this.radius,a=this.y+this.radius;if(t.x>n&&t.y<a)return(t.x-n)*(t.x-n)+(t.y-a)*(t.y-a)<this.radius*this.radius;const h=this.x+this.width-this.radius,o=this.y+this.height-this.radius;return!(t.x>h&&t.y<o)||(t.x-h)*(t.x-h)+(t.y-o)*(t.y-o)<this.radius*this.radius}},Gt=t=>{const{shape:e,vertices:s}=t;if(e instanceof p){const{x:t,y:i,width:r,height:n}=e;s.push(t,i,t+r,i,t+r,i+n,t,i+n)}e instanceof Dt&&((t,e)=>{const{x:s,y:i,radius:r}=t,n=2*Math.PI*r,a=Math.min(Math.ceil(n/5),2048);for(let h=0;h<a;h++){const t=h/a*Math.PI*2,n=s+r*Math.cos(t),o=i+r*Math.sin(t);e.vertices.push(n,o)}})(e,t),e instanceof Ot&&((t,e)=>{const{x:s,y:i,width:r,height:n,radius:a}=t,h=2*Math.PI*a/4,o=Math.min(Math.ceil(h/4),2048);for(let c=0;c<o;c++){const t=c/o*Math.PI*.5,h=a*Math.cos(t),l=a*Math.sin(t);e.vertices.push(s+r-a+h,i+n-a+l)}for(let c=0;c<o;c++){const t=c/o*Math.PI*.5+Math.PI/2,r=a*Math.cos(t),h=a*Math.sin(t);e.vertices.push(s+a+r,i+n-a+h)}for(let c=0;c<o;c++){const t=c/o*Math.PI*.5+Math.PI,r=a*Math.cos(t),n=a*Math.sin(t);e.vertices.push(s+a+r,i+a+n)}for(let c=0;c<o;c++){const t=c/o*Math.PI*.5+1.5*Math.PI,n=a*Math.cos(t),h=a*Math.sin(t);e.vertices.push(s+r-a+n,i+a+h)}})(e,t),e instanceof kt&&((t,e)=>{const{x:s,y:i,radiusX:r,radiusY:n}=t,a=Math.PI*Math.sqrt(2*(r*r+n*n)),h=Math.min(Math.ceil(a/5),2048);for(let o=0;o<h;o++){const t=o/h*Math.PI*2,a=s+r*Math.cos(t),c=i+n*Math.sin(t);e.vertices.push(a,c)}})(e,t),e instanceof q&&(t.vertices=e.points)},jt=t=>{const e=[],s=t.length/2+1;for(let i=1;i<s-1;i++)e.push(0,i,i+1);return e.push(0,s-1,1),e},Yt=(t,e)=>{const{shape:s,vertices:i,fillStyle:r}=t,n=new v(r);if(e.batchParts.push(n),n.start(e.vertices.length/2,e.indices.length),s instanceof p&&(e.vertices.concat(i),e.indices.concat([0,1,2,0,2,3]),n.end(4,6)),s instanceof Dt){const{x:t,y:r}=s;e.vertices.push(t),e.vertices.push(r),e.vertices.concat(i);const a=jt(i);e.indices.concat(a),n.end(i.length/2+1,a.length)}if(s instanceof Ot){const{x:t,y:r,width:a,height:h}=s;e.vertices.push(t+a/2),e.vertices.push(r+h/2),e.vertices.concat(i);const o=jt(i);e.indices.concat(o),n.end(i.length/2+1,o.length)}if(s instanceof kt){const{x:t,y:r}=s;e.vertices.push(t),e.vertices.push(r),e.vertices.concat(i);const a=jt(i);e.indices.concat(a),n.end(i.length/2+1,a.length)}if(s instanceof q){e.vertices.concat(i);const t=K(i);e.indices.concat(t),n.end(i.length/2,t.length)}},zt=(t,e,s,i,r,n,a,h)=>{let o=0,c=0,l=0,u=0,p=0,f=0;if(Math.abs(s-t)<=Number.EPSILON)o=1,c=0,p=s;else{const r=(i-e)/(s-t);o=r,c=-1,p=-(i-r*s)}if(Math.abs(a-r)<=Number.EPSILON)l=1,u=0,f=a;else{const t=(h-n)/(a-r);l=t,u=-1,f=-(h-t*a)}return[(p*u-c*f)/(o*u-c*l),(o*f-p*l)/(o*u-c*l)]},qt=(t,e,s)=>{const i=e,r=-t,n=s/2/Math.sqrt(t*t+e*e);return[i*n,r*n]},Zt=(t,e,s,i,r,n,a,h)=>{const o=s-t,c=i-e,l=r-t,u=n-e;let p=0;p=0===o?c>0?.5*Math.PI:1.5*Math.PI:0===c?o>0?0:Math.PI:o>=0&&c>=0?Math.atan(c/o):o<=0&&c>=0?Math.atan(-o/c)+.5*Math.PI:o<=0&&c<=0?Math.atan(c/o)+Math.PI:Math.atan(o/-c)+1.5*Math.PI;let f=0;f=0===l?u>0?.5*Math.PI:1.5*Math.PI:0===u?l>0?0:Math.PI:l>=0&&u>=0?Math.atan(u/l):l<=0&&u>=0?Math.atan(-l/u)+.5*Math.PI:l<=0&&u<=0?Math.atan(u/l)+Math.PI:Math.atan(l/-u)+1.5*Math.PI,p>f&&(p-=2*Math.PI);const d=Math.sqrt((s-t)*(s-t)+(i-e)*(i-e)),x=2*Math.PI*d/3,g=a.length/2;a.push(t,e,s,i);for(let y=1;y<x;y++){const s=p+y/x*(f-p),i=t+d*Math.cos(s),r=e+d*Math.sin(s);a.push(i,r)}a.push(r,n);for(let y=1;y<a.length/2-g-1;y++)h.push(0+g,y+g,y+1+g)},$t=(t,e)=>{const{vertices:s,shape:i,lineStyle:r}=t,{width:n,cap:o,join:c,miterLimit:l}=r;let u=0,p=!1;if(i instanceof q?i.closeStroke&&(p=!0):p=!0,p){const t=s[0],e=s[1],i=s[s.length-2],r=s[s.length-1];Math.abs(t-i)<1e-4&&Math.abs(e-r)<1e-4&&(s.pop(),s.pop());const n=(t+s[s.length-2])/2,a=(e+s[s.length-1])/2;s.unshift(n,a),s.push(n,a)}const f=new v(r);e.batchParts.push(f),f.start(e.vertices.length/2,e.indices.length);const d=[],x=[],g=s[0],y=s[1],m=s[2],b=s[3],[w,M]=qt(m-g,b-y,n);if(!p){if(o===a.SQUARE){const t=M,e=-w;d.push(g+w,y+M,g+w+t,y+M+e,g-w+t,y-M+e,g-w,y-M),x.push(0,1,2,0,2,3)}o===a.ROUND&&Zt(g,y,g-w,y-M,g+w,y+M,d,x),a.BUTT}u=d.length/2,d.push(g-w,y-M,g+w,y+M);for(let a=2;a<s.length-2;a+=2){const t=s[a-2],e=s[a-1],i=s[a],r=s[a+1],o=s[a+2],p=s[a+3],[f,g]=qt(i-t,r-e,n),[y,v]=qt(o-i,p-r,n),m=i-t,b=r-e,w=o-i,M=p-r,P=w*b-m*M,T=m*w+b*M;if(Math.abs(P)<.001*Math.abs(T)){d.push(i+f,r+g,i-f,r-g),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,T>0?d.push(i-f,r-g,i+f,r+g):(c===h.ROUND&&(Zt(i,r,i+f,r+g,i-f,r-g,d,x),u=d.length/2),c===h.BEVEL||h.MITER,d.push(i+f,r+g,i-f,r-g));continue}const[_,E]=zt(t+f,e+g,i+f,r+g,i+y,r+v,o+y,p+v),[B,A]=zt(t-f,e-g,i-f,r-g,i-y,r-v,o-y,p-v);let I=c;c===h.MITER&&(((B-_)**2+(A-E)**2)/n**2<=l**2||(I=h.BEVEL));const S=m*m+b*b+(n/2)**2,C=w*w+M*M+(n/2)**2;(B-i)**2+(A-r)**2<Math.min(S,C)?(I===h.BEVEL&&(P>0?(d.push(_,E,i-f,r-g),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(_,E,i-f,r-g,i-y,r-v),x.push(0+u,1+u,2+u),u=d.length/2,d.push(i-y,r-v,_,E)):(d.push(i+f,r+g,B,A),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(B,A,i+f,r+g,i+y,r+v),x.push(0+u,1+u,2+u),u=d.length/2,d.push(B,A,i+y,r+v))),I===h.MITER&&(d.push(_,E,B,A),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(B,A,_,E)),I===h.ROUND&&(P<0?(d.push(i+f,r+g,B,A),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(B,A,i+f,r+g,i,r),x.push(0+u,1+u,2+u),u=d.length/2,d.push(B,A,i+y,r+v,i,r),x.push(0+u,1+u,2+u),u=d.length/2,Zt(i,r,i+f,r+g,i+y,r+v,d,x),u=d.length/2,d.push(B,A,i+y,r+v)):(d.push(_,E,i-f,r-g),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,d.push(_,E,i-f,r-g,i,r),x.push(0+u,1+u,2+u),u=d.length/2,d.push(_,E,i-y,r-v,i,r),x.push(0+u,1+u,2+u),u=d.length/2,Zt(i,r,i-y,r-v,i-f,r-g,d,x),u=d.length/2,d.push(i-y,r-v,_,E)))):(d.push(i+f,r+g,i-f,r-g),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,I===h.BEVEL&&(P>0?(d.push(i,r,i-f,r-g,i-y,r-v),x.push(0+u,1+u,2+u)):(d.push(i,r,i+f,r+g,i+y,r+v),x.push(0+u,1+u,2+u))),I===h.MITER&&(P>0?(d.push(i,r,i-f,r-g,B,A,i-y,r-v),x.push(0+u,1+u,2+u,0+u,2+u,3+u)):(d.push(i,r,i+f,r+g,_,E,i+y,r+v),x.push(0+u,1+u,2+u,0+u,2+u,3+u))),I===h.ROUND&&(P>0?Zt(i,r,i-y,r-v,i-f,r-g,d,x):Zt(i,r,i+f,r+g,i+y,r+v,d,x)),u=d.length/2,d.push(i-y,r-v,i+y,r+v))}const P=s[s.length-2],T=s[s.length-1],_=s[s.length-4],E=s[s.length-3],[B,A]=qt(P-_,T-E,n);if(d.push(P+B,T+A,P-B,T-A),x.push(0+u,1+u,2+u,0+u,2+u,3+u),u=d.length/2,!p){const t=s[s.length-2],e=s[s.length-1],i=s[s.length-4],r=s[s.length-3],[h,c]=qt(t-i,e-r,n);if(o===a.SQUARE){const s=-c,i=h;d.push(t+h,e+c,t+h+s,e+c+i,t-h+s,e-c+i,t-h,e-c),x.push(0+u,1+u,2+u,0+u,2+u,3+u)}o===a.ROUND&&Zt(t,e,t+h,e+c,t-h,e-c,d,x)}e.vertices.concat(d),e.indices.concat(x),f.end(d.length/2,x.length)},Xt=class{graphicsData=[];dirty=!1;shapeIndex=0;batchParts=[];vertices=new H;indices=new W;drawShape(t,e,s){const i=new X(t,e,s);this.graphicsData.push(i),this.dirty=!0}containsPoint(t){for(let e=0;e<this.graphicsData.length;e++){const{shape:s,fillStyle:i}=this.graphicsData[e];if(i.visible&&s.contains(t))return!0}return!1}buildVerticesAndTriangulate(){if(this.dirty){this.dirty=!1;for(let t=this.shapeIndex;t<this.graphicsData.length;t++){const e=this.graphicsData[t];Gt(e),e.fillStyle.visible&&Yt(e,this),e.lineStyle.visible&&$t(e,this)}this.shapeIndex=this.graphicsData.length}}clear(){this.graphicsData=[],this.vertices.clear(),this.indices.clear(),this.batchParts=[],this.shapeIndex=0,this.dirty=!1}},Ht=class extends k{_lineStyle=new $;_fillStyle=new Z;geometry=new Xt;currentPath=new q;type;constructor(){super(),this.type="graphics"}lineStyle(t,e="#000000",s=1){if(this.startPoly(),"object"==typeof t)Object.assign(this._lineStyle,t);else{const i={width:t,color:e,alpha:s};Object.assign(this._lineStyle,i)}return this._lineStyle.visible=!0,this}resetLineStyle=()=>{this._lineStyle.reset()};drawShape=t=>(this.geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone()),this.markStructureDirty(),this);startPoly=()=>{this.currentPath.points.length>2&&this.drawShape(this.currentPath),this.currentPath=new q};beginFill=(t="#000000",e=1)=>(this.startPoly(),this._fillStyle.color=t,this._fillStyle.alpha=e,this._fillStyle.alpha>0&&(this._fillStyle.visible=!0),this);endFill=()=>(this.startPoly(),this._fillStyle.reset(),this);drawRect=(t,e,s,i)=>this.drawShape(new p(t,e,s,i));drawCircle=(t,e,s)=>this.drawShape(new Dt(t,e,s));drawRoundedRect=(t,e,s,i,r)=>this.drawShape(new Ot(t,e,s,i,r));drawEllipse=(t,e,s,i)=>this.drawShape(new kt(t,e,s,i));drawPolygon=t=>{const e=new q(t);return e.closeStroke=!0,this.drawShape(e)};moveTo=(t,e)=>(this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this);lineTo=(t,e)=>{if(0===this.currentPath.points.length)return this.moveTo(t,e),this;const s=this.currentPath.points,i=s[s.length-2],r=s[s.length-1];return i===t&&r===e||s.push(t,e),this};closePath=()=>(this.currentPath.closeStroke=!0,this.startPoly(),this);containsPoint=t=>this.hitArea?this.hitArea.contains(t):this.geometry.containsPoint(t);quadraticCurveTo=(t,e,s,i)=>{const r=this.currentPath.points.length;0===r&&(this.currentPath.points=[0,0]);const n=this.currentPath.points[r-2],a=this.currentPath.points[r-1],h=t,o=e,c=s,l=i,u=((t,e,s,i,r,n)=>{const a=2*(t-2*s+r),h=-2*(t-s),o=2*(e-2*i+n),c=-2*(e-i),l=a*a+o*o,u=2*(a*h+o*c),p=h*h+c*c,f=Math.sqrt((4*l*p-u*u)/4),d=(l/2+u/4)*Math.sqrt((l+u/2)*(l+u/2)+f*f)+f*f/2*Math.log(Math.abs(l+u/2+Math.sqrt((l+u/2)*(l+u/2)+f*f))),x=u/4*Math.sqrt(u*u/4+f*f)+f*f/2*Math.log(u/2+Math.sqrt(u*u/4+f*f));return 1/(Math.sqrt(l)*l)*(d-x)})(n,a,h,o,c,l);let p=Math.ceil(u/10);p>2048&&(p=2048),p<8&&(p=8);for(let f=1;f<=p;f++){const t=f/p,e=(1-t)*(1-t)*n+2*t*(1-t)*h+t*t*c,s=(1-t)*(1-t)*a+2*t*(1-t)*o+t*t*l;this.currentPath.points.push(e,s)}return this};bezierCurveTo=(t,e,s,i,r,n)=>{const a=this.currentPath.points.length;0===a&&(this.currentPath.points=[0,0]);const h=this.currentPath.points[a-2],o=this.currentPath.points[a-1],c=t,l=e,u=s,p=i,f=r,d=n,x=((t,e,s,i,r,n,a,h)=>{let o=t,c=e,l=0;for(let u=1;u<=10;u++){const p=u/10,f=(1-p)*(1-p)*(1-p)*t+3*p*(1-p)*(1-p)*s+3*p*p*(1-p)*r+p*p*p*a,d=(1-p)*(1-p)*(1-p)*e+3*p*(1-p)*(1-p)*i+3*p*p*(1-p)*n+p*p*p*h,x=f-o,g=d-c;l+=Math.sqrt(x*x+g*g),o=f,c=d}return l})(h,o,c,l,u,p,f,d);let g=Math.ceil(x/10);g>2048&&(g=2048),g<8&&(g=8);for(let y=1;y<=g;y++){const t=y/g,e=(1-t)*(1-t)*(1-t)*h+3*t*(1-t)*(1-t)*c+3*t*t*(1-t)*u+t*t*t*f,s=(1-t)*(1-t)*(1-t)*o+3*t*(1-t)*(1-t)*l+3*t*t*(1-t)*p+t*t*t*d;this.currentPath.points.push(e,s)}return this};arc=(t,e,s,i,r,n=!1)=>{if(!n){for(;r<i;)r+=2*Math.PI;r-i>2*Math.PI&&(r=i+2*Math.PI)}if(n){for(;r>i;)i+=2*Math.PI;i-r>2*Math.PI&&(r=i-2*Math.PI)}const a=r-i;if(0===a)return this;const h=t+Math.cos(i)*s,o=e+Math.sin(i)*s;this.lineTo(h,o);const c=Math.abs(a)*s;let l=Math.ceil(c/10);l>2048&&(l=2048),l<8&&(l=8);for(let u=1;u<=l;u++){const r=i+a*(u/l),n=t+Math.cos(r)*s,h=e+Math.sin(r)*s;this.lineTo(n,h)}return this};arcTo=(t,e,s,i,r)=>{if(!this.currentPath)return this;const n=this.currentPath.points.length;if(0===n||0===r)return this.lineTo(t,e),this;const a=this.currentPath.points[n-1]-e,h=this.currentPath.points[n-2]-t,o=i-e,c=s-t,l=a*c-h*o,u=Math.abs(l);if(u<1e-8)return this.lineTo(t,e),this;const p=a*a+h*h,f=o*o+c*c,d=a*o+h*c,x=r*Math.sqrt(p)/u,g=r*Math.sqrt(f)/u,y=x*d/p,v=g*d/f,m=x*c+g*h,b=x*o+g*a,w=h*(g+y),M=a*(g+y),P=c*(x+v),T=o*(x+v),_=Math.atan2(M-b,w-m),E=Math.atan2(T-b,P-m),B=h*o>c*a;return this.arc(m+t,b+e,r,_,E,B)};clear=()=>(this.geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this.currentPath=new q,this.batches=[],this.batchCount=0,this.markStructureDirty(),this);renderCanvas=t=>{this.startPoly();const e=t.ctx,{a:s,b:i,c:r,d:n,tx:a,ty:h}=this.transform.worldTransform;e.setTransform(s,i,r,n,a,h);const o=this.geometry.graphicsData;for(let c=0;c<o.length;c++){const{lineStyle:t,fillStyle:s,shape:i}=o[c];if(s.visible&&(e.fillStyle=s.color),t.visible&&(e.lineWidth=t.width,e.lineCap=t.cap,e.lineJoin=t.join,e.strokeStyle=t.color),e.beginPath(),i instanceof p){const{x:r,y:n,width:a,height:h}=i;s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fillRect(r,n,a,h)),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.strokeRect(r,n,a,h))}if(i instanceof Dt){const{x:r,y:n,radius:a}=i;e.arc(r,n,a,0,2*Math.PI),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}if(i instanceof Ot){const{x:r,y:n,width:a,height:h,radius:o}=i;e.moveTo(r+o,n),e.arc(r+o,n+o,o,1.5*Math.PI,Math.PI,!0),e.lineTo(r,n+h-o),e.arc(r+o,n+h-o,o,Math.PI,Math.PI/2,!0),e.lineTo(r+a-o,n+h),e.arc(r+a-o,n+h-o,o,Math.PI/2,0,!0),e.lineTo(r+a,n+o),e.arc(r+a-o,n+o,o,0,1.5*Math.PI,!0),e.closePath(),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}if(i instanceof kt){const{x:r,y:n,radiusX:a,radiusY:h}=i;e.ellipse(r,n,a,h,0,0,2*Math.PI),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}if(i instanceof q){const{points:r,closeStroke:n}=i;e.moveTo(r[0],r[1]);for(let t=2;t<r.length;t+=2)e.lineTo(r[t],r[t+1]);n&&e.closePath(),s.visible&&(e.globalAlpha=s.alpha*this.worldAlpha,e.fill()),t.visible&&(e.globalAlpha=t.alpha*this.worldAlpha,e.stroke())}}};buildBatches=t=>{this.startPoly(),this.worldId=this.transform.worldId,this.geometry.buildVerticesAndTriangulate();const e=this.geometry.batchParts;for(let s=0;s<e.length;s++){const{style:i,vertexStart:r,vertexCount:n,indexStart:a,indexCount:h}=e[s],{color:o,alpha:c}=i,l=S(o,c*this.worldAlpha),u=M.get(this.type);u.vertexCount=n,u.indexCount=h,u.rgba=l,u.vertexOffset=r,u.indexOffset=a,u.graphics=this,this.batches[s]=u,t.addBatch(this.batches[s])}this.batchCount=e.length};updateBatches=t=>{if(this.worldId!==this.transform.worldId){this.worldId=this.transform.worldId;for(let e=0;e<this.batchCount;e++)this.batches[e].updateVertices(t)}}};export{z as Application,l as BYTES_PER_VERTEX,k as Container,Ht as Graphics,a as LINE_CAP,h as LINE_JOIN,c as MAX_VERTEX_COUNT,o as RENDERER_TYPE,n as SHAPE_TYPE};
|
|
@@ -17,7 +17,7 @@ export declare class Matrix {
|
|
|
17
17
|
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
|
|
18
18
|
set: (a: number, b: number, c: number, d: number, tx: number, ty: number) => Matrix;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Post-multiply this matrix by another
|
|
21
21
|
*/
|
|
22
22
|
append: (m: Matrix) => Matrix;
|
|
23
23
|
/**
|
|
@@ -86,19 +86,19 @@ export declare class Matrix {
|
|
|
86
86
|
*/
|
|
87
87
|
decompose: (transform: TransformableObject) => TransformableObject;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
* @param p
|
|
91
|
-
* @returns {Point}
|
|
89
|
+
* Apply this transform to a point
|
|
90
|
+
* @param p the point
|
|
91
|
+
* @returns {Point} a new point, p transformed by this matrix
|
|
92
92
|
*/
|
|
93
93
|
apply: (p: Point) => Point;
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
96
|
-
* @param p
|
|
97
|
-
* @returns {Point}
|
|
95
|
+
* Apply this transform's inverse to a point
|
|
96
|
+
* @param p the point
|
|
97
|
+
* @returns {Point} a new point, p transformed by the inverse of this matrix
|
|
98
98
|
*/
|
|
99
99
|
applyInverse: (p: Point) => Point;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* Pre-multiply this matrix by another
|
|
102
102
|
*/
|
|
103
103
|
prepend: (m: Matrix) => Matrix;
|
|
104
104
|
clone: () => Matrix;
|
|
@@ -4,39 +4,41 @@ import type { Batch } from '@/utils/visual/render/utils/batch';
|
|
|
4
4
|
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
5
5
|
export declare abstract class BatchRenderer extends Renderer {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* The scene structure version at the last rebuild, held per renderer instance. When it
|
|
8
|
+
* differs from the root's structureVersion the scene changed (a node was added or removed,
|
|
9
|
+
* or a shape redrawn) and the big array must be rebuilt; otherwise only per-frame transform
|
|
10
|
+
* updates are needed. Starting at -1 guarantees a build on the first frame. Comparing
|
|
11
|
+
* versions rather than consuming a dirty flag lets several renderers share one scene.
|
|
10
12
|
*/
|
|
11
13
|
protected builtVersion: number;
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* Vertex count
|
|
14
16
|
*/
|
|
15
17
|
protected vertexCount: number;
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
19
|
+
* Index count
|
|
18
20
|
*/
|
|
19
21
|
protected indexCount: number;
|
|
20
22
|
protected batches: Array<Batch | undefined>;
|
|
21
23
|
protected batchesCount: number;
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* Float32 view over the vertex array
|
|
24
26
|
*/
|
|
25
27
|
protected vertFloatView: Float32Array;
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
29
|
+
* Uint32 view over the vertex array
|
|
28
30
|
*/
|
|
29
31
|
protected vertIntView: Uint32Array;
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
33
|
+
* Index array
|
|
32
34
|
*/
|
|
33
35
|
protected indexBuffer: Uint32Array;
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Current length of the WebGL/WebGPU vertex buffer
|
|
36
38
|
*/
|
|
37
39
|
protected curVertBufferLength: number;
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
41
|
+
* Current length of the WebGL/WebGPU index buffer
|
|
40
42
|
*/
|
|
41
43
|
protected curIndexBufferLength: number;
|
|
42
44
|
constructor(options: IApplicationOptions);
|
|
@@ -44,35 +46,35 @@ export declare abstract class BatchRenderer extends Renderer {
|
|
|
44
46
|
protected startBuild(): void;
|
|
45
47
|
protected buildEnd(): void;
|
|
46
48
|
/**
|
|
47
|
-
*
|
|
49
|
+
* Allocate a bigger typed array when the current one can no longer hold the data
|
|
48
50
|
*/
|
|
49
51
|
protected resizeBufferIfNeeded(): void;
|
|
50
52
|
/**
|
|
51
|
-
*
|
|
53
|
+
* Pack the data into the big array
|
|
52
54
|
*/
|
|
53
55
|
protected packData(): void;
|
|
54
56
|
/**
|
|
55
|
-
*
|
|
57
|
+
* Draw via the WebGL or WebGPU drawing API
|
|
56
58
|
*/
|
|
57
59
|
protected abstract draw(): void;
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
61
|
+
* Update the vertex and index buffers
|
|
60
62
|
*/
|
|
61
63
|
protected abstract updateBuffer(): void;
|
|
62
64
|
/**
|
|
63
|
-
*
|
|
65
|
+
* Set the projection matrix, which adapts to the canvas element's size
|
|
64
66
|
*/
|
|
65
67
|
protected abstract setProjectionMatrix(): void;
|
|
66
68
|
/**
|
|
67
|
-
*
|
|
69
|
+
* Update the uniform holding the stage's transform
|
|
68
70
|
*/
|
|
69
71
|
protected abstract setRootTransform(a: number, b: number, c: number, d: number, tx: number, ty: number): void;
|
|
70
72
|
/**
|
|
71
|
-
*
|
|
73
|
+
* Update the children's transforms
|
|
72
74
|
*/
|
|
73
75
|
protected updateChildrenTransform(rootContainer: Container): void;
|
|
74
76
|
/**
|
|
75
|
-
*
|
|
77
|
+
* Update node positions and render
|
|
76
78
|
*/
|
|
77
79
|
render(rootContainer: Container): void;
|
|
78
80
|
}
|