@lottiefiles/dotlottie-web 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -46
- package/dist/{chunk-2ELNS7EO.js → chunk-STWLHF3O.js} +3 -3
- package/dist/chunk-STWLHF3O.js.map +1 -0
- package/dist/chunk-YUMEQPLC.js +10 -0
- package/dist/chunk-YUMEQPLC.js.map +1 -0
- package/dist/dotlottie.d.ts +112 -15
- package/dist/dotlottie.js +2 -2
- package/dist/event-manager.d.ts +6 -3
- package/dist/event-manager.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-2ELNS7EO.js.map +0 -1
- package/dist/chunk-4GVX2PO3.js +0 -10
- package/dist/chunk-4GVX2PO3.js.map +0 -1
package/README.md
CHANGED
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
* [Usage](#usage)
|
|
20
20
|
* [Via npm](#via-npm)
|
|
21
21
|
* [Via CDN](#via-cdn)
|
|
22
|
-
|
|
23
|
-
* [Live Example](#live-example)
|
|
22
|
+
* [Live Examples](#live-examples)
|
|
24
23
|
* [APIs](#apis)
|
|
25
24
|
* [Config](#config)
|
|
26
25
|
* [Properties](#properties)
|
|
@@ -102,19 +101,11 @@ const dotLottie = new DotLottie({
|
|
|
102
101
|
</html>
|
|
103
102
|
```
|
|
104
103
|
|
|
105
|
-
|
|
104
|
+
## Live Examples
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
```html
|
|
112
|
-
<canvas id="canvas" style="width: 100%; aspect-ratio: 1"></canvas>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Live Example
|
|
116
|
-
|
|
117
|
-
[](https://codesandbox.io/s/lottiefiles-dotlottie-web-basic-example-tcy3rv?autoresize=1\&fontsize=14\&hidenavigation=1\&theme=dark)
|
|
106
|
+
* <a href="https://codesandbox.io/s/lottiefiles-dotlottie-web-basic-example-tcy3rv?autoresize=1&fontsize=14&hidenavigation=1&theme=dark" target="_blank">Basic Example</a>
|
|
107
|
+
* <a href="https://codesandbox.io/p/sandbox/lottiefiles-dotlottie-web-basic-example-forked-4v3t9y?autoresize=1&fontsize=14&hidenavigation=1&theme=dark" target="_blank">Controlling Animation Playback Example</a>
|
|
108
|
+
* <a href="https://codesandbox.io/s/lottiefiles-dotlottie-web-dynamic-animation-loading-example-q7dgvr?autoresize=1&fontsize=14&hidenavigation=1&theme=dark" target="_blank">Dynamic Animation Loading Example</a>
|
|
118
109
|
|
|
119
110
|
## APIs
|
|
120
111
|
|
|
@@ -122,48 +113,70 @@ For this behavior to work correctly, the canvas element must be styled using CSS
|
|
|
122
113
|
|
|
123
114
|
The `DotLottie` constructor accepts a config object with the following properties:
|
|
124
115
|
|
|
125
|
-
| Property name | Type | Required | Default
|
|
126
|
-
| ----------------- | --------------------- | :------: |
|
|
127
|
-
| `autoplay` | boolean | | false
|
|
128
|
-
| `loop` | boolean | | false
|
|
129
|
-
| `canvas` | HTMLCanvasElement | ✔️ | undefined
|
|
130
|
-
| `src` | string | | undefined
|
|
131
|
-
| `speed` | number | | 1
|
|
132
|
-
| `data` | string \| ArrayBuffer | | undefined
|
|
133
|
-
| `mode` | string | | "
|
|
134
|
-
| `backgroundColor` | string | | undefined
|
|
116
|
+
| Property name | Type | Required | Default | Description |
|
|
117
|
+
| ----------------- | --------------------- | :------: | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
118
|
+
| `autoplay` | boolean | | false | Auto-starts the animation on load. |
|
|
119
|
+
| `loop` | boolean | | false | Determines if the animation should loop. |
|
|
120
|
+
| `canvas` | HTMLCanvasElement | ✔️ | undefined | Canvas element for animation rendering. |
|
|
121
|
+
| `src` | string | | undefined | URL to the animation data (`.json` or `.lottie`). |
|
|
122
|
+
| `speed` | number | | 1 | Animation playback speed. 1 is regular speed. |
|
|
123
|
+
| `data` | string \| ArrayBuffer | | undefined | Animation data provided either as a Lottie JSON string or as an ArrayBuffer for .lottie animations. |
|
|
124
|
+
| `mode` | string | | "forward" | Animation play mode. Accepts "forward", "reverse", "bounce", "bounce-reverse". |
|
|
125
|
+
| `backgroundColor` | string | | undefined | Background color of the canvas. e.g., "#000000", "rgba(0, 0, 0, 0.5)" or "transparent". |
|
|
126
|
+
| `segments` | \[number, number] | | \[0, totalFrames - 1] | Animation segments. Accepts an array of two numbers, where the first number is the start frame and the second number is the end frame. |
|
|
127
|
+
| `renderConfig` | RenderConfig | | `{}` | Configuration for rendering the animation. |
|
|
128
|
+
|
|
129
|
+
#### RenderConfig
|
|
130
|
+
|
|
131
|
+
The `renderConfig` object accepts the following properties:
|
|
132
|
+
|
|
133
|
+
| Property name | Type | Required | Default | Description |
|
|
134
|
+
| ------------------ | ------ | :------: | ----------------------------- | ----------------------- |
|
|
135
|
+
| `devicePixelRatio` | number | | window\.devicePixelRatio \| 1 | The device pixel ratio. |
|
|
135
136
|
|
|
136
137
|
### Properties
|
|
137
138
|
|
|
138
139
|
`DotLottie` instances expose the following properties:
|
|
139
140
|
|
|
140
|
-
| Property
|
|
141
|
-
|
|
|
142
|
-
| `currentFrame`
|
|
143
|
-
| `duration`
|
|
144
|
-
| `totalFrames`
|
|
145
|
-
| `loop`
|
|
146
|
-
| `speed`
|
|
147
|
-
| `loopCount`
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
141
|
+
| Property | Type | Description |
|
|
142
|
+
| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
143
|
+
| `currentFrame` | number | Represents the animation's currently displayed frame number. |
|
|
144
|
+
| `duration` | number | Specifies the animation's total playback time in milliseconds. |
|
|
145
|
+
| `totalFrames` | number | Denotes the total count of individual frames within the animation. |
|
|
146
|
+
| `loop` | boolean | Indicates if the animation is set to play in a continuous loop. |
|
|
147
|
+
| `speed` | number | Represents the playback speed factor; e.g., 2 would mean double speed. |
|
|
148
|
+
| `loopCount` | number | Tracks how many times the animation has completed its loop. |
|
|
149
|
+
| `direction` | string | Reflects the current playback direction; e.g., 1 would mean forward, -1 would mean reverse. |
|
|
150
|
+
| `mode` | string | Reflects the current playback mode. |
|
|
151
|
+
| `isPaused` | boolean | Reflects whether the animation is paused or not. |
|
|
152
|
+
| `isStopped` | boolean | Reflects whether the animation is stopped or not. |
|
|
153
|
+
| `isPlaying` | boolean | Reflects whether the animation is playing or not. |
|
|
154
|
+
| `segments` | number | Reflects the frames range of the animations. where segments\[0] is the start frame and segments\[1] is the end frame. |
|
|
155
|
+
| `backgroundColor` | string | Gets the background color of the canvas. |
|
|
156
|
+
| `autoplay` | boolean | Indicates if the animation is set to auto-play. |
|
|
150
157
|
|
|
151
158
|
### Methods
|
|
152
159
|
|
|
153
160
|
`DotLottie` instances expose the following methods that can be used to control the animation:
|
|
154
161
|
|
|
155
|
-
| Method | Description
|
|
156
|
-
| --------------------------------------------------------- |
|
|
157
|
-
| `play()` | Begins playback from the current animation position.
|
|
158
|
-
| `pause()` | Pauses the animation without resetting its position.
|
|
159
|
-
| `stop()` | Halts playback and returns the animation to its initial frame.
|
|
160
|
-
| `setSpeed(speed: number)` | Sets the playback speed with the given multiplier.
|
|
161
|
-
| `setLoop(loop: boolean)` | Configures whether the animation should loop continuously.
|
|
162
|
-
| `setFrame(frame: number)` | Directly navigates the animation to a specified frame.
|
|
163
|
-
| `addEventListener(event: string, listener: Function)` | Registers a function to respond to a specific animation event.
|
|
164
|
-
| `removeEventListener(event: string, listener?: Function)` | Removes a previously registered function from responding to a specific animation event.
|
|
165
|
-
| `destroy()` | Destroys the renderer instance and unregisters all event listeners. This method should be called when the canvas is removed from the DOM to prevent memory leaks.
|
|
166
|
-
| `load(config: Config)` | Loads a new configuration or a new animation.
|
|
162
|
+
| Method | Description |
|
|
163
|
+
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
164
|
+
| `play()` | Begins playback from the current animation position. |
|
|
165
|
+
| `pause()` | Pauses the animation without resetting its position. |
|
|
166
|
+
| `stop()` | Halts playback and returns the animation to its initial frame. |
|
|
167
|
+
| `setSpeed(speed: number)` | Sets the playback speed with the given multiplier. |
|
|
168
|
+
| `setLoop(loop: boolean)` | Configures whether the animation should loop continuously. |
|
|
169
|
+
| `setFrame(frame: number)` | Directly navigates the animation to a specified frame. |
|
|
170
|
+
| `addEventListener(event: string, listener: Function)` | Registers a function to respond to a specific animation event. |
|
|
171
|
+
| `removeEventListener(event: string, listener?: Function)` | Removes a previously registered function from responding to a specific animation event. |
|
|
172
|
+
| `destroy()` | Destroys the renderer instance and unregisters all event listeners. This method should be called when the canvas is removed from the DOM to prevent memory leaks. |
|
|
173
|
+
| `load(config: Config)` | Loads a new configuration or a new animation. |
|
|
174
|
+
| `setMode(mode: string)` | Sets the animation play mode. |
|
|
175
|
+
| `setSegments(startFrame: number, endFrame: number)` | Sets the start and end frame of the animation. |
|
|
176
|
+
| `freeze()` | Freezes the animation by stopping the animation loop. |
|
|
177
|
+
| `unfreeze()` | Unfreezes the animation by resuming the animation loop. |
|
|
178
|
+
| `setBackgroundColor(color: string)` | Sets the background color of the canvas. |
|
|
179
|
+
| `resize()` | This method adjusts the canvas size to match its bounding box dimensions, considering the device's pixel ratio. This prevents the canvas from appearing blurry on high-resolution screens. Call this method when the window or the canvas element is resized. |
|
|
167
180
|
|
|
168
181
|
### Static Methods
|
|
169
182
|
|
|
@@ -187,6 +200,7 @@ The `DotLottie` instance emits the following events that can be listened to via
|
|
|
187
200
|
| `loop` | Emitted when the animation completes a loop. |
|
|
188
201
|
| `complete` | Emitted when the animation completes. |
|
|
189
202
|
| `frame` | Emitted when the animation reaches a new frame. |
|
|
203
|
+
| `destroy` | Emitted when the animation is destroyed. |
|
|
190
204
|
|
|
191
205
|
## Development
|
|
192
206
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a } from './chunk-7Q3PPTBP.js';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var r=class{constructor(){a(this,"_eventListeners",new Map);}addEventListener(t,n){let e=this._eventListeners.get(t);e||(e=new Set,this._eventListeners.set(t,e)),e.add(n);}removeEventListener(t,n){let e=this._eventListeners.get(t);e&&(n?(e.delete(n),e.size===0&&this._eventListeners.delete(t)):this._eventListeners.delete(t));}dispatch(t){this._eventListeners.get(t.type)?.forEach(e=>e(t));}removeAllEventListeners(){this._eventListeners.clear();}};
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { r as a };
|
|
6
6
|
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-STWLHF3O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/event-manager.ts"],"names":["EventManager","__publicField","type","listener","listeners","event"],"mappings":"wCAgIO,IAAMA,EAAN,KAAmB,CAAnB,cACLC,EAAA,KAAiB,kBAAiE,IAAI,KAE/E,iBAAsCC,EAASC,EAAkC,CACtF,IAAIC,EAAY,KAAK,gBAAgB,IAAIF,CAAI,EAExCE,IACHA,EAAY,IAAI,IAChB,KAAK,gBAAgB,IAAIF,EAAME,CAAS,GAG1CA,EAAU,IAAID,CAAQ,CACxB,CAEO,oBAAyCD,EAASC,EAAmC,CAC1F,IAAMC,EAAY,KAAK,gBAAgB,IAAIF,CAAI,EAE1CE,IAEDD,GACFC,EAAU,OAAOD,CAAQ,EAErBC,EAAU,OAAS,GACrB,KAAK,gBAAgB,OAAOF,CAAI,GAGlC,KAAK,gBAAgB,OAAOA,CAAI,EAEpC,CAEO,SAA8BG,EAA6B,CAC9C,KAAK,gBAAgB,IAAIA,EAAM,IAAI,GAE1C,QAASF,GAAaA,EAASE,CAAK,CAAC,CAClD,CAEO,yBAAgC,CACrC,KAAK,gBAAgB,MAAM,CAC7B,CACF","sourcesContent":["/**\n * Copyright 2023 Design Barn Inc.\n */\n\n/**\n * Represents the different types of events that can be dispatched.\n */\nexport type EventType = 'complete' | 'frame' | 'load' | 'loadError' | 'loop' | 'pause' | 'play' | 'stop' | 'destroy';\n\n/**\n * Maps an event type string to its respective event interface.\n */\ntype EventByType<T> = T extends 'complete'\n ? CompleteEvent\n : T extends 'frame'\n ? FrameEvent\n : T extends 'load'\n ? LoadEvent\n : T extends 'loadError'\n ? LoadErrorEvent\n : T extends 'loop'\n ? LoopEvent\n : T extends 'pause'\n ? PauseEvent\n : T extends 'play'\n ? PlayEvent\n : T extends 'stop'\n ? StopEvent\n : T extends 'destroy'\n ? DestroyEvent\n : never;\n\n/**\n * Base interface for all events.\n */\nexport interface BaseEvent {\n type: EventType;\n}\n\n/*\n * Event fired when a destroy action occurs.\n */\nexport interface DestroyEvent extends BaseEvent {\n type: 'destroy';\n}\n\n/**\n * Event fired when a loop action occurs.\n */\nexport interface LoopEvent extends BaseEvent {\n loopCount: number;\n type: 'loop';\n}\n\n/**\n * Event fired during frame changes.\n */\nexport interface FrameEvent extends BaseEvent {\n currentFrame: number;\n type: 'frame';\n}\n\n/**\n * Event fired when a load action occurs.\n */\nexport interface LoadEvent extends BaseEvent {\n type: 'load';\n}\n\n/**\n * Event fired when a loading error occurs.\n */\nexport interface LoadErrorEvent extends BaseEvent {\n error: Error;\n type: 'loadError';\n}\n\n/**\n * Event fired when a completion action occurs.\n */\nexport interface CompleteEvent extends BaseEvent {\n type: 'complete';\n}\n\n/**\n * Event fired when a pause action occurs.\n */\nexport interface PauseEvent extends BaseEvent {\n type: 'pause';\n}\n\n/**\n * Event fired when a play action occurs.\n */\nexport interface PlayEvent extends BaseEvent {\n type: 'play';\n}\n\n/**\n * Event fired when a stop action occurs.\n */\nexport interface StopEvent extends BaseEvent {\n type: 'stop';\n}\n\n/**\n * Represents all possible event types.\n */\nexport type Event =\n | LoopEvent\n | FrameEvent\n | LoadEvent\n | LoadErrorEvent\n | CompleteEvent\n | PauseEvent\n | PlayEvent\n | StopEvent;\n\n/**\n * Type for event listener callbacks.\n */\nexport interface EventListener<T extends EventType> {\n (event: EventByType<T>): void;\n}\n\n/**\n * Manages registration and dispatching of event listeners.\n */\nexport class EventManager {\n private readonly _eventListeners: Map<EventType, Set<EventListener<EventType>>> = new Map();\n\n public addEventListener<T extends EventType>(type: T, listener: EventListener<T>): void {\n let listeners = this._eventListeners.get(type);\n\n if (!listeners) {\n listeners = new Set<EventListener<T>>();\n this._eventListeners.set(type, listeners);\n }\n\n listeners.add(listener);\n }\n\n public removeEventListener<T extends EventType>(type: T, listener?: EventListener<T>): void {\n const listeners = this._eventListeners.get(type);\n\n if (!listeners) return;\n\n if (listener) {\n listeners.delete(listener);\n\n if (listeners.size === 0) {\n this._eventListeners.delete(type);\n }\n } else {\n this._eventListeners.delete(type);\n }\n }\n\n public dispatch<T extends EventType>(event: EventByType<T>): void {\n const listeners = this._eventListeners.get(event.type);\n\n listeners?.forEach((listener) => listener(event));\n }\n\n public removeAllEventListeners(): void {\n this._eventListeners.clear();\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as a$1 } from './chunk-STWLHF3O.js';
|
|
2
|
+
import { b, a as a$2 } from './chunk-SMXCTWPA.js';
|
|
3
|
+
import { a } from './chunk-7Q3PPTBP.js';
|
|
4
|
+
|
|
5
|
+
var ue={name:"@lottiefiles/dotlottie-web",version:"0.8.0",type:"module",description:"Lottie and DotLottie player for the web",repository:{type:"git",url:"git+https://github.com/LottieFiles/dotlottie-web.git",directory:"packages/web"},homepage:"https://github.com/LottieFiles/dotlottie-web#readme",bugs:"https://github.com/LottieFiles/dotlottie-web/issues",author:"LottieFiles",contributors:["Abdelrahman Ashraf <a.theashraf@gmail.com>"],license:"MIT",engines:{node:">=18"},main:"dist/index.js",module:"dist/index.js",types:"dist/index.d.ts",files:["dist"],keywords:["dotlottie","lottie","player","animation","web","canvas","javascript"],scripts:{build:"tsup","build:wasm":"./build_wasm.sh","build:wasm:docker":"./docker_build_wasm.sh",dev:"tsup --watch",lint:"eslint --fix .","size:why":"size-limit --why --clean-dir --save-bundle ./tmp","stats:eslint":"cross-env TIMING=1 eslint .","stats:ts":"tsc -p tsconfig.build.json --extendedDiagnostics","type-check":"tsc --noEmit"},dependencies:{"@dotlottie/dotlottie-js":"^0.6.0"},devDependencies:{"cross-env":"7.0.3",tsup:"7.2.0",typescript:"5.0.4"},publishConfig:{access:"public"}};var Tn=(()=>{var le=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(u={}){var i=u,_,F;i.ready=new Promise((e,r)=>{_=e,F=r;});var T=Object.assign({},i),Me=!0,S="";function Tr(e){return i.locateFile?i.locateFile(e,S):S+e}(typeof document<"u"&&document.currentScript&&(S=document.currentScript.src),le&&(S=le),S.indexOf("blob:")!==0?S=S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1):S="",(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){r(n.response);return}t();},n.onerror=t,n.send(null);});var Ar=i.print||console.log.bind(console),V=i.printErr||console.error.bind(console);Object.assign(i,T),T=null,i.arguments&&(i.arguments),i.thisProgram&&(i.thisProgram),i.quit&&(i.quit);var Q;i.wasmBinary&&(Q=i.wasmBinary),typeof WebAssembly!="object"&&ee("no native wasm support detected");var fe,Ie=!1;function Rr(e,r){e||ee(r);}var $e,C,Y,he,j,$,Le,Ue;function Oe(){var e=fe.buffer;i.HEAP8=$e=new Int8Array(e),i.HEAP16=Y=new Int16Array(e),i.HEAPU8=C=new Uint8Array(e),i.HEAPU16=he=new Uint16Array(e),i.HEAP32=j=new Int32Array(e),i.HEAPU32=$=new Uint32Array(e),i.HEAPF32=Le=new Float32Array(e),i.HEAPF64=Ue=new Float64Array(e);}var We=[],je=[],xe=[];function kr(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ir(i.preRun.shift());Pe(We);}function Dr(){Pe(je);}function Mr(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)Ur(i.postRun.shift());Pe(xe);}function Ir(e){We.unshift(e);}function Lr(e){je.unshift(e);}function Ur(e){xe.unshift(e);}var x=0,Z=null;function Or(e){x++,i.monitorRunDependencies&&i.monitorRunDependencies(x);}function Wr(e){if(x--,i.monitorRunDependencies&&i.monitorRunDependencies(x),x==0&&(Z)){var r=Z;Z=null,r();}}function ee(e){i.onAbort&&i.onAbort(e),e="Aborted("+e+")",V(e),Ie=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw F(r),r}var jr="data:application/octet-stream;base64,",He=e=>e.startsWith(jr),q;q="renderer.wasm",He(q)||(q=Tr(q));function ze(e){if(e==q&&Q)return new Uint8Array(Q);throw "both async and sync fetching of the wasm failed"}function xr(e){return !Q&&(Me)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(r=>{if(!r.ok)throw "failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()}).catch(()=>ze(e)):Promise.resolve().then(()=>ze(e))}function Be(e,r,t){return xr(e).then(n=>WebAssembly.instantiate(n,r)).then(n=>n).then(t,n=>{V(`failed to asynchronously prepare wasm: ${n}`),ee(n);})}function Hr(e,r,t,n){return !e&&typeof WebAssembly.instantiateStreaming=="function"&&!He(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(a=>{var o=WebAssembly.instantiateStreaming(a,t);return o.then(n,function(l){return V(`wasm streaming compile failed: ${l}`),V("falling back to ArrayBuffer instantiation"),Be(r,t,n)})}):Be(r,t,n)}function zr(){var e={a:ln};function r(n,a){return y=n.exports,fe=y.I,Oe(),tr=y.O,Lr(y.J),Wr(),y}Or();function t(n){r(n.instance);}if(i.instantiateWasm)try{return i.instantiateWasm(e,r)}catch(n){V(`Module.instantiateWasm callback failed with error: ${n}`),F(n);}return Hr(Q,q,e,t).catch(F),{}}var Pe=e=>{for(;e.length>0;)e.shift()(i);};i.noExitRuntime||!0;var Ve=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,qe=(e,r,t)=>{for(var n=r+t,a=r;e[a]&&!(a>=n);)++a;if(a-r>16&&e.buffer&&Ve)return Ve.decode(e.subarray(r,a));for(var o="";r<a;){var l=e[r++];if(!(l&128)){o+=String.fromCharCode(l);continue}var s=e[r++]&63;if((l&224)==192){o+=String.fromCharCode((l&31)<<6|s);continue}var c=e[r++]&63;if((l&240)==224?l=(l&15)<<12|s<<6|c:l=(l&7)<<18|s<<12|c<<6|e[r++]&63,l<65536)o+=String.fromCharCode(l);else {var d=l-65536;o+=String.fromCharCode(55296|d>>10,56320|d&1023);}}return o},re=(e,r)=>e?qe(C,e,r):"",Br=(e,r,t,n)=>{ee(`Assertion failed: ${re(e)}, at: `+[r?re(r):"unknown filename",t,n?re(n):"unknown function"]);};function Vr(e,r,t){return 0}function qr(e,r,t){return 0}function Nr(e,r,t,n){}var Gr=(e,r,t,n,a)=>{},Jr=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Ne=e;},Ne,A=e=>{for(var r="",t=e;C[t];)r+=Ne[C[t++]];return r},G={},H={},ve={},J,h=e=>{throw new J(e)},Ge,pe=e=>{throw new Ge(e)},te=(e,r,t)=>{e.forEach(function(s){ve[s]=r;});function n(s){var c=t(s);c.length!==e.length&&pe("Mismatched type converter count");for(var d=0;d<e.length;++d)k(e[d],c[d]);}var a=new Array(r.length),o=[],l=0;r.forEach((s,c)=>{H.hasOwnProperty(s)?a[c]=H[s]:(o.push(s),G.hasOwnProperty(s)||(G[s]=[]),G[s].push(()=>{a[c]=H[s],++l,l===o.length&&n(a);}));}),o.length===0&&n(a);};function Xr(e,r,t={}){var n=r.name;if(e||h(`type "${n}" must have a positive integer typeid pointer`),H.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;h(`Cannot register type '${n}' twice`);}if(H[e]=r,delete ve[e],G.hasOwnProperty(e)){var a=G[e];delete G[e],a.forEach(o=>o());}}function k(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Xr(e,r,t)}var M=8,Kr=(e,r,t,n)=>{r=A(r),k(e,{name:r,fromWireType:function(a){return !!a},toWireType:function(a,o){return o?t:n},argPackAdvance:M,readValueFromPointer:function(a){return this.fromWireType(C[a])},destructorFunction:null});},Qr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Fe=e=>{function r(t){return t.$$.ptrType.registeredClass.name}h(r(e)+" instance already deleted");},Ae=!1,Je=e=>{},Yr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr);},Xe=e=>{e.count.value-=1;var r=e.count.value===0;r&&Yr(e);},Ke=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=Ke(e,r,t.baseClass);return n===null?null:t.downcast(n)},Qe={},Zr=()=>Object.keys(ae).length,et=()=>{var e=[];for(var r in ae)ae.hasOwnProperty(r)&&e.push(ae[r]);return e},ne=[],Ee=()=>{for(;ne.length;){var e=ne.pop();e.$$.deleteScheduled=!1,e.delete();}},ie,rt=e=>{ie=e,ne.length&&ie&&ie(Ee);},tt=()=>{i.getInheritedInstanceCount=Zr,i.getLiveInheritedInstances=et,i.flushPendingDeletes=Ee,i.setDelayFunction=rt;},ae={},nt=(e,r)=>{for(r===void 0&&h("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},it=(e,r)=>(r=nt(e,r),ae[r]),_e=(e,r)=>{(!r.ptrType||!r.ptr)&&pe("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&pe("Both smartPtrType and smartPtr must be specified"),r.count={value:1},se(Object.create(e,{$$:{value:r}}))};function at(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=it(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?_e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):_e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o=this.registeredClass.getActualType(r),l=Qe[o];if(!l)return a.call(this);var s;this.isConst?s=l.constPointerType:s=l.pointerType;var c=Ke(r,this.registeredClass,s.registeredClass);return c===null?a.call(this):this.isSmartPointer?_e(s.registeredClass.instancePrototype,{ptrType:s,ptr:c,smartPtrType:this,smartPtr:e}):_e(s.registeredClass.instancePrototype,{ptrType:s,ptr:c})}var se=e=>typeof FinalizationRegistry>"u"?(se=r=>r,e):(Ae=new FinalizationRegistry(r=>{Xe(r.$$);}),se=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var a={$$:t};Ae.register(r,a,r);}return r},Je=r=>Ae.unregister(r),se(e)),st=()=>{Object.assign(me.prototype,{isAliasOf(e){if(!(this instanceof me)||!(e instanceof me))return !1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,a=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return r===n&&t===a},clone(){if(this.$$.ptr||Fe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=se(Object.create(Object.getPrototypeOf(this),{$$:{value:Qr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Fe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&h("Object already scheduled for deletion"),Je(this),Xe(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0);},isDeleted(){return !this.$$.ptr},deleteLater(){return this.$$.ptr||Fe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&h("Object already scheduled for deletion"),ne.push(this),ne.length===1&&ie&&ie(Ee),this.$$.deleteScheduled=!0,this}});};function me(){}var ot=48,ut=57,Ye=e=>{if(e===void 0)return "_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=ot&&r<=ut?`_${e}`:e};function Ze(e,r){return e=Ye(e),{[e]:function(){return r.apply(this,arguments)}}[e]}var er=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||h(`Function '${t}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n;}},lt=(e,r,t)=>{i.hasOwnProperty(e)?((t===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[t]!==void 0)&&h(`Cannot register public name '${e}' twice`),er(i,e,e),i.hasOwnProperty(t)&&h(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[e].overloadTable[t]=r):(i[e]=r,t!==void 0&&(i[e].numArguments=t));};function ct(e,r,t,n,a,o,l,s){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=a,this.getActualType=o,this.upcast=l,this.downcast=s,this.pureVirtualFunctions=[];}var Re=(e,r,t)=>{for(;r!==t;)r.upcast||h(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function dt(e,r){if(r===null)return this.isReference&&h(`null is not a valid ${this.name}`),0;r.$$||h(`Cannot pass "${ke(r)}" as a ${this.name}`),r.$$.ptr||h(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Re(r.$$.ptr,t,this.registeredClass);return n}function ft(e,r){var t;if(r===null)return this.isReference&&h(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;r.$$||h(`Cannot pass "${ke(r)}" as a ${this.name}`),r.$$.ptr||h(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&h(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Re(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&h("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:h(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else {var a=r.clone();t=this.rawShare(t,ye.toHandle(()=>a.delete())),e!==null&&e.push(this.rawDestructor,t);}break;default:h("Unsupporting sharing policy");}return t}function ht(e,r){if(r===null)return this.isReference&&h(`null is not a valid ${this.name}`),0;r.$$||h(`Cannot pass "${ke(r)}" as a ${this.name}`),r.$$.ptr||h(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&h(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Re(r.$$.ptr,t,this.registeredClass);return n}function rr(e){return this.fromWireType($[e>>2])}var vt=()=>{Object.assign(ge.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e);},argPackAdvance:M,readValueFromPointer:rr,deleteObject(e){e!==null&&e.delete();},fromWireType:at});};function ge(e,r,t,n,a,o,l,s,c,d,f){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=a,this.pointeeType=o,this.sharingPolicy=l,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=d,this.rawDestructor=f,!a&&r.baseClass===void 0?n?(this.toWireType=dt,this.destructorFunction=null):(this.toWireType=ht,this.destructorFunction=null):this.toWireType=ft;}var pt=(e,r,t)=>{i.hasOwnProperty(e)||pe("Replacing nonexistant public symbol"),i[e].overloadTable!==void 0&&t!==void 0?i[e].overloadTable[t]=r:(i[e]=r,i[e].argCount=t);},_t=(e,r,t)=>{var n=i["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)},tr,I=e=>tr.get(e),mt=(e,r,t)=>{if(e.includes("j"))return _t(e,r,t);var n=I(r).apply(null,t);return n},gt=(e,r)=>{var t=[];return function(){return t.length=0,Object.assign(t,arguments),mt(e,r,t)}},X=(e,r)=>{e=A(e);function t(){return e.includes("j")?gt(e,r):I(r)}var n=t();return typeof n!="function"&&h(`unknown function pointer with signature ${e}: ${r}`),n},yt=(e,r)=>{var t=Ze(r,function(n){this.name=r,this.message=n;var a=new Error(n).stack;a!==void 0&&(this.stack=this.toString()+`
|
|
6
|
+
`+a.replace(/^Error(:[^\n]*)?\n/,""));});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},nr,ir=e=>{var r=dr(e),t=A(r);return D(r),t},Se=(e,r)=>{var t=[],n={};function a(o){if(!n[o]&&!H[o]){if(ve[o]){ve[o].forEach(a);return}t.push(o),n[o]=!0;}}throw r.forEach(a),new nr(`${e}: `+t.map(ir).join([", "]))},bt=(e,r,t,n,a,o,l,s,c,d,f,v,g)=>{f=A(f),o=X(a,o),s&&(s=X(l,s)),d&&(d=X(c,d)),g=X(v,g);var m=Ye(f);lt(m,function(){Se(`Cannot construct ${f} due to unbound types`,[n]);}),te([e,r,t],n?[n]:[],function(b){b=b[0];var R,w;n?(R=b.registeredClass,w=R.instancePrototype):w=me.prototype;var K=Ze(m,function(){if(Object.getPrototypeOf(this)!==oe)throw new J("Use 'new' to construct "+f);if(P.constructor_body===void 0)throw new J(f+" has no accessible constructor");var pr=P.constructor_body[arguments.length];if(pr===void 0)throw new J(`Tried to invoke ctor of ${f} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(P.constructor_body).toString()}) parameters instead!`);return pr.apply(this,arguments)}),oe=Object.create(w,{constructor:{value:K}});K.prototype=oe;var P=new ct(f,K,oe,g,R,o,s,d);P.baseClass&&(P.baseClass.__derivedClasses===void 0&&(P.baseClass.__derivedClasses=[]),P.baseClass.__derivedClasses.push(P));var W=new ge(f,P,!0,!1,!1),we=new ge(f+"*",P,!1,!1,!1),vr=new ge(f+" const*",P,!1,!0,!1);return Qe[e]={pointerType:we,constPointerType:vr},pt(m,K),[W,we,vr]});},ar=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push($[r+n*4>>2]);return t},wt=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r);}};function sr(e,r,t,n,a,o){var l=r.length;l<2&&h("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=r[1]!==null&&t!==null,c=!1,d=1;d<r.length;++d)if(r[d]!==null&&r[d].destructorFunction===void 0){c=!0;break}var f=r[0].name!=="void",v=l-2,g=new Array(v),m=[],b=[];return function(){arguments.length!==v&&h(`function ${e} called with ${arguments.length} arguments, expected ${v}`),b.length=0;var R;m.length=s?2:1,m[0]=a,s&&(R=r[1].toWireType(b,this),m[1]=R);for(var w=0;w<v;++w)g[w]=r[w+2].toWireType(b,arguments[w]),m.push(g[w]);var K=n.apply(null,m);function oe(P){if(c)wt(b);else for(var W=s?1:2;W<r.length;W++){var we=W===1?R:g[W-2];r[W].destructorFunction!==null&&r[W].destructorFunction(we);}if(f)return r[0].fromWireType(P)}return oe(K)}}var Ct=(e,r,t,n,a,o)=>{var l=ar(r,t);a=X(n,a),te([],[e],function(s){s=s[0];var c=`constructor ${s.name}`;if(s.registeredClass.constructor_body===void 0&&(s.registeredClass.constructor_body=[]),s.registeredClass.constructor_body[r-1]!==void 0)throw new J(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${s.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return s.registeredClass.constructor_body[r-1]=()=>{Se(`Cannot construct ${s.name} due to unbound types`,l);},te([],l,d=>(d.splice(1,0,null),s.registeredClass.constructor_body[r-1]=sr(c,d,null,a,o),[])),[]});},$t=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?(Rr(e[e.length-1]==")","Parentheses for argument names should match."),e.substr(0,r)):e},Tt=(e,r,t,n,a,o,l,s,c)=>{var d=ar(t,n);r=A(r),r=$t(r),o=X(a,o),te([],[e],function(f){f=f[0];var v=`${f.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),s&&f.registeredClass.pureVirtualFunctions.push(r);function g(){Se(`Cannot call ${v} due to unbound types`,d);}var m=f.registeredClass.instancePrototype,b=m[r];return b===void 0||b.overloadTable===void 0&&b.className!==f.name&&b.argCount===t-2?(g.argCount=t-2,g.className=f.name,m[r]=g):(er(m,r,v),m[r].overloadTable[t-2]=g),te([],d,function(R){var w=sr(v,R,f,o,l);return m[r].overloadTable===void 0?(w.argCount=t-2,m[r]=w):m[r].overloadTable[t-2]=w,[]}),[]});};function Pt(){Object.assign(or.prototype,{get(e){return this.allocated[e]},has(e){return this.allocated[e]!==void 0},allocate(e){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=e,r},free(e){this.allocated[e]=void 0,this.freelist.push(e);}});}function or(){this.allocated=[void 0],this.freelist=[];}var E=new or,ur=e=>{e>=E.reserved&&--E.get(e).refcount===0&&E.free(e);},Ft=()=>{for(var e=0,r=E.reserved;r<E.allocated.length;++r)E.allocated[r]!==void 0&&++e;return e},At=()=>{E.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),E.reserved=E.allocated.length,i.count_emval_handles=Ft;},ye={toValue:e=>(e||h("Cannot use deleted val. handle = "+e),E.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return E.allocate({refcount:1,value:e})}}};function lr(e){return this.fromWireType(j[e>>2])}var Et=(e,r)=>{r=A(r),k(e,{name:r,fromWireType:t=>{var n=ye.toValue(t);return ur(t),n},toWireType:(t,n)=>ye.toHandle(n),argPackAdvance:M,readValueFromPointer:lr,destructorFunction:null});},ke=e=>{if(e===null)return "null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Rt=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Le[t>>2])};case 8:return function(t){return this.fromWireType(Ue[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},St=(e,r,t)=>{r=A(r),k(e,{name:r,fromWireType:n=>n,toWireType:(n,a)=>a,argPackAdvance:M,readValueFromPointer:Rt(r,t),destructorFunction:null});},kt=(e,r,t)=>{switch(r){case 1:return t?n=>$e[n>>0]:n=>C[n>>0];case 2:return t?n=>Y[n>>1]:n=>he[n>>1];case 4:return t?n=>j[n>>2]:n=>$[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Dt=(e,r,t,n,a)=>{r=A(r);var o=f=>f;if(n===0){var l=32-8*t;o=f=>f<<l>>>l;}var s=r.includes("unsigned"),c=(f,v)=>{},d;s?d=function(f,v){return c(v,this.name),v>>>0}:d=function(f,v){return c(v,this.name),v},k(e,{name:r,fromWireType:o,toWireType:d,argPackAdvance:M,readValueFromPointer:kt(r,t,n!==0),destructorFunction:null});},Mt=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[r];function o(l){var s=$[l>>2],c=$[l+4>>2];return new a($e.buffer,c,s)}t=A(t),k(e,{name:t,fromWireType:o,argPackAdvance:M,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0});},It=(e,r,t,n)=>{if(!(n>0))return 0;for(var a=t,o=t+n-1,l=0;l<e.length;++l){var s=e.charCodeAt(l);if(s>=55296&&s<=57343){var c=e.charCodeAt(++l);s=65536+((s&1023)<<10)|c&1023;}if(s<=127){if(t>=o)break;r[t++]=s;}else if(s<=2047){if(t+1>=o)break;r[t++]=192|s>>6,r[t++]=128|s&63;}else if(s<=65535){if(t+2>=o)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|s&63;}else {if(t+3>=o)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|s&63;}}return r[t]=0,t-a},Lt=(e,r,t)=>It(e,C,r,t),Ut=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3;}return r},Ot=(e,r)=>{r=A(r);var t=r==="std::string";k(e,{name:r,fromWireType(n){var a=$[n>>2],o=n+4,l;if(t)for(var s=o,c=0;c<=a;++c){var d=o+c;if(c==a||C[d]==0){var f=d-s,v=re(s,f);l===void 0?l=v:(l+=String.fromCharCode(0),l+=v),s=d+1;}}else {for(var g=new Array(a),c=0;c<a;++c)g[c]=String.fromCharCode(C[o+c]);l=g.join("");}return D(n),l},toWireType(n,a){a instanceof ArrayBuffer&&(a=new Uint8Array(a));var o,l=typeof a=="string";l||a instanceof Uint8Array||a instanceof Uint8ClampedArray||a instanceof Int8Array||h("Cannot pass non-string to std::string"),t&&l?o=Ut(a):o=a.length;var s=De(4+o+1),c=s+4;if($[s>>2]=o,t&&l)Lt(a,c,o+1);else if(l)for(var d=0;d<o;++d){var f=a.charCodeAt(d);f>255&&(D(c),h("String has UTF-16 code units that do not fit in 8 bits")),C[c+d]=f;}else for(var d=0;d<o;++d)C[c+d]=a[d];return n!==null&&n.push(D,s),s},argPackAdvance:M,readValueFromPointer:rr,destructorFunction(n){D(n);}});},cr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Wt=(e,r)=>{for(var t=e,n=t>>1,a=n+r/2;!(n>=a)&&he[n];)++n;if(t=n<<1,t-e>32&&cr)return cr.decode(C.subarray(e,t));for(var o="",l=0;!(l>=r/2);++l){var s=Y[e+l*2>>1];if(s==0)break;o+=String.fromCharCode(s);}return o},jt=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<2)return 0;t-=2;for(var n=r,a=t<e.length*2?t/2:e.length,o=0;o<a;++o){var l=e.charCodeAt(o);Y[r>>1]=l,r+=2;}return Y[r>>1]=0,r-n},xt=e=>e.length*2,Ht=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var a=j[e+t*4>>2];if(a==0)break;if(++t,a>=65536){var o=a-65536;n+=String.fromCharCode(55296|o>>10,56320|o&1023);}else n+=String.fromCharCode(a);}return n},zt=(e,r,t)=>{if(t===void 0&&(t=2147483647),t<4)return 0;for(var n=r,a=n+t-4,o=0;o<e.length;++o){var l=e.charCodeAt(o);if(l>=55296&&l<=57343){var s=e.charCodeAt(++o);l=65536+((l&1023)<<10)|s&1023;}if(j[r>>2]=l,r+=4,r+4>a)break}return j[r>>2]=0,r-n},Bt=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4;}return r},Vt=(e,r,t)=>{t=A(t);var n,a,o,l,s;r===2?(n=Wt,a=jt,l=xt,o=()=>he,s=1):r===4&&(n=Ht,a=zt,l=Bt,o=()=>$,s=2),k(e,{name:t,fromWireType:c=>{for(var d=$[c>>2],f=o(),v,g=c+4,m=0;m<=d;++m){var b=c+4+m*r;if(m==d||f[b>>s]==0){var R=b-g,w=n(g,R);v===void 0?v=w:(v+=String.fromCharCode(0),v+=w),g=b+r;}}return D(c),v},toWireType:(c,d)=>{typeof d!="string"&&h(`Cannot pass non-string to C++ string type ${t}`);var f=l(d),v=De(4+f+r);return $[v>>2]=f>>s,a(d,v+4,f+r),c!==null&&c.push(D,v),v},argPackAdvance:M,readValueFromPointer:lr,destructorFunction(c){D(c);}});},qt=(e,r)=>{r=A(r),k(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}});},Nt=()=>{throw 1/0},Gt=e=>{e>4&&(E.get(e).refcount+=1);},Jt=(e,r)=>{var t=H[e];return t===void 0&&h(r+" has unknown type "+ir(e)),t},Xt=(e,r)=>{e=Jt(e,"_emval_take_value");var t=e.readValueFromPointer(r);return ye.toHandle(t)},Kt=()=>{ee("");},Qt=(e,r,t)=>C.copyWithin(e,r,r+t),Yt=()=>2147483648,Zt=e=>{var r=fe.buffer,t=(e-r.byteLength+65535)/65536;try{return fe.grow(t),Oe(),1}catch{}},en=e=>{var r=C.length;e>>>=0;var t=Yt();if(e>t)return !1;for(var n=(c,d)=>c+(d-c%d)%d,a=1;a<=4;a*=2){var o=r*(1+.2/a);o=Math.min(o,e+100663296);var l=Math.min(t,n(Math.max(e,o),65536)),s=Zt(l);if(s)return !0}return !1},rn=e=>52,tn=(e,r,t,n)=>52;function an(e,r,t,n,a){return 70}var sn=[null,[],[]],on=(e,r)=>{var t=sn[e];r===0||r===10?((e===1?Ar:V)(qe(t,0)),t.length=0):t.push(r);},un=(e,r,t,n)=>{for(var a=0,o=0;o<t;o++){var l=$[r>>2],s=$[r+4>>2];r+=8;for(var c=0;c<s;c++)on(e,C[l+c]);a+=s;}return $[n>>2]=a,0};Jr(),J=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError";}},Ge=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError";}},st(),tt(),vt(),nr=i.UnboundTypeError=yt(Error,"UnboundTypeError"),Pt(),At();var ln={b:Br,n:Vr,D:qr,E:Nr,w:Gr,q:Kr,H:bt,G:Ct,e:Tt,F:Et,o:St,f:Dt,d:Mt,p:Ot,k:Vt,r:qt,y:Nt,s:ur,t:Gt,g:Xt,h:Kt,A:Qt,z:en,m:rn,C:tn,v:an,B:un,j:gn,i:yn,l:bn,a:_n,c:mn,x:wn,u:Cn},y=zr(),D=e=>(D=y.K)(e),De=e=>(De=y.L)(e),dr=e=>(dr=y.M)(e);i.__embind_initialize_bindings=()=>(i.__embind_initialize_bindings=y.N)();var L=(e,r)=>(L=y.P)(e,r),U=()=>(U=y.Q)(),O=e=>(O=y.R)(e),fr=i.dynCall_viiij=(e,r,t,n,a,o)=>(fr=i.dynCall_viiij=y.S)(e,r,t,n,a,o);i.dynCall_jiji=(e,r,t,n,a)=>(i.dynCall_jiji=y.T)(e,r,t,n,a);function _n(e,r){var t=U();try{I(e)(r);}catch(n){if(O(t),n!==n+0)throw n;L(1,0);}}function mn(e,r,t){var n=U();try{I(e)(r,t);}catch(a){if(O(n),a!==a+0)throw a;L(1,0);}}function gn(e,r){var t=U();try{return I(e)(r)}catch(n){if(O(t),n!==n+0)throw n;L(1,0);}}function yn(e,r,t,n){var a=U();try{return I(e)(r,t,n)}catch(o){if(O(a),o!==o+0)throw o;L(1,0);}}function bn(e,r,t,n,a,o){var l=U();try{return I(e)(r,t,n,a,o)}catch(s){if(O(l),s!==s+0)throw s;L(1,0);}}function wn(e,r,t,n,a){var o=U();try{I(e)(r,t,n,a);}catch(l){if(O(o),l!==l+0)throw l;L(1,0);}}function Cn(e,r,t,n,a,o){var l=U();try{fr(e,r,t,n,a,o);}catch(s){if(O(l),s!==s+0)throw s;L(1,0);}}var be;Z=function e(){be||hr(),be||(Z=e);};function hr(){if(x>0||(kr(),x>0))return;function e(){be||(be=!0,i.calledRun=!0,!Ie&&(Dr(),_(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),Mr()));}i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("");},1),e();},1)):e();}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return hr(),u.ready}})(),yr=Tn;var z=class{constructor(){throw new Error("WasmLoader is a static class and cannot be instantiated.")}static async _tryLoad(u){return await yr({locateFile:()=>u})}static async _loadWithBackup(){return this._ModulePromise||(this._ModulePromise=this._tryLoad(this._wasmURL).catch(async u=>{let i=`https://cdn.jsdelivr.net/npm/${ue.name}@${ue.version}/dist/renderer.wasm`;console.warn(`Trying backup URL for WASM loading: ${i}`);try{return await this._tryLoad(i)}catch(_){throw console.error(`Both primary and backup WASM URLs failed. Primary error: ${u.message}, Backup error: ${_.message}`),new Error("WASM loading failed from all sources.")}})),this._ModulePromise}static async load(){return this._loadWithBackup()}static setWasmUrl(u){this._wasmURL=u,this._ModulePromise=null;}};a(z,"_ModulePromise",null),a(z,"_wasmURL",`https://unpkg.com/${ue.name}@${ue.version}/dist/renderer.wasm`);var br=typeof window<"u",B=1e3,wr=class{constructor(u){a(this,"_canvas");a(this,"_context");a(this,"_eventManager",new a$1);a(this,"_renderer",null);a(this,"_beginTime",0);a(this,"_elapsedTime",0);a(this,"_totalFrames",0);a(this,"_loop",!1);a(this,"_speed",1);a(this,"_currentFrame",0);a(this,"_duration",0);a(this,"_loopCount",0);a(this,"_autoplay",!1);a(this,"_mode","forward");a(this,"_direction",1);a(this,"_bounceCount",0);a(this,"_animationFrameId",null);a(this,"_segments",null);a(this,"_playbackState","stopped");a(this,"_backgroundColor","");a(this,"_renderConfig",{});if(this._animationLoop=this._animationLoop.bind(this),this._canvas=u.canvas,this._context=this._canvas.getContext("2d"),!this._context)throw new Error("2D context not supported or canvas already initialized with another context type.");this._loop=u.loop??!1,this._speed=u.speed??1,this._autoplay=u.autoplay??!1,this._mode=u.mode??"forward",this._segments=u.segments??null,this._backgroundColor=u.backgroundColor??"",this._renderConfig=u.renderConfig??{},this.setBackgroundColor(this._backgroundColor),z.load().then(i=>{this._renderer=new i.Renderer,u.src?this._loadAnimationFromURL(u.src):u.data&&this._initializeAnimationFromData(u.data);}).catch(i=>{this._eventManager.dispatch({type:"loadError",error:i});});}get autoplay(){return this._autoplay}get backgroundColor(){return this._backgroundColor}get direction(){return this._direction}get currentFrame(){return this._currentFrame}get duration(){return this._duration}get totalFrames(){return this._totalFrames}get loop(){return this._loop}get speed(){return this._speed}get loopCount(){return this._loopCount}get segments(){return this._segments}get isPlaying(){return this._playbackState==="playing"}get isPaused(){return this._playbackState==="paused"}get isStopped(){return this._playbackState==="stopped"}_loadAnimationFromURL(u){b(u).then(i=>{this._initializeAnimationFromData(i);}).catch(i=>{this._eventManager.dispatch({type:"loadError",error:i});});}_initializeAnimationFromData(u){let i=_=>{try{this._renderer?.load(_,this._canvas.width,this._canvas.height)?(this._setupAnimationDetails(),this._eventManager.dispatch({type:"load"}),this.resize(),this._autoplay?this.play():this._render()):this._eventManager.dispatch({type:"loadError",error:new Error("Error encountered while initializing animation from data.")});}catch(F){this._eventManager.dispatch({type:"loadError",error:F});}};typeof u=="string"?i(u):u instanceof ArrayBuffer?a$2(u).then(i).catch(_=>{this._eventManager.dispatch({type:"loadError",error:_});}):console.error("Unsupported data type for animation data. Expected a string or ArrayBuffer.");}_setupAnimationDetails(){this._renderer&&(this._totalFrames=this._renderer.totalFrames(),this._duration=this._renderer.duration(),this._segments=[Math.max(0,this._segments?.[0]??0),Math.min(this._totalFrames-1,this.segments?.[1]??this._totalFrames-1)]);}_render(){if(!this._context||!this._renderer)return;let u=this._canvas.width,i=this._canvas.height;if(this._renderer.resize(u,i),this._renderer.update()){let _=this._renderer.render();if(_.length===0){console.warn("Empty buffer received from renderer.");return}let F=new Uint8ClampedArray(_),T=new ImageData(F,this._canvas.width,this._canvas.height);this._context.putImageData(T,0,0);}}_update(){if(this._duration===0||this._totalFrames===0)return !1;let u=this._getEffectiveStartFrame(),i=this._getEffectiveEndFrame(),F=this._getEffectiveDuration()/(i-u);this._elapsedTime=(Date.now()/B-this._beginTime)*this._speed;let T=this._elapsedTime/F;this._mode==="forward"||this._mode==="reverse"?this._currentFrame=this._mode==="forward"?u+T:i-T:this._direction===1?(this._currentFrame=u+T,this._currentFrame>=i&&(this._currentFrame=i,this._direction=-1,this._beginTime=Date.now()/B)):(this._currentFrame=i-T,this._currentFrame<=u&&(this._currentFrame=u,this._direction=1,this._beginTime=Date.now()/B)),this._currentFrame=Math.round(Math.max(u,Math.min(this._currentFrame,i))*100)/100;let ce=!1;return this._renderer?.frame(this._currentFrame)&&(this._eventManager.dispatch({type:"frame",currentFrame:this._currentFrame}),ce=!0),this._mode==="forward"||this._mode==="reverse"?(this._currentFrame>=i||this._currentFrame<=u)&&this._handleLoopOrCompletion():(this._currentFrame<=u||this._currentFrame>=i)&&(this._bounceCount+=1,this._bounceCount%2===0&&(this._bounceCount=0,this._handleLoopOrCompletion())),ce}_handleLoopOrCompletion(){this._loop?(this._loopCount+=1,this._eventManager.dispatch({type:"loop",loopCount:this._loopCount}),this._beginTime=Date.now()/B):(this._playbackState="stopped",this._eventManager.dispatch({type:"complete"}));}_animationLoop(){this.isPlaying&&this._update()&&(this._render(),this._animationFrameId=window.requestAnimationFrame(this._animationLoop));}_stopAnimationLoop(){this._animationFrameId&&(window.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null);}_startAnimationLoop(){this._animationFrameId||(this._animationFrameId=window.requestAnimationFrame(this._animationLoop));}_getEffectiveStartFrame(){return this._segments?this._segments[0]:0}_getEffectiveEndFrame(){return this._segments?this._segments[1]:this._totalFrames-1}_getEffectiveTotalFrames(){return this._segments?this._segments[1]-this._segments[0]:this._totalFrames}_getEffectiveDuration(){return this._segments?this._duration*((this._segments[1]-this._segments[0])/this._totalFrames):this._duration}_synchronizeAnimationTiming(u){let i=this._getEffectiveDuration(),_=this._getEffectiveTotalFrames(),F=i/_,T=(u-this._getEffectiveStartFrame())*F;this._direction===-1&&(T=i-T),this._beginTime=Date.now()/B-T/this._speed;}play(){if(this._totalFrames===0){console.error("Animation is not loaded yet.");return}let u=this._getEffectiveStartFrame(),i=this._getEffectiveEndFrame();this._playbackState!=="paused"?(this._currentFrame=this._mode==="reverse"||this._mode==="bounce-reverse"?i:u,this._beginTime=Date.now()/B):this._synchronizeAnimationTiming(this._currentFrame),this.isPlaying||(this._playbackState="playing",this._eventManager.dispatch({type:"play"}),this._startAnimationLoop());}stop(){this.isStopped||(this._stopAnimationLoop(),this._playbackState="stopped",this._bounceCount=0,this._mode==="reverse"||this._mode==="bounce-reverse"?(this._currentFrame=this._getEffectiveEndFrame(),this._direction=-1):(this._currentFrame=this._getEffectiveStartFrame(),this._direction=1),this.setFrame(this._currentFrame),this._render(),this._eventManager.dispatch({type:"stop"}));}pause(){this.isPaused||(this._stopAnimationLoop(),this._playbackState="paused",this._eventManager.dispatch({type:"pause"}));}setSpeed(u){if(u<=0){console.error("Speed must be a positive number.");return}if(this._speed!==u){if(this.isPlaying){let i=Date.now()/B;this._beginTime=i-this._elapsedTime/u;}this._speed=u;}}setLoop(u){this._loop=u;}setFrame(u){let i=this._getEffectiveStartFrame(),_=this._getEffectiveEndFrame();if(u<i||u>_){console.error(`Invalid frame number: ${u}. It should be between ${i} and ${_}.`);return}this._currentFrame=u,this.isPlaying&&this._synchronizeAnimationTiming(u),this._renderer?.frame(this._currentFrame)&&(this._render(),this._eventManager.dispatch({type:"frame",currentFrame:this._currentFrame}));}setMode(u){this._mode!==u&&(this._mode=u,this._bounceCount=0,this._direction=u.includes("reverse")?-1:1,this.isPlaying&&this._synchronizeAnimationTiming(this._currentFrame));}load(u){if(!this._renderer||!this._context)return;if(!u.src&&!u.data){console.error('Either "src" or "data" must be provided.');return}this._stopAnimationLoop(),this._playbackState="stopped",this._loop=u.loop??!1,this._speed=u.speed??1,this._autoplay=u.autoplay??!1,this._mode=u.mode??"forward",this._segments=u.segments??null,this._loopCount=0,this._bounceCount=0,this._direction=this._mode.includes("reverse")?-1:1,this._renderConfig=u.renderConfig??{};let i=this._getEffectiveStartFrame(),_=this._getEffectiveEndFrame();this._currentFrame=this._mode==="reverse"||this._mode==="bounce-reverse"?_:i,this._beginTime=0,this._totalFrames=0,this._duration=0,this._backgroundColor=u.backgroundColor??"",this.setBackgroundColor(this._backgroundColor),this._context.clearRect(0,0,this._canvas.width,this._canvas.height),u.src?this._loadAnimationFromURL(u.src):u.data&&this._initializeAnimationFromData(u.data);}setSegments(u,i){if(!this._renderer){console.error("Animation not initialized.");return}if(u<0||i>=this._totalFrames||u>i){console.error("Invalid frame range.");return}this._segments=[u,i],(this._currentFrame<u||this._currentFrame>i)&&(this._currentFrame=this._direction===1?u:i,this._renderer.frame(this._currentFrame)&&(this._render(),this._eventManager.dispatch({type:"frame",currentFrame:this._currentFrame}))),this.isPlaying&&this._synchronizeAnimationTiming(this._currentFrame);}addEventListener(u,i){this._eventManager.addEventListener(u,i);}removeEventListener(u,i){this._eventManager.removeEventListener(u,i);}static setWasmUrl(u){z.setWasmUrl(u);}destroy(){this._stopAnimationLoop(),this._playbackState="stopped",this._context=null,this._renderer=null,this._eventManager.dispatch({type:"destroy"}),this._eventManager.removeAllEventListeners();}freeze(){this._stopAnimationLoop();}unfreeze(){this._synchronizeAnimationTiming(this._currentFrame),this._startAnimationLoop();}setBackgroundColor(u){this._backgroundColor=u,br&&(this._canvas.style.backgroundColor=u);}resize(){if(!br)return;let{height:u,width:i}=this._canvas.getBoundingClientRect(),_=this._renderConfig.devicePixelRatio||window.devicePixelRatio||1;this._canvas.width=i*_,this._canvas.height=u*_,this._render();}};
|
|
7
|
+
|
|
8
|
+
export { z as a, wr as b };
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-YUMEQPLC.js.map
|