@lottiefiles/dotlottie-web 0.9.2 → 0.11.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.
@@ -96,4 +96,4 @@ declare class EventManager {
96
96
  removeAllEventListeners(): void;
97
97
  }
98
98
 
99
- export { BaseEvent, CompleteEvent, DestroyEvent, Event, EventListener, EventManager, EventType, FrameEvent, FreezeEvent, LoadErrorEvent, LoadEvent, LoopEvent, PauseEvent, PlayEvent, StopEvent, UnfreezeEvent };
99
+ export { type BaseEvent, type CompleteEvent, type DestroyEvent, type Event, type EventListener, EventManager, type EventType, type FrameEvent, type FreezeEvent, type LoadErrorEvent, type LoadEvent, type LoopEvent, type PauseEvent, type PlayEvent, type StopEvent, type UnfreezeEvent };
@@ -1,5 +1,41 @@
1
- var v=Object.defineProperty;var p=(r,e,t)=>e in r?v(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var s=(r,e,t)=>(p(r,typeof e!="symbol"?e+"":e,t),t);var o=class{constructor(){s(this,"_eventListeners",new Map);}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t);}removeEventListener(e,t){let n=this._eventListeners.get(e);n&&(t?(n.delete(t),n.size===0&&this._eventListeners.delete(e)):this._eventListeners.delete(e));}dispatch(e){this._eventListeners.get(e.type)?.forEach(n=>n(e));}removeAllEventListeners(){this._eventListeners.clear();}};
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ class EventManager {
8
+ constructor() {
9
+ __publicField(this, "_eventListeners", /* @__PURE__ */ new Map());
10
+ }
11
+ addEventListener(type, listener) {
12
+ let listeners = this._eventListeners.get(type);
13
+ if (!listeners) {
14
+ listeners = /* @__PURE__ */ new Set();
15
+ this._eventListeners.set(type, listeners);
16
+ }
17
+ listeners.add(listener);
18
+ }
19
+ removeEventListener(type, listener) {
20
+ const listeners = this._eventListeners.get(type);
21
+ if (!listeners)
22
+ return;
23
+ if (listener) {
24
+ listeners.delete(listener);
25
+ if (listeners.size === 0) {
26
+ this._eventListeners.delete(type);
27
+ }
28
+ } else {
29
+ this._eventListeners.delete(type);
30
+ }
31
+ }
32
+ dispatch(event) {
33
+ const listeners = this._eventListeners.get(event.type);
34
+ listeners?.forEach((listener) => listener(event));
35
+ }
36
+ removeAllEventListeners() {
37
+ this._eventListeners.clear();
38
+ }
39
+ }
2
40
 
3
- export { o as EventManager };
4
- //# sourceMappingURL=out.js.map
5
- //# sourceMappingURL=event-manager.js.map
41
+ export { EventManager };
package/dist/index.d.ts CHANGED
@@ -1,52 +1,6 @@
1
1
  export { Config, DotLottie, Mode } from './dotlottie.js';
2
2
  export { BaseEvent, CompleteEvent, DestroyEvent, Event, EventListener, EventManager, EventType, FrameEvent, FreezeEvent, LoadErrorEvent, LoadEvent, LoopEvent, PauseEvent, PlayEvent, StopEvent, UnfreezeEvent } from './event-manager.js';
3
3
  export { getAnimationJSONFromDotLottie, hexStringToRGBAInt, isHexColor, loadAnimationJSONFromURL } from './utils.js';
4
-
5
- /**
6
- * Copyright 2023 Design Barn Inc.
7
- */
8
- interface Renderer {
9
- duration(): number;
10
- error(): string;
11
- frame(no: number): boolean;
12
- load(data: string, width: number, height: number): boolean;
13
- render(): Uint8Array;
14
- resize(width: number, height: number): void;
15
- setBgColor(color: number): void;
16
- size(): Float32Array;
17
- totalFrames(): number;
18
- update(): boolean;
19
- }
20
- interface Module {
21
- Renderer: new () => Renderer;
22
- }
23
- /**
24
- * WasmLoader is a utility class for loading WebAssembly modules.
25
- * It provides methods to load modules with a primary URL and a backup URL.
26
- */
27
- declare class WasmLoader {
28
- private static _ModulePromise;
29
- private static _wasmURL;
30
- private constructor();
31
- private static _tryLoad;
32
- /**
33
- * Tries to load the WASM module from the primary URL, falling back to a backup URL if necessary.
34
- * Throws an error if both URLs fail to load the module.
35
- * @returns Promise<Module> - A promise that resolves to the loaded module.
36
- */
37
- private static _loadWithBackup;
38
- /**
39
- * Public method to load the WebAssembly module.
40
- * Utilizes a primary and backup URL for robustness.
41
- * @returns Promise<Module> - A promise that resolves to the loaded module.
42
- */
43
- static load(): Promise<Module>;
44
- /**
45
- * Sets a new URL for the WASM file and invalidates the current module promise.
46
- *
47
- * @param string - The new URL for the WASM file.
48
- */
49
- static setWasmUrl(url: string): void;
50
- }
51
-
52
- export { Renderer, WasmLoader };
4
+ export { RendererLoader } from './renderer-loader.js';
5
+ import './wasm/index.js';
6
+ import './wasm/renderer.js';
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
- var Yi=Object.defineProperty;var Qi=(n,e,t)=>e in n?Yi(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var P=(n,e,t)=>(Qi(n,typeof e!="symbol"?e+"":e,t),t);var mt=typeof window<"u",xe=1e3,vt="#00000000";var Bt=class{requestAnimationFrame(e){return window.requestAnimationFrame(e)}cancelAnimationFrame(e){window.cancelAnimationFrame(e);}},Nt=class{constructor(){P(this,"_lastHandleId",0);P(this,"_lastImmediate",null);}requestAnimationFrame(e){return this._lastHandleId>=Number.MAX_SAFE_INTEGER&&(this._lastHandleId=0),this._lastHandleId+=1,this._lastImmediate=setImmediate(()=>{e(Date.now());}),this._lastHandleId}cancelAnimationFrame(e){this._lastImmediate&&clearImmediate(this._lastImmediate);}},yt=class{constructor(){P(this,"_strategy");this._strategy=mt?new Bt:new Nt;}requestAnimationFrame(e){return this._strategy.requestAnimationFrame(e)}cancelAnimationFrame(e){this._strategy.cancelAnimationFrame(e);}};var gt=class{constructor(){P(this,"_eventListeners",new Map);}addEventListener(e,t){let a=this._eventListeners.get(e);a||(a=new Set,this._eventListeners.set(e,a)),a.add(t);}removeEventListener(e,t){let a=this._eventListeners.get(e);a&&(t?(a.delete(t),a.size===0&&this._eventListeners.delete(e)):this._eventListeners.delete(e));}dispatch(e){this._eventListeners.get(e.type)?.forEach(a=>a(e));}removeAllEventListeners(){this._eventListeners.clear();}};var tt={name:"@lottiefiles/dotlottie-web",version:"0.9.2",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",test:"vitest --watch=false","test:coverage":"vitest --coverage --watch=false","test:watch":"vitest --watch","type-check":"tsc --noEmit"},dependencies:{"@dotlottie/dotlottie-js":"^0.6.0"},devDependencies:{"@types/node":"^20.10.2","@vitest/coverage-v8":"^1.0.1","cross-env":"7.0.3",tsup:"7.2.0",typescript:"5.0.4",vitest:"^1.0.1"},publishConfig:{access:"public"}};var ta=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(e={}){var t=e,a,o;t.ready=new Promise((r,i)=>{a=r,o=i;});var u=Object.assign({},t),f=!0,v="";function b(r){return t.locateFile?t.locateFile(r,v):v+r}(typeof document<"u"&&document.currentScript&&(v=document.currentScript.src),n&&(v=n),v.indexOf("blob:")!==0?v=v.substr(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1):v="",(r,i,s)=>{var l=new XMLHttpRequest;l.open("GET",r,!0),l.responseType="arraybuffer",l.onload=()=>{if(l.status==200||l.status==0&&l.response){i(l.response);return}s();},l.onerror=s,l.send(null);});var x=t.print||console.log.bind(console),T=t.printErr||console.error.bind(console);Object.assign(t,u),u=null,t.arguments&&(t.arguments),t.thisProgram&&(t.thisProgram),t.quit&&(t.quit);var C;t.wasmBinary&&(C=t.wasmBinary),typeof WebAssembly!="object"&&we("no native wasm support detected");var D,G=!1;function fe(r,i){r||we(i);}var X,L,N,U,R,k,ze,ye;function q(){var r=D.buffer;t.HEAP8=X=new Int8Array(r),t.HEAP16=N=new Int16Array(r),t.HEAPU8=L=new Uint8Array(r),t.HEAPU16=U=new Uint16Array(r),t.HEAP32=R=new Int32Array(r),t.HEAPU32=k=new Uint32Array(r),t.HEAPF32=ze=new Float32Array(r),t.HEAPF64=ye=new Float64Array(r);}var te=[],We=[],ee=[];function Dt(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)it(t.preRun.shift());$t(te);}function He(){$t(We);}function ge(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Je(t.postRun.shift());$t(ee);}function it(r){te.unshift(r);}function Ce(r){We.unshift(r);}function Je(r){ee.unshift(r);}var oe=0,_e=null;function Mt(r){oe++,t.monitorRunDependencies&&t.monitorRunDependencies(oe);}function at(r){if(oe--,t.monitorRunDependencies&&t.monitorRunDependencies(oe),oe==0&&(_e)){var i=_e;_e=null,i();}}function we(r){t.onAbort&&t.onAbort(r),r="Aborted("+r+")",T(r),G=!0,r+=". Build with -sASSERTIONS for more info.";var i=new WebAssembly.RuntimeError(r);throw o(i),i}var st="data:application/octet-stream;base64,",rr=r=>r.startsWith(st),Le;Le="renderer.wasm",rr(Le)||(Le=b(Le));function nr(r){if(r==Le&&C)return new Uint8Array(C);throw "both async and sync fetching of the wasm failed"}function vn(r){return !C&&(f)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(i=>{if(!i.ok)throw "failed to load wasm binary file at '"+r+"'";return i.arrayBuffer()}).catch(()=>nr(r)):Promise.resolve().then(()=>nr(r))}function ir(r,i,s){return vn(r).then(l=>WebAssembly.instantiate(l,i)).then(l=>l).then(s,l=>{T(`failed to asynchronously prepare wasm: ${l}`),we(l);})}function yn(r,i,s,l){return !r&&typeof WebAssembly.instantiateStreaming=="function"&&!rr(i)&&typeof fetch=="function"?fetch(i,{credentials:"same-origin"}).then(d=>{var g=WebAssembly.instantiateStreaming(d,s);return g.then(l,function(_){return T(`wasm streaming compile failed: ${_}`),T("falling back to ArrayBuffer instantiation"),ir(i,s,l)})}):ir(i,s,l)}function gn(){var r={a:Ui};function i(l,d){return W=l.exports,D=W.I,q(),yr=W.O,Ce(W.J),at(),W}Mt();function s(l){i(l.instance);}if(t.instantiateWasm)try{return t.instantiateWasm(r,i)}catch(l){T(`Module.instantiateWasm callback failed with error: ${l}`),o(l);}return yn(C,Le,r,s).catch(o),{}}var $t=r=>{for(;r.length>0;)r.shift()(t);};t.noExitRuntime||!0;var ar=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,sr=(r,i,s)=>{for(var l=i+s,d=i;r[d]&&!(d>=l);)++d;if(d-i>16&&r.buffer&&ar)return ar.decode(r.subarray(i,d));for(var g="";i<d;){var _=r[i++];if(!(_&128)){g+=String.fromCharCode(_);continue}var y=r[i++]&63;if((_&224)==192){g+=String.fromCharCode((_&31)<<6|y);continue}var A=r[i++]&63;if((_&240)==224?_=(_&15)<<12|y<<6|A:_=(_&7)<<18|y<<12|A<<6|r[i++]&63,_<65536)g+=String.fromCharCode(_);else {var E=_-65536;g+=String.fromCharCode(55296|E>>10,56320|E&1023);}}return g},Ge=(r,i)=>r?sr(L,r,i):"",_n=(r,i,s,l)=>{we(`Assertion failed: ${Ge(r)}, at: `+[i?Ge(i):"unknown filename",s,l?Ge(l):"unknown function"]);};function wn(r,i,s){return 0}function bn(r,i,s){return 0}function An(r,i,s,l){}var In=(r,i,s,l,d)=>{},En=()=>{for(var r=new Array(256),i=0;i<256;++i)r[i]=String.fromCharCode(i);or=r;},or,ne=r=>{for(var i="",s=r;L[s];)i+=or[L[s++]];return i},Ue={},De={},ot={},Re,M=r=>{throw new Re(r)},ur,ut=r=>{throw new ur(r)},Ze=(r,i,s)=>{r.forEach(function(y){ot[y]=i;});function l(y){var A=s(y);A.length!==r.length&&ut("Mismatched type converter count");for(var E=0;E<r.length;++E)pe(r[E],A[E]);}var d=new Array(i.length),g=[],_=0;i.forEach((y,A)=>{De.hasOwnProperty(y)?d[A]=De[y]:(g.push(y),Ue.hasOwnProperty(y)||(Ue[y]=[]),Ue[y].push(()=>{d[A]=De[y],++_,_===g.length&&l(d);}));}),g.length===0&&l(d);};function Tn(r,i,s={}){var l=i.name;if(r||M(`type "${l}" must have a positive integer typeid pointer`),De.hasOwnProperty(r)){if(s.ignoreDuplicateRegistrations)return;M(`Cannot register type '${l}' twice`);}if(De[r]=i,delete ot[r],Ue.hasOwnProperty(r)){var d=Ue[r];delete Ue[r],d.forEach(g=>g());}}function pe(r,i,s={}){if(!("argPackAdvance"in i))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Tn(r,i,s)}var be=8,Fn=(r,i,s,l)=>{i=ne(i),pe(r,{name:i,fromWireType:function(d){return !!d},toWireType:function(d,g){return g?s:l},argPackAdvance:be,readValueFromPointer:function(d){return this.fromWireType(L[d])},destructorFunction:null});},xn=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),Ot=r=>{function i(s){return s.$$.ptrType.registeredClass.name}M(i(r)+" instance already deleted");},zt=!1,lr=r=>{},Sn=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr);},cr=r=>{r.count.value-=1;var i=r.count.value===0;i&&Sn(r);},fr=(r,i,s)=>{if(i===s)return r;if(s.baseClass===void 0)return null;var l=fr(r,i,s.baseClass);return l===null?null:s.downcast(l)},hr={},Cn=()=>Object.keys(Ye).length,Pn=()=>{var r=[];for(var i in Ye)Ye.hasOwnProperty(i)&&r.push(Ye[i]);return r},Xe=[],Lt=()=>{for(;Xe.length;){var r=Xe.pop();r.$$.deleteScheduled=!1,r.delete();}},Ke,Dn=r=>{Ke=r,Xe.length&&Ke&&Ke(Lt);},Mn=()=>{t.getInheritedInstanceCount=Cn,t.getLiveInheritedInstances=Pn,t.flushPendingDeletes=Lt,t.setDelayFunction=Dn;},Ye={},$n=(r,i)=>{for(i===void 0&&M("ptr should not be undefined");r.baseClass;)i=r.upcast(i),r=r.baseClass;return i},On=(r,i)=>(i=$n(r,i),Ye[i]),lt=(r,i)=>{(!i.ptrType||!i.ptr)&&ut("makeClassHandle requires ptr and ptrType");var s=!!i.smartPtrType,l=!!i.smartPtr;return s!==l&&ut("Both smartPtrType and smartPtr must be specified"),i.count={value:1},Qe(Object.create(r,{$$:{value:i}}))};function zn(r){var i=this.getPointee(r);if(!i)return this.destructor(r),null;var s=On(this.registeredClass,i);if(s!==void 0){if(s.$$.count.value===0)return s.$$.ptr=i,s.$$.smartPtr=r,s.clone();var l=s.clone();return this.destructor(r),l}function d(){return this.isSmartPointer?lt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:i,smartPtrType:this,smartPtr:r}):lt(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var g=this.registeredClass.getActualType(i),_=hr[g];if(!_)return d.call(this);var y;this.isConst?y=_.constPointerType:y=_.pointerType;var A=fr(i,this.registeredClass,y.registeredClass);return A===null?d.call(this):this.isSmartPointer?lt(y.registeredClass.instancePrototype,{ptrType:y,ptr:A,smartPtrType:this,smartPtr:r}):lt(y.registeredClass.instancePrototype,{ptrType:y,ptr:A})}var Qe=r=>typeof FinalizationRegistry>"u"?(Qe=i=>i,r):(zt=new FinalizationRegistry(i=>{cr(i.$$);}),Qe=i=>{var s=i.$$,l=!!s.smartPtr;if(l){var d={$$:s};zt.register(i,d,i);}return i},lr=i=>zt.unregister(i),Qe(r)),Ln=()=>{Object.assign(ct.prototype,{isAliasOf(r){if(!(this instanceof ct)||!(r instanceof ct))return !1;var i=this.$$.ptrType.registeredClass,s=this.$$.ptr;r.$$=r.$$;for(var l=r.$$.ptrType.registeredClass,d=r.$$.ptr;i.baseClass;)s=i.upcast(s),i=i.baseClass;for(;l.baseClass;)d=l.upcast(d),l=l.baseClass;return i===l&&s===d},clone(){if(this.$$.ptr||Ot(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var r=Qe(Object.create(Object.getPrototypeOf(this),{$$:{value:xn(this.$$)}}));return r.$$.count.value+=1,r.$$.deleteScheduled=!1,r},delete(){this.$$.ptr||Ot(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&M("Object already scheduled for deletion"),lr(this),cr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0);},isDeleted(){return !this.$$.ptr},deleteLater(){return this.$$.ptr||Ot(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&M("Object already scheduled for deletion"),Xe.push(this),Xe.length===1&&Ke&&Ke(Lt),this.$$.deleteScheduled=!0,this}});};function ct(){}var kn=48,Un=57,dr=r=>{if(r===void 0)return "_unknown";r=r.replace(/[^a-zA-Z0-9_]/g,"$");var i=r.charCodeAt(0);return i>=kn&&i<=Un?`_${r}`:r};function pr(r,i){return r=dr(r),{[r]:function(){return i.apply(this,arguments)}}[r]}var mr=(r,i,s)=>{if(r[i].overloadTable===void 0){var l=r[i];r[i]=function(){return r[i].overloadTable.hasOwnProperty(arguments.length)||M(`Function '${s}' called with an invalid number of arguments (${arguments.length}) - expects one of (${r[i].overloadTable})!`),r[i].overloadTable[arguments.length].apply(this,arguments)},r[i].overloadTable=[],r[i].overloadTable[l.argCount]=l;}},Rn=(r,i,s)=>{t.hasOwnProperty(r)?((s===void 0||t[r].overloadTable!==void 0&&t[r].overloadTable[s]!==void 0)&&M(`Cannot register public name '${r}' twice`),mr(t,r,r),t.hasOwnProperty(s)&&M(`Cannot register multiple overloads of a function with the same number of arguments (${s})!`),t[r].overloadTable[s]=i):(t[r]=i,s!==void 0&&(t[r].numArguments=s));};function jn(r,i,s,l,d,g,_,y){this.name=r,this.constructor=i,this.instancePrototype=s,this.rawDestructor=l,this.baseClass=d,this.getActualType=g,this.upcast=_,this.downcast=y,this.pureVirtualFunctions=[];}var kt=(r,i,s)=>{for(;i!==s;)i.upcast||M(`Expected null or instance of ${s.name}, got an instance of ${i.name}`),r=i.upcast(r),i=i.baseClass;return r};function Bn(r,i){if(i===null)return this.isReference&&M(`null is not a valid ${this.name}`),0;i.$$||M(`Cannot pass "${Rt(i)}" as a ${this.name}`),i.$$.ptr||M(`Cannot pass deleted object as a pointer of type ${this.name}`);var s=i.$$.ptrType.registeredClass,l=kt(i.$$.ptr,s,this.registeredClass);return l}function Nn(r,i){var s;if(i===null)return this.isReference&&M(`null is not a valid ${this.name}`),this.isSmartPointer?(s=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,s),s):0;i.$$||M(`Cannot pass "${Rt(i)}" as a ${this.name}`),i.$$.ptr||M(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&i.$$.ptrType.isConst&&M(`Cannot convert argument of type ${i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name} to parameter type ${this.name}`);var l=i.$$.ptrType.registeredClass;if(s=kt(i.$$.ptr,l,this.registeredClass),this.isSmartPointer)switch(i.$$.smartPtr===void 0&&M("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:i.$$.smartPtrType===this?s=i.$$.smartPtr:M(`Cannot convert argument of type ${i.$$.smartPtrType?i.$$.smartPtrType.name:i.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:s=i.$$.smartPtr;break;case 2:if(i.$$.smartPtrType===this)s=i.$$.smartPtr;else {var d=i.clone();s=this.rawShare(s,ht.toHandle(()=>d.delete())),r!==null&&r.push(this.rawDestructor,s);}break;default:M("Unsupporting sharing policy");}return s}function Vn(r,i){if(i===null)return this.isReference&&M(`null is not a valid ${this.name}`),0;i.$$||M(`Cannot pass "${Rt(i)}" as a ${this.name}`),i.$$.ptr||M(`Cannot pass deleted object as a pointer of type ${this.name}`),i.$$.ptrType.isConst&&M(`Cannot convert argument of type ${i.$$.ptrType.name} to parameter type ${this.name}`);var s=i.$$.ptrType.registeredClass,l=kt(i.$$.ptr,s,this.registeredClass);return l}function vr(r){return this.fromWireType(k[r>>2])}var qn=()=>{Object.assign(ft.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor&&this.rawDestructor(r);},argPackAdvance:be,readValueFromPointer:vr,deleteObject(r){r!==null&&r.delete();},fromWireType:zn});};function ft(r,i,s,l,d,g,_,y,A,E,S){this.name=r,this.registeredClass=i,this.isReference=s,this.isConst=l,this.isSmartPointer=d,this.pointeeType=g,this.sharingPolicy=_,this.rawGetPointee=y,this.rawConstructor=A,this.rawShare=E,this.rawDestructor=S,!d&&i.baseClass===void 0?l?(this.toWireType=Bn,this.destructorFunction=null):(this.toWireType=Vn,this.destructorFunction=null):this.toWireType=Nn;}var Wn=(r,i,s)=>{t.hasOwnProperty(r)||ut("Replacing nonexistant public symbol"),t[r].overloadTable!==void 0&&s!==void 0?t[r].overloadTable[s]=i:(t[r]=i,t[r].argCount=s);},Hn=(r,i,s)=>{var l=t["dynCall_"+r];return s&&s.length?l.apply(null,[i].concat(s)):l.call(null,i)},yr,Ae=r=>yr.get(r),Jn=(r,i,s)=>{if(r.includes("j"))return Hn(r,i,s);var l=Ae(i).apply(null,s);return l},Gn=(r,i)=>{var s=[];return function(){return s.length=0,Object.assign(s,arguments),Jn(r,i,s)}},je=(r,i)=>{r=ne(r);function s(){return r.includes("j")?Gn(r,i):Ae(i)}var l=s();return typeof l!="function"&&M(`unknown function pointer with signature ${r}: ${i}`),l},Zn=(r,i)=>{var s=pr(i,function(l){this.name=i,this.message=l;var d=new Error(l).stack;d!==void 0&&(this.stack=this.toString()+`
2
- `+d.replace(/^Error(:[^\n]*)?\n/,""));});return s.prototype=Object.create(r.prototype),s.prototype.constructor=s,s.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},s},gr,_r=r=>{var i=Fr(r),s=ne(i);return me(i),s},Ut=(r,i)=>{var s=[],l={};function d(g){if(!l[g]&&!De[g]){if(ot[g]){ot[g].forEach(d);return}s.push(g),l[g]=!0;}}throw i.forEach(d),new gr(`${r}: `+s.map(_r).join([", "]))},Xn=(r,i,s,l,d,g,_,y,A,E,S,$,V)=>{S=ne(S),g=je(d,g),y&&(y=je(_,y)),E&&(E=je(A,E)),V=je($,V);var j=dr(S);Rn(j,function(){Ut(`Cannot construct ${S} due to unbound types`,[l]);}),Ze([r,i,s],l?[l]:[],function(H){H=H[0];var ue,J;l?(ue=H.registeredClass,J=ue.instancePrototype):J=ct.prototype;var Be=pr(j,function(){if(Object.getPrototypeOf(this)!==et)throw new Re("Use 'new' to construct "+S);if(re.constructor_body===void 0)throw new Re(S+" has no accessible constructor");var Pr=re.constructor_body[arguments.length];if(Pr===void 0)throw new Re(`Tried to invoke ctor of ${S} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(re.constructor_body).toString()}) parameters instead!`);return Pr.apply(this,arguments)}),et=Object.create(J,{constructor:{value:Be}});Be.prototype=et;var re=new jn(S,Be,et,V,ue,g,y,E);re.baseClass&&(re.baseClass.__derivedClasses===void 0&&(re.baseClass.__derivedClasses=[]),re.baseClass.__derivedClasses.push(re));var Fe=new ft(S,re,!0,!1,!1),pt=new ft(S+"*",re,!1,!1,!1),Cr=new ft(S+" const*",re,!1,!0,!1);return hr[r]={pointerType:pt,constPointerType:Cr},Wn(j,Be),[Fe,pt,Cr]});},wr=(r,i)=>{for(var s=[],l=0;l<r;l++)s.push(k[i+l*4>>2]);return s},Kn=r=>{for(;r.length;){var i=r.pop(),s=r.pop();s(i);}};function br(r,i,s,l,d,g){var _=i.length;_<2&&M("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=i[1]!==null&&s!==null,A=!1,E=1;E<i.length;++E)if(i[E]!==null&&i[E].destructorFunction===void 0){A=!0;break}var S=i[0].name!=="void",$=_-2,V=new Array($),j=[],H=[];return function(){arguments.length!==$&&M(`function ${r} called with ${arguments.length} arguments, expected ${$}`),H.length=0;var ue;j.length=y?2:1,j[0]=d,y&&(ue=i[1].toWireType(H,this),j[1]=ue);for(var J=0;J<$;++J)V[J]=i[J+2].toWireType(H,arguments[J]),j.push(V[J]);var Be=l.apply(null,j);function et(re){if(A)Kn(H);else for(var Fe=y?1:2;Fe<i.length;Fe++){var pt=Fe===1?ue:V[Fe-2];i[Fe].destructorFunction!==null&&i[Fe].destructorFunction(pt);}if(S)return i[0].fromWireType(re)}return et(Be)}}var Yn=(r,i,s,l,d,g)=>{var _=wr(i,s);d=je(l,d),Ze([],[r],function(y){y=y[0];var A=`constructor ${y.name}`;if(y.registeredClass.constructor_body===void 0&&(y.registeredClass.constructor_body=[]),y.registeredClass.constructor_body[i-1]!==void 0)throw new Re(`Cannot register multiple constructors with identical number of parameters (${i-1}) for class '${y.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return y.registeredClass.constructor_body[i-1]=()=>{Ut(`Cannot construct ${y.name} due to unbound types`,_);},Ze([],_,E=>(E.splice(1,0,null),y.registeredClass.constructor_body[i-1]=br(A,E,null,d,g),[])),[]});},Qn=r=>{r=r.trim();let i=r.indexOf("(");return i!==-1?(fe(r[r.length-1]==")","Parentheses for argument names should match."),r.substr(0,i)):r},ei=(r,i,s,l,d,g,_,y,A)=>{var E=wr(s,l);i=ne(i),i=Qn(i),g=je(d,g),Ze([],[r],function(S){S=S[0];var $=`${S.name}.${i}`;i.startsWith("@@")&&(i=Symbol[i.substring(2)]),y&&S.registeredClass.pureVirtualFunctions.push(i);function V(){Ut(`Cannot call ${$} due to unbound types`,E);}var j=S.registeredClass.instancePrototype,H=j[i];return H===void 0||H.overloadTable===void 0&&H.className!==S.name&&H.argCount===s-2?(V.argCount=s-2,V.className=S.name,j[i]=V):(mr(j,i,$),j[i].overloadTable[s-2]=V),Ze([],E,function(ue){var J=br($,ue,S,g,_);return j[i].overloadTable===void 0?(J.argCount=s-2,j[i]=J):j[i].overloadTable[s-2]=J,[]}),[]});};function ti(){Object.assign(Ar.prototype,{get(r){return this.allocated[r]},has(r){return this.allocated[r]!==void 0},allocate(r){var i=this.freelist.pop()||this.allocated.length;return this.allocated[i]=r,i},free(r){this.allocated[r]=void 0,this.freelist.push(r);}});}function Ar(){this.allocated=[void 0],this.freelist=[];}var ie=new Ar,Ir=r=>{r>=ie.reserved&&--ie.get(r).refcount===0&&ie.free(r);},ri=()=>{for(var r=0,i=ie.reserved;i<ie.allocated.length;++i)ie.allocated[i]!==void 0&&++r;return r},ni=()=>{ie.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),ie.reserved=ie.allocated.length,t.count_emval_handles=ri;},ht={toValue:r=>(r||M("Cannot use deleted val. handle = "+r),ie.get(r).value),toHandle:r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return ie.allocate({refcount:1,value:r})}}};function Er(r){return this.fromWireType(R[r>>2])}var ii=(r,i)=>{i=ne(i),pe(r,{name:i,fromWireType:s=>{var l=ht.toValue(s);return Ir(s),l},toWireType:(s,l)=>ht.toHandle(l),argPackAdvance:be,readValueFromPointer:Er,destructorFunction:null});},Rt=r=>{if(r===null)return "null";var i=typeof r;return i==="object"||i==="array"||i==="function"?r.toString():""+r},ai=(r,i)=>{switch(i){case 4:return function(s){return this.fromWireType(ze[s>>2])};case 8:return function(s){return this.fromWireType(ye[s>>3])};default:throw new TypeError(`invalid float width (${i}): ${r}`)}},si=(r,i,s)=>{i=ne(i),pe(r,{name:i,fromWireType:l=>l,toWireType:(l,d)=>d,argPackAdvance:be,readValueFromPointer:ai(i,s),destructorFunction:null});},oi=(r,i,s)=>{switch(i){case 1:return s?l=>X[l>>0]:l=>L[l>>0];case 2:return s?l=>N[l>>1]:l=>U[l>>1];case 4:return s?l=>R[l>>2]:l=>k[l>>2];default:throw new TypeError(`invalid integer width (${i}): ${r}`)}},ui=(r,i,s,l,d)=>{i=ne(i);var g=S=>S;if(l===0){var _=32-8*s;g=S=>S<<_>>>_;}var y=i.includes("unsigned"),A=(S,$)=>{},E;y?E=function(S,$){return A($,this.name),$>>>0}:E=function(S,$){return A($,this.name),$},pe(r,{name:i,fromWireType:g,toWireType:E,argPackAdvance:be,readValueFromPointer:oi(i,s,l!==0),destructorFunction:null});},li=(r,i,s)=>{var l=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],d=l[i];function g(_){var y=k[_>>2],A=k[_+4>>2];return new d(X.buffer,A,y)}s=ne(s),pe(r,{name:s,fromWireType:g,argPackAdvance:be,readValueFromPointer:g},{ignoreDuplicateRegistrations:!0});},ci=(r,i,s,l)=>{if(!(l>0))return 0;for(var d=s,g=s+l-1,_=0;_<r.length;++_){var y=r.charCodeAt(_);if(y>=55296&&y<=57343){var A=r.charCodeAt(++_);y=65536+((y&1023)<<10)|A&1023;}if(y<=127){if(s>=g)break;i[s++]=y;}else if(y<=2047){if(s+1>=g)break;i[s++]=192|y>>6,i[s++]=128|y&63;}else if(y<=65535){if(s+2>=g)break;i[s++]=224|y>>12,i[s++]=128|y>>6&63,i[s++]=128|y&63;}else {if(s+3>=g)break;i[s++]=240|y>>18,i[s++]=128|y>>12&63,i[s++]=128|y>>6&63,i[s++]=128|y&63;}}return i[s]=0,s-d},fi=(r,i,s)=>ci(r,L,i,s),hi=r=>{for(var i=0,s=0;s<r.length;++s){var l=r.charCodeAt(s);l<=127?i++:l<=2047?i+=2:l>=55296&&l<=57343?(i+=4,++s):i+=3;}return i},di=(r,i)=>{i=ne(i);var s=i==="std::string";pe(r,{name:i,fromWireType(l){var d=k[l>>2],g=l+4,_;if(s)for(var y=g,A=0;A<=d;++A){var E=g+A;if(A==d||L[E]==0){var S=E-y,$=Ge(y,S);_===void 0?_=$:(_+=String.fromCharCode(0),_+=$),y=E+1;}}else {for(var V=new Array(d),A=0;A<d;++A)V[A]=String.fromCharCode(L[g+A]);_=V.join("");}return me(l),_},toWireType(l,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var g,_=typeof d=="string";_||d instanceof Uint8Array||d instanceof Uint8ClampedArray||d instanceof Int8Array||M("Cannot pass non-string to std::string"),s&&_?g=hi(d):g=d.length;var y=jt(4+g+1),A=y+4;if(k[y>>2]=g,s&&_)fi(d,A,g+1);else if(_)for(var E=0;E<g;++E){var S=d.charCodeAt(E);S>255&&(me(A),M("String has UTF-16 code units that do not fit in 8 bits")),L[A+E]=S;}else for(var E=0;E<g;++E)L[A+E]=d[E];return l!==null&&l.push(me,y),y},argPackAdvance:be,readValueFromPointer:vr,destructorFunction(l){me(l);}});},Tr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,pi=(r,i)=>{for(var s=r,l=s>>1,d=l+i/2;!(l>=d)&&U[l];)++l;if(s=l<<1,s-r>32&&Tr)return Tr.decode(L.subarray(r,s));for(var g="",_=0;!(_>=i/2);++_){var y=N[r+_*2>>1];if(y==0)break;g+=String.fromCharCode(y);}return g},mi=(r,i,s)=>{if(s===void 0&&(s=2147483647),s<2)return 0;s-=2;for(var l=i,d=s<r.length*2?s/2:r.length,g=0;g<d;++g){var _=r.charCodeAt(g);N[i>>1]=_,i+=2;}return N[i>>1]=0,i-l},vi=r=>r.length*2,yi=(r,i)=>{for(var s=0,l="";!(s>=i/4);){var d=R[r+s*4>>2];if(d==0)break;if(++s,d>=65536){var g=d-65536;l+=String.fromCharCode(55296|g>>10,56320|g&1023);}else l+=String.fromCharCode(d);}return l},gi=(r,i,s)=>{if(s===void 0&&(s=2147483647),s<4)return 0;for(var l=i,d=l+s-4,g=0;g<r.length;++g){var _=r.charCodeAt(g);if(_>=55296&&_<=57343){var y=r.charCodeAt(++g);_=65536+((_&1023)<<10)|y&1023;}if(R[i>>2]=_,i+=4,i+4>d)break}return R[i>>2]=0,i-l},_i=r=>{for(var i=0,s=0;s<r.length;++s){var l=r.charCodeAt(s);l>=55296&&l<=57343&&++s,i+=4;}return i},wi=(r,i,s)=>{s=ne(s);var l,d,g,_,y;i===2?(l=pi,d=mi,_=vi,g=()=>U,y=1):i===4&&(l=yi,d=gi,_=_i,g=()=>k,y=2),pe(r,{name:s,fromWireType:A=>{for(var E=k[A>>2],S=g(),$,V=A+4,j=0;j<=E;++j){var H=A+4+j*i;if(j==E||S[H>>y]==0){var ue=H-V,J=l(V,ue);$===void 0?$=J:($+=String.fromCharCode(0),$+=J),V=H+i;}}return me(A),$},toWireType:(A,E)=>{typeof E!="string"&&M(`Cannot pass non-string to C++ string type ${s}`);var S=_(E),$=jt(4+S+i);return k[$>>2]=S>>y,d(E,$+4,S+i),A!==null&&A.push(me,$),$},argPackAdvance:be,readValueFromPointer:Er,destructorFunction(A){me(A);}});},bi=(r,i)=>{i=ne(i),pe(r,{isVoid:!0,name:i,argPackAdvance:0,fromWireType:()=>{},toWireType:(s,l)=>{}});},Ai=()=>{throw 1/0},Ii=r=>{r>4&&(ie.get(r).refcount+=1);},Ei=(r,i)=>{var s=De[r];return s===void 0&&M(i+" has unknown type "+_r(r)),s},Ti=(r,i)=>{r=Ei(r,"_emval_take_value");var s=r.readValueFromPointer(i);return ht.toHandle(s)},Fi=()=>{we("");},xi=(r,i,s)=>L.copyWithin(r,i,i+s),Si=()=>2147483648,Ci=r=>{var i=D.buffer,s=(r-i.byteLength+65535)/65536;try{return D.grow(s),q(),1}catch{}},Pi=r=>{var i=L.length;r>>>=0;var s=Si();if(r>s)return !1;for(var l=(A,E)=>A+(E-A%E)%E,d=1;d<=4;d*=2){var g=i*(1+.2/d);g=Math.min(g,r+100663296);var _=Math.min(s,l(Math.max(r,g),65536)),y=Ci(_);if(y)return !0}return !1},Di=r=>52,Mi=(r,i,s,l)=>52;function Oi(r,i,s,l,d){return 70}var zi=[null,[],[]],Li=(r,i)=>{var s=zi[r];i===0||i===10?((r===1?x:T)(sr(s,0)),s.length=0):s.push(i);},ki=(r,i,s,l)=>{for(var d=0,g=0;g<s;g++){var _=k[i>>2],y=k[i+4>>2];i+=8;for(var A=0;A<y;A++)Li(r,L[_+A]);d+=y;}return k[l>>2]=d,0};En(),Re=t.BindingError=class extends Error{constructor(i){super(i),this.name="BindingError";}},ur=t.InternalError=class extends Error{constructor(i){super(i),this.name="InternalError";}},Ln(),Mn(),qn(),gr=t.UnboundTypeError=Zn(Error,"UnboundTypeError"),ti(),ni();var Ui={b:_n,n:wn,D:bn,E:An,w:In,q:Fn,H:Xn,G:Yn,e:ei,F:ii,o:si,f:ui,d:li,p:di,k:wi,r:bi,y:Ai,s:Ir,t:Ii,g:Ti,h:Fi,A:xi,z:Pi,m:Di,C:Mi,v:Oi,B:ki,j:Ji,i:Gi,l:Zi,a:Wi,c:Hi,x:Xi,u:Ki},W=gn(),me=r=>(me=W.K)(r),jt=r=>(jt=W.L)(r),Fr=r=>(Fr=W.M)(r);t.__embind_initialize_bindings=()=>(t.__embind_initialize_bindings=W.N)();var Ie=(r,i)=>(Ie=W.P)(r,i),Ee=()=>(Ee=W.Q)(),Te=r=>(Te=W.R)(r),xr=t.dynCall_viiij=(r,i,s,l,d,g)=>(xr=t.dynCall_viiij=W.S)(r,i,s,l,d,g);t.dynCall_jiji=(r,i,s,l,d)=>(t.dynCall_jiji=W.T)(r,i,s,l,d);function Wi(r,i){var s=Ee();try{Ae(r)(i);}catch(l){if(Te(s),l!==l+0)throw l;Ie(1,0);}}function Hi(r,i,s){var l=Ee();try{Ae(r)(i,s);}catch(d){if(Te(l),d!==d+0)throw d;Ie(1,0);}}function Ji(r,i){var s=Ee();try{return Ae(r)(i)}catch(l){if(Te(s),l!==l+0)throw l;Ie(1,0);}}function Gi(r,i,s,l){var d=Ee();try{return Ae(r)(i,s,l)}catch(g){if(Te(d),g!==g+0)throw g;Ie(1,0);}}function Zi(r,i,s,l,d,g){var _=Ee();try{return Ae(r)(i,s,l,d,g)}catch(y){if(Te(_),y!==y+0)throw y;Ie(1,0);}}function Xi(r,i,s,l,d){var g=Ee();try{Ae(r)(i,s,l,d);}catch(_){if(Te(g),_!==_+0)throw _;Ie(1,0);}}function Ki(r,i,s,l,d,g){var _=Ee();try{xr(r,i,s,l,d,g);}catch(y){if(Te(_),y!==y+0)throw y;Ie(1,0);}}var dt;_e=function r(){dt||Sr(),dt||(_e=r);};function Sr(){if(oe>0||(Dt(),oe>0))return;function r(){dt||(dt=!0,t.calledRun=!0,!G&&(He(),a(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),ge()));}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("");},1),r();},1)):r();}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Sr(),e.ready}})(),Dr=ta;var Me=class{constructor(){throw new Error("WasmLoader is a static class and cannot be instantiated.")}static async _tryLoad(e){return await Dr({locateFile:()=>e})}static async _loadWithBackup(){return this._ModulePromise||(this._ModulePromise=this._tryLoad(this._wasmURL).catch(async e=>{let t=`https://cdn.jsdelivr.net/npm/${tt.name}@${tt.version}/dist/renderer.wasm`;console.warn(`Trying backup URL for WASM loading: ${t}`);try{return await this._tryLoad(t)}catch(a){throw console.error(`Both primary and backup WASM URLs failed. Primary error: ${e.message}, Backup error: ${a.message}`),new Error("WASM loading failed from all sources.")}})),this._ModulePromise}static async load(){return this._loadWithBackup()}static setWasmUrl(e){this._wasmURL=e,this._ModulePromise=null;}};P(Me,"_ModulePromise",null),P(Me,"_wasmURL",`https://unpkg.com/${tt.name}@${tt.version}/dist/renderer.wasm`);var Mr={},ra=function(n,e,t,a,o){var u=new Worker(Mr[e]||(Mr[e]=URL.createObjectURL(new Blob([n+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return u.onmessage=function(c){var h=c.data,m=h.$e$;if(m){var f=new Error(m[0]);f.code=m[1],f.stack=m[2],o(f,null);}else o(null,h);},u.postMessage(t,a),u},Y=Uint8Array,$e=Uint16Array,zr=Int32Array,Wt=new Y([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ht=new Y([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Lr=new Y([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kr=function(n,e){for(var t=new $e(31),a=0;a<31;++a)t[a]=e+=1<<n[a-1];for(var o=new zr(t[30]),a=1;a<30;++a)for(var u=t[a];u<t[a+1];++u)o[u]=u-t[a]<<5|a;return {b:t,r:o}},Ur=kr(Wt,2),Jt=Ur.b,na=Ur.r;Jt[28]=258,na[258]=28;var Rr=kr(Ht,0),jr=Rr.b,At=new $e(32768);for(O=0;O<32768;++O)ve=(O&43690)>>1|(O&21845)<<1,ve=(ve&52428)>>2|(ve&13107)<<2,ve=(ve&61680)>>4|(ve&3855)<<4,At[O]=((ve&65280)>>8|(ve&255)<<8)>>1;var ve,O,Ne=function(n,e,t){for(var a=n.length,o=0,u=new $e(e);o<a;++o)n[o]&&++u[n[o]-1];var c=new $e(e);for(o=1;o<e;++o)c[o]=c[o-1]+u[o-1]<<1;var h;if(t){h=new $e(1<<e);var m=15-e;for(o=0;o<a;++o)if(n[o])for(var f=o<<4|n[o],p=e-n[o],v=c[n[o]-1]++<<p,b=v|(1<<p)-1;v<=b;++v)h[At[v]>>m]=f;}else for(h=new $e(a),o=0;o<a;++o)n[o]&&(h[o]=At[c[n[o]-1]++]>>15-n[o]);return h},rt=new Y(288);for(O=0;O<144;++O)rt[O]=8;var O;for(O=144;O<256;++O)rt[O]=9;var O;for(O=256;O<280;++O)rt[O]=7;var O;for(O=280;O<288;++O)rt[O]=8;var O,Br=new Y(32);for(O=0;O<32;++O)Br[O]=5;var O;var Nr=Ne(rt,9,1);var Vr=Ne(Br,5,1),wt=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},ae=function(n,e,t){var a=e/8|0;return (n[a]|n[a+1]<<8)>>(e&7)&t},bt=function(n,e){var t=e/8|0;return (n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},qr=function(n){return (n+7)/8|0},It=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var a=new Y(t-e);return a.set(n.subarray(e,t)),a};var Wr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],K=function(n,e,t){var a=new Error(e||Wr[n]);if(a.code=n,Error.captureStackTrace&&Error.captureStackTrace(a,K),!t)throw a;return a},Hr=function(n,e,t,a){var o=n.length,u=a?a.length:0;if(!o||e.f&&!e.l)return t||new Y(0);var c=!t||e.i!=2,h=e.i;t||(t=new Y(o*3));var m=function(at){var we=t.length;if(at>we){var st=new Y(Math.max(we*2,at));st.set(t),t=st;}},f=e.f||0,p=e.p||0,v=e.b||0,b=e.l,I=e.d,F=e.m,w=e.n,x=o*8;do{if(!b){f=ae(n,p,1);var T=ae(n,p+1,3);if(p+=3,T)if(T==1)b=Nr,I=Vr,F=9,w=5;else if(T==2){var Z=ae(n,p,31)+257,fe=ae(n,p+10,15)+4,X=Z+ae(n,p+5,31)+1;p+=14;for(var L=new Y(X),N=new Y(19),U=0;U<fe;++U)N[Lr[U]]=ae(n,p+U*3,7);p+=fe*3;for(var R=wt(N),k=(1<<R)-1,ze=Ne(N,R,1),U=0;U<X;){var ye=ze[ae(n,p,k)];p+=ye&15;var C=ye>>4;if(C<16)L[U++]=C;else {var q=0,te=0;for(C==16?(te=3+ae(n,p,3),p+=2,q=L[U-1]):C==17?(te=3+ae(n,p,7),p+=3):C==18&&(te=11+ae(n,p,127),p+=7);te--;)L[U++]=q;}}var We=L.subarray(0,Z),ee=L.subarray(Z);F=wt(We),w=wt(ee),b=Ne(We,F,1),I=Ne(ee,w,1);}else K(1);else {var C=qr(p)+4,D=n[C-4]|n[C-3]<<8,G=C+D;if(G>o){h&&K(0);break}c&&m(v+D),t.set(n.subarray(C,G),v),e.b=v+=D,e.p=p=G*8,e.f=f;continue}if(p>x){h&&K(0);break}}c&&m(v+131072);for(var Pt=(1<<F)-1,Dt=(1<<w)-1,He=p;;He=p){var q=b[bt(n,p)&Pt],ge=q>>4;if(p+=q&15,p>x){h&&K(0);break}if(q||K(2),ge<256)t[v++]=ge;else if(ge==256){He=p,b=null;break}else {var it=ge-254;if(ge>264){var U=ge-257,Ce=Wt[U];it=ae(n,p,(1<<Ce)-1)+Jt[U],p+=Ce;}var Je=I[bt(n,p)&Dt],oe=Je>>4;Je||K(3),p+=Je&15;var ee=jr[oe];if(oe>3){var Ce=Ht[oe];ee+=bt(n,p)&(1<<Ce)-1,p+=Ce;}if(p>x){h&&K(0);break}c&&m(v+131072);var Pe=v+it;if(v<ee){var _e=u-ee,Mt=Math.min(ee,Pe);for(_e+v<0&&K(3);v<Mt;++v)t[v]=a[_e+v];}for(;v<Pe;v+=4)t[v]=t[v-ee],t[v+1]=t[v+1-ee],t[v+2]=t[v+2-ee],t[v+3]=t[v+3-ee];v=Pe;}}e.l=b,e.p=He,e.b=v,e.f=f,b&&(f=1,e.m=F,e.d=I,e.n=w);}while(!f);return v==t.length?t:It(t,0,v)};var ia=new Y(0);var aa=function(n,e){var t={};for(var a in n)t[a]=n[a];for(var a in e)t[a]=e[a];return t},$r=function(n,e,t){for(var a=n(),o=n.toString(),u=o.slice(o.indexOf("[")+1,o.lastIndexOf("]")).replace(/\s+/g,"").split(","),c=0;c<a.length;++c){var h=a[c],m=u[c];if(typeof h=="function"){e+=";"+m+"=";var f=h.toString();if(h.prototype)if(f.indexOf("[native code]")!=-1){var p=f.indexOf(" ",8)+1;e+=f.slice(p,f.indexOf("(",p));}else {e+=f;for(var v in h.prototype)e+=";"+m+".prototype."+v+"="+h.prototype[v].toString();}else e+=f;}else t[m]=h;}return e},_t=[],sa=function(n){var e=[];for(var t in n)n[t].buffer&&e.push((n[t]=new n[t].constructor(n[t])).buffer);return e},oa=function(n,e,t,a){if(!_t[t]){for(var o="",u={},c=n.length-1,h=0;h<c;++h)o=$r(n[h],o,u);_t[t]={c:$r(n[c],o,u),e:u};}var m=aa({},_t[t].e);return ra(_t[t].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",t,m,sa(m),a)},ua=function(){return [Y,$e,zr,Wt,Ht,Lr,Jt,jr,Nr,Vr,At,Wr,Ne,wt,ae,bt,qr,It,K,Hr,Gt,Jr,Gr]};var Jr=function(n){return postMessage(n,[n.buffer])},Gr=function(n){return n&&{out:n.size&&new Y(n.size),dictionary:n.dictionary}},la=function(n,e,t,a,o,u){var c=oa(t,a,o,function(h,m){c.terminate(),u(h,m);});return c.postMessage([n,e],e.consume?[n.buffer]:[]),function(){c.terminate();}};var he=function(n,e){return n[e]|n[e+1]<<8},le=function(n,e){return (n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},Vt=function(n,e){return le(n,e)+le(n,e+4)*4294967296};function ca(n,e,t){return t||(t=e,e={}),typeof t!="function"&&K(7),la(n,e,[ua],function(a){return Jr(Gt(a.data[0],Gr(a.data[1])))},1,t)}function Gt(n,e){return Hr(n,{i:2},e&&e.out,e&&e.dictionary)}var qt=typeof TextDecoder<"u"&&new TextDecoder,fa=0;try{qt.decode(ia,{stream:!0}),fa=1;}catch{}var ha=function(n){for(var e="",t=0;;){var a=n[t++],o=(a>127)+(a>223)+(a>239);if(t+o>n.length)return {s:e,r:It(n,t-1)};o?o==3?(a=((a&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|a>>10,56320|a&1023)):o&1?e+=String.fromCharCode((a&31)<<6|n[t++]&63):e+=String.fromCharCode((a&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(a);}};function Et(n,e){if(e){for(var t="",a=0;a<n.length;a+=16384)t+=String.fromCharCode.apply(null,n.subarray(a,a+16384));return t}else {if(qt)return qt.decode(n);var o=ha(n),u=o.s,t=o.r;return t.length&&K(8),u}}var da=function(n,e){return e+30+he(n,e+26)+he(n,e+28)},pa=function(n,e,t){var a=he(n,e+28),o=Et(n.subarray(e+46,e+46+a),!(he(n,e+8)&2048)),u=e+46+a,c=le(n,e+20),h=t&&c==4294967295?ma(n,u):[c,le(n,e+24),le(n,e+42)],m=h[0],f=h[1],p=h[2];return [he(n,e+10),m,f,o,u+he(n,e+30)+he(n,e+32),p]},ma=function(n,e){for(;he(n,e)!=1;e+=4+he(n,e+2));return [Vt(n,e+12),Vt(n,e+4),Vt(n,e+20)]};var Or=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(n){n();};function Zr(n,e,t){t||(t=e,e={}),typeof t!="function"&&K(7);var a=[],o=function(){for(var x=0;x<a.length;++x)a[x]();},u={},c=function(x,T){Or(function(){t(x,T);});};Or(function(){c=t;});for(var h=n.length-22;le(n,h)!=101010256;--h)if(!h||n.length-h>65558)return c(K(13,0,1),null),o;var m=he(n,h+8);if(m){var f=m,p=le(n,h+16),v=p==4294967295||f==65535;if(v){var b=le(n,h-12);v=le(n,b)==101075792,v&&(f=m=le(n,b+32),p=le(n,b+48));}for(var I=e&&e.filter,F=function(x){var T=pa(n,p,v),C=T[0],D=T[1],G=T[2],Z=T[3],fe=T[4],X=T[5],L=da(n,X);p=fe;var N=function(R,k){R?(o(),c(R,null)):(k&&(u[Z]=k),--m||c(null,u));};if(!I||I({name:Z,size:D,originalSize:G,compression:C}))if(!C)N(null,It(n,L,L+D));else if(C==8){var U=n.subarray(L,L+D);if(D<32e4)try{N(null,Gt(U,{out:new Y(G)}));}catch(R){N(R,null);}else a.push(ca(U,{size:G},N));}else N(K(14,"unknown compression type "+C,1),null);else N(null,null);},w=0;w<f;++w)F(w);}else c(null,{});return o}function Xr(n){return (Array.isArray(n)?n:n.issues).reduce((e,t)=>{if(t.path){let a=t.path.map(({key:o})=>o).join(".");e.nested[a]=[...e.nested[a]||[],t.message];}else e.root=[...e.root||[],t.message];return e},{nested:{}})}var va=class extends Error{constructor(e){super(e[0].message);P(this,"issues");this.name="ValiError",this.issues=e;}};function ya(n,e){return {reason:n?.reason,validation:e.validation,origin:n?.origin||"value",message:e.message,input:e.input,abortEarly:n?.abortEarly,abortPipeEarly:n?.abortPipeEarly}}function ga(n,e){return {reason:e,origin:n?.origin,abortEarly:n?.abortEarly,abortPipeEarly:n?.abortPipeEarly}}function Se(n,e,t,a){if(!e||!e.length)return {output:n};let o,u,c=n;for(let h of e){let m=h(c);if(m.issue){o=o||ga(t,a);let f=ya(o,m.issue);if(u?u.push(f):u=[f],o.abortEarly||o.abortPipeEarly)break}else c=m.output;}return u?{issues:u}:{output:c}}function ce(n,e){return !n||typeof n=="string"?[n,e]:[void 0,n]}function de(n,e,t,a,o,u){return {issues:[{reason:e,validation:t,origin:n?.origin||"value",message:a,input:o,issues:u,abortEarly:n?.abortEarly,abortPipeEarly:n?.abortPipeEarly}]}}function Kr(n=[]){return {schema:"any",async:!1,_parse(e,t){return Se(e,n,t,"any")}}}function Ve(n,e,t){let[a,o]=ce(e,t);return {schema:"array",array:{item:n},async:!1,_parse(u,c){if(!Array.isArray(u))return de(c,"type","array",a||"Invalid type",u);let h,m=[];for(let f=0;f<u.length;f++){let p=u[f],v=n._parse(p,c);if(v.issues){let b={schema:"array",input:u,key:f,value:p};for(let I of v.issues)I.path?I.path.unshift(b):I.path=[b],h?.push(I);if(h||(h=v.issues),c?.abortEarly)break}else m.push(v.output);}return h?{issues:h}:Se(m,o,c,"array")}}}function Tt(n,e){let[t,a]=ce(n,e);return {schema:"boolean",async:!1,_parse(o,u){return typeof o!="boolean"?de(u,"type","boolean",t||"Invalid type",o):Se(o,a,u,"boolean")}}}function Zt(n,e){return {schema:"literal",literal:n,async:!1,_parse(t,a){return t!==n?de(a,"type","literal",e||"Invalid type",t):{output:t}}}}function Yr(n,e){return {schema:"native_enum",nativeEnum:n,async:!1,_parse(t,a){return Object.values(n).includes(t)?{output:t}:de(a,"type","native_enum",e||"Invalid type",t)}}}function se(n,e){let[t,a]=ce(n,e);return {schema:"number",async:!1,_parse(o,u){return typeof o!="number"?de(u,"type","number",t||"Invalid type",o):Se(o,a,u,"number")}}}function Q(n,e,t){let[a,o]=ce(e,t),u;return {schema:"object",object:n,async:!1,_parse(c,h){if(!c||typeof c!="object")return de(h,"type","object",a||"Invalid type",c);u=u||Object.entries(n);let m,f={};for(let[p,v]of u){let b=c[p],I=v._parse(b,h);if(I.issues){let F={schema:"object",input:c,key:p,value:b};for(let w of I.issues)w.path?w.path.unshift(F):w.path=[F],m?.push(w);if(m||(m=I.issues),h?.abortEarly)break}else f[p]=I.output;}return m?{issues:m}:Se(f,o,h,"object")}}}function z(n){return {schema:"optional",wrapped:n,async:!1,_parse(e,t){return e===void 0?{output:e}:n._parse(e,t)}}}function B(n,e){let[t,a]=ce(n,e);return {schema:"string",async:!1,_parse(o,u){return typeof o!="string"?de(u,"type","string",t||"Invalid type",o):Se(o,a,u,"string")}}}function _a(n,e,t,a){if(typeof e=="object"&&!Array.isArray(e)){let[c,h]=ce(t,a);return [n,e,c,h]}let[o,u]=ce(e,t);return [B(),n,o,u]}var wa=["__proto__","prototype","constructor"];function Xt(n,e,t,a){let[o,u,c,h]=_a(n,e,t,a);return {schema:"record",record:{key:o,value:u},async:!1,_parse(m,f){if(!m||typeof m!="object")return de(f,"type","record",c||"Invalid type",m);let p,v={};for(let[b,I]of Object.entries(m))if(!wa.includes(b)){let F,w=o._parse(b,{origin:"key",abortEarly:f?.abortEarly,abortPipeEarly:f?.abortPipeEarly});if(w.issues){F={schema:"record",input:m,key:b,value:I};for(let T of w.issues)T.path=[F],p?.push(T);if(p||(p=w.issues),f?.abortEarly)break}let x=u._parse(I,f);if(x.issues){F=F||{schema:"record",input:m,key:b,value:I};for(let T of x.issues)T.path?T.path.unshift(F):T.path=[F],p?.push(T);if(p||(p=x.issues),f?.abortEarly)break}!w.issues&&!x.issues&&(v[w.output]=x.output);}return p?{issues:p}:Se(v,h,f,"record")}}}function ba(n,e,t){if(typeof n=="object"&&!Array.isArray(n)){let[u,c]=ce(e,t);return [n,u,c]}let[a,o]=ce(n,e);return [void 0,a,o]}function Kt(n,e,t,a){let[o,u,c]=ba(e,t,a);return {schema:"tuple",tuple:{items:n,rest:o},async:!1,_parse(h,m){if(!Array.isArray(h)||!o&&n.length!==h.length||o&&n.length>h.length)return de(m,"type","tuple",u||"Invalid type",h);let f,p=[];for(let v=0;v<n.length;v++){let b=h[v],I=n[v]._parse(b,m);if(I.issues){let F={schema:"tuple",input:h,key:v,value:b};for(let w of I.issues)w.path?w.path.unshift(F):w.path=[F],f?.push(w);if(f||(f=I.issues),m?.abortEarly)break}else p[v]=I.output;}if(o)for(let v=n.length;v<h.length;v++){let b=h[v],I=o._parse(b,m);if(I.issues){let F={schema:"tuple",input:h,key:v,value:b};for(let w of I.issues)w.path?w.path.unshift(F):w.path=[F],f?.push(w);if(f||(f=I.issues),m?.abortEarly)break}else p[v]=I.output;}return f?{issues:f}:Se(p,c,m,"tuple")}}}function Ft(n,e){return {schema:"union",union:n,async:!1,_parse(t,a){let o,u;for(let c of n){let h=c._parse(t,a);if(h.issues)if(o)for(let m of h.issues)o.push(m);else o=h.issues;else {u=[h.output];break}}return u?{output:u[0]}:de(a,"type","union",e||"Invalid type",t,o)}}}function qe(n,e,t){let[a,o]=ce(e,t);return Q(n.reduce((u,c)=>({...u,...c.object}),{}),a,o)}function Qr(n,e,t,a){let[o,u]=ce(t,a);return Q(Object.entries(n.object).reduce((c,[h,m])=>e.includes(h)?c:{...c,[h]:m},{}),o,u)}function en(n,e,t){let a=n._parse(e,t);return a.issues?{success:!1,error:new va(a.issues),issues:a.issues}:{success:!0,data:a.output,output:a.output}}function xt(n,e){return t=>t>n?{issue:{validation:"max_value",message:e||"Invalid value",input:t}}:{output:t}}function St(n,e){return t=>t<n?{issue:{validation:"min_value",message:e||"Invalid value",input:t}}:{output:t}}var Aa=Object.create,Yt=Object.defineProperty,Ia=Object.getOwnPropertyDescriptor,on=Object.getOwnPropertyNames,Ea=Object.getPrototypeOf,Ta=Object.prototype.hasOwnProperty,Fa=(n,e,t)=>e in n?Yt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,nt=(n,e)=>function(){return e||(0, n[on(n)[0]])((e={exports:{}}).exports,e),e.exports},xa=(n,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of on(e))!Ta.call(n,o)&&o!==t&&Yt(n,o,{get:()=>e[o],enumerable:!(a=Ia(e,o))||a.enumerable});return n},Sa=(n,e,t)=>(t=n!=null?Aa(Ea(n)):{},xa(e||!n||!n.__esModule?Yt(t,"default",{value:n,enumerable:!0}):t,n)),Ca=(n,e,t)=>(Fa(n,typeof e!="symbol"?e+"":e,t),t),Pa=nt({"../../node_modules/.pnpm/@rgba-image+copy@0.1.3/node_modules/@rgba-image/copy/dist/index.js"(n){Object.defineProperty(n,"__esModule",{value:!0}),n.copy=void 0;var e=(t,a,o=0,u=0,c=t.width-o,h=t.height-u,m=0,f=0)=>{if(o=o|0,u=u|0,c=c|0,h=h|0,m=m|0,f=f|0,c<=0||h<=0)return;let p=new Uint32Array(t.data.buffer),v=new Uint32Array(a.data.buffer);for(let b=0;b<h;b++){let I=u+b;if(I<0||I>=t.height)continue;let F=f+b;if(!(F<0||F>=a.height))for(let w=0;w<c;w++){let x=o+w;if(x<0||x>=t.width)continue;let T=m+w;if(T<0||T>=a.width)continue;let C=I*t.width+x,D=F*a.width+T;v[D]=p[C];}}};n.copy=e;}}),Da=nt({"../../node_modules/.pnpm/@rgba-image+create-image@0.1.1/node_modules/@rgba-image/create-image/dist/index.js"(n){Object.defineProperty(n,"__esModule",{value:!0}),n.CreateImageFactory=(e=[0,0,0,0],t=4)=>{if(t=Math.floor(t),isNaN(t)||t<1)throw TypeError("channels should be a positive non-zero number");if(!("length"in e)||e.length<t)throw TypeError(`fill should be iterable with at least ${t} members`);e=new Uint8ClampedArray(e).slice(0,t);let a=e.every(u=>u===0);return (u,c,h)=>{if(u===void 0||c===void 0)throw TypeError("Not enough arguments");if(u=Math.floor(u),c=Math.floor(c),isNaN(u)||u<1||isNaN(c)||c<1)throw TypeError("Index or size is negative or greater than the allowed amount");let m=u*c*t;if(h===void 0&&(h=new Uint8ClampedArray(m)),h instanceof Uint8ClampedArray){if(h.length!==m)throw TypeError("Index or size is negative or greater than the allowed amount");if(!a)for(let f=0;f<c;f++)for(let p=0;p<u;p++){let v=(f*u+p)*t;for(let b=0;b<t;b++)h[v+b]=e[b];}return {get width(){return u},get height(){return c},get data(){return h}}}throw TypeError("Expected data to be Uint8ClampedArray or undefined")}},n.createImage=n.CreateImageFactory();}}),Ma=nt({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/filters.js"(n){Object.defineProperty(n,"__esModule",{value:!0}),n.filters=void 0;var e=14,t=(u,c)=>{if(u<=-c||u>=c||u==0)return 0;let h=u*Math.PI;return Math.sin(h)/h*Math.sin(h/c)/(h/c)},a=u=>Math.round(u*((1<<e)-1)),o=(u,c,h,m,f)=>{let p=f?2:3,v=1/h,b=Math.min(1,h),I=p/b,F=Math.floor((I+1)*2),w=new Int16Array((F+2)*c),x=0;for(let T=0;T<c;T++){let C=(T+.5)*v+m,D=Math.max(0,Math.floor(C-I)),G=Math.min(u-1,Math.ceil(C+I)),Z=G-D+1,fe=new Float32Array(Z),X=new Int16Array(Z),L=0,N=0;for(let q=D;q<=G;q++){let te=t((q+.5-C)*b,p);L+=te,fe[N]=te,N++;}let U=0;for(let q=0;q<fe.length;q++){let te=fe[q]/L;U+=te,X[q]=a(te);}X[c>>1]+=a(1-U);let R=0;for(;R<X.length&&X[R]===0;)R++;let k=X.length-1;for(;k>0&&X[k]===0;)k--;let ze=D+R,ye=k-R+1;w[x++]=ze,w[x++]=ye,w.set(X.subarray(R,k+1),x),x+=ye;}return w};n.filters=o;}}),$a=nt({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/convolve.js"(n){Object.defineProperty(n,"__esModule",{value:!0}),n.convolve=void 0;var e=14,t=(a,o,u,c,h,m)=>{let f=0,p=0;for(let v=0;v<c;v++){let b=0;for(let I=0;I<h;I++){let F=m[b++],w=f+F*4|0,x=0,T=0,C=0,D=0;for(let G=m[b++];G>0;G--){let Z=m[b++];x=x+Z*a[w]|0,T=T+Z*a[w+1]|0,C=C+Z*a[w+2]|0,D=D+Z*a[w+3]|0,w=w+4|0;}o[p]=x+8192>>e,o[p+1]=T+8192>>e,o[p+2]=C+8192>>e,o[p+3]=D+8192>>e,p=p+c*4|0;}p=(v+1)*4|0,f=(v+1)*u*4|0;}};n.convolve=t;}}),Oa=nt({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/index.js"(n){Object.defineProperty(n,"__esModule",{value:!0}),n.lanczos2=n.lanczos=void 0;var e=Pa(),t=Da(),a=Ma(),o=$a(),u=(m,f,p=!1)=>{let v=f.width/m.width,b=f.height/m.height,I=a.filters(m.width,f.width,v,0,p),F=a.filters(m.height,f.height,b,0,p),w=new Uint8ClampedArray(f.width*m.height*4);o.convolve(m.data,w,m.width,m.height,f.width,I),o.convolve(w,f.data,m.height,f.width,f.height,F);},c=(m,f,p=0,v=0,b=m.width-p,I=m.height-v,F=0,w=0,x=f.width-F,T=f.height-w)=>{if(p=p|0,v=v|0,b=b|0,I=I|0,F=F|0,w=w|0,x=x|0,T=T|0,b<=0||I<=0||x<=0||T<=0)return;if(p===0&&v===0&&b===m.width&&I===m.height&&F===0&&w===0&&x===f.width&&T===f.height){u(m,f);return}let C=t.createImage(b,I),D=t.createImage(x,T);e.copy(m,C,p,v),u(C,D),e.copy(D,f,0,0,D.width,D.height,F,w);};n.lanczos=c;var h=(m,f,p=0,v=0,b=m.width-p,I=m.height-v,F=0,w=0,x=f.width-F,T=f.height-w)=>{if(p=p|0,v=v|0,b=b|0,I=I|0,F=F|0,w=w|0,x=x|0,T=T|0,b<=0||I<=0||x<=0||T<=0)return;if(p===0&&v===0&&b===m.width&&I===m.height&&F===0&&w===0&&x===f.width&&T===f.height){u(m,f,!0);return}let C=t.createImage(b,I),D=t.createImage(x,T);e.copy(m,C,p,v),u(C,D,!0),e.copy(D,f,0,0,D.width,D.height,F,w);};n.lanczos2=h;}});var un=(n=>(n.Bounce="bounce",n.Normal="normal",n))(un||{}),za=Yr(un),ln=Q({autoplay:z(Tt()),defaultTheme:z(B()),direction:z(Ft([Zt(1),Zt(-1)])),hover:z(Tt()),id:B(),intermission:z(se()),loop:z(Ft([Tt(),se()])),playMode:z(za),speed:z(se()),themeColor:z(B())}),La=Q({animations:Ve(B()),id:B()}),ka=Q({activeAnimationId:z(B()),animations:Ve(ln),author:z(B()),custom:z(Xt(B(),Kr())),description:z(B()),generator:z(B()),keywords:z(B()),revision:z(se()),themes:z(Ve(La)),states:z(Ve(B())),version:z(B())}),Ua=Qr(ln,["id"]),Oe=Q({state:B()}),Ra=Oe,ja=qe([Oe,Q({ms:se()})]),Ba=qe([Oe,Q({count:se()})]),Na=Oe,Va=Oe,qa=Oe,Wa=qe([Oe,Q({threshold:z(Ve(se([St(0),xt(1)])))})]),Ha=Q({onAfter:z(ja),onClick:z(Ra),onComplete:z(qa),onEnter:z(Ba),onMouseEnter:z(Na),onMouseLeave:z(Va),onShow:z(Wa)}),Ja=qe([Ua,Q({playOnScroll:z(Kt([se([St(0),xt(1)]),se([St(0),xt(1)])])),segments:z(Ft([Kt([se(),se()]),B()]))})]);qe([Ha,Q({animationId:z(B()),playbackSettings:Ja})]);var Ka={jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",mpeg:"audio/mpeg",mp3:"audio/mp3"},tn={jpeg:[255,216,255],png:[137,80,78,71,13,10,26,10],gif:[71,73,70],bmp:[66,77],webp:[82,73,70,70,87,69,66,80],svg:[60,63,120],mp3:[73,68,51,3,0,0,0,0],mpeg:[73,68,51,3,0,0,0,0]};var Ya=n=>{let e=null,t=[];if(!n)return null;let a=n.substring(n.indexOf(",")+1);typeof window>"u"?e=Buffer.from(a,"base64").toString("binary"):e=atob(a);let o=new Uint8Array(e.length);for(let u=0;u<e.length;u+=1)o[u]=e.charCodeAt(u);t=Array.from(o.subarray(0,8));for(let u in tn){let c=tn[u];if(c&&t.every((h,m)=>h===c[m]))return Ka[u]}return null};var Qt=class extends Error{constructor(n,e){super(n),Ca(this,"code"),this.name="[dotlottie-js]",this.code=e;}};function cn(n){let e;if(typeof window>"u")e=Buffer.from(n).toString("base64");else {let a=Array.prototype.map.call(n,o=>String.fromCharCode(o)).join("");e=window.btoa(a);}return `data:${Ya(e)};base64,${e}`}function rn(n){return "w"in n&&"h"in n&&!("xt"in n)&&"p"in n}function nn(n){return !("h"in n)&&!("w"in n)&&"p"in n&&"e"in n&&"u"in n&&"id"in n}async function Ct(n,e=()=>!0){if(!(n instanceof Uint8Array))throw new Qt("DotLottie not found","INVALID_DOTLOTTIE");return await new Promise((a,o)=>{Zr(n,{filter:e},(u,c)=>{u&&o(u),a(c);});})}async function Qa(n,e,t){if(!(n instanceof Uint8Array))throw new Qt("DotLottie not found","INVALID_DOTLOTTIE");return (await Ct(n,o=>o.name===e&&(!t||t(o))))[e]}async function er(n){let e="manifest.json",a=(await Ct(n,o=>o.name===e))[e];if(!(typeof a>"u"))return JSON.parse(Et(a,!1))}async function es(n){if(!(n instanceof Uint8Array))return {success:!1,error:"DotLottie not found"};let e=await er(n);if(typeof e>"u")return {success:!1,error:"Invalid .lottie file, manifest.json is missing"};let t=en(ka,e);return t.success?{success:!0}:{success:!1,error:`Invalid .lottie file, manifest.json structure is invalid, ${JSON.stringify(Xr(t.error).nested,null,2)}`}}async function fn(n){let e=new Uint8Array(n),t=await es(e);if(t.error)throw new Qt(t.error,"INVALID_DOTLOTTIE");return e}async function ts(n,e){let t=await Ct(n,o=>{let u=o.name.replace("audio/","");return o.name.startsWith("audio/")&&(!e||e({...o,name:u}))}),a={};for(let o in t){let u=t[o];if(u instanceof Uint8Array){let c=o.replace("audio/","");a[c]=cn(u);}}return a}async function rs(n,e){let t=new Map;for(let[o,u]of Object.entries(e))for(let c of u.assets||[])if(nn(c)){let h=c.p;t.has(h)||t.set(h,new Set),t.get(h)?.add(o);}let a=await ts(n,o=>t.has(o.name));for(let[o,u]of t){let c=a[o];if(c)for(let h of u){let m=e[h];for(let f of m?.assets||[])nn(f)&&f.p===o&&(f.p=c,f.u="",f.e=1);}}}async function ns(n,e){let t=await Ct(n,o=>{let u=o.name.replace("images/","");return o.name.startsWith("images/")&&(!e||e({...o,name:u}))}),a={};for(let o in t){let u=t[o];if(u instanceof Uint8Array){let c=o.replace("images/","");a[c]=cn(u);}}return a}async function is(n,e){let t=new Map;for(let[o,u]of Object.entries(e))for(let c of u.assets||[])if(rn(c)){let h=c.p;t.has(h)||t.set(h,new Set),t.get(h)?.add(o);}let a=await ns(n,o=>t.has(o.name));for(let[o,u]of t){let c=a[o];if(c)for(let h of u){let m=e[h];for(let f of m?.assets||[])rn(f)&&f.p===o&&(f.p=c,f.u="",f.e=1);}}}async function hn(n,e,{inlineAssets:t}={},a){let o=`animations/${e}.json`,u=await Qa(n,o,a);if(typeof u>"u")return;let c=JSON.parse(Et(u,!1));if(!t)return c;let h={[e]:c};return await is(n,h),await rs(n,h),c}Sa(Oa());async function tr(n){let e=await fn(n),t=await er(e),a=t?.activeAnimationId||t?.animations[0]?.id||"";if(!a)throw new Error("Unable to determine the active animation ID from the .lottie manifest.");let o=await hn(e,a,{inlineAssets:!0});return JSON.stringify(o)}async function dn(n){try{let e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch the animation data from URL: ${n}. ${e.status}: ${e.statusText}`);let t=e.headers.get("content-type"),a;if(t?.includes("application/json"))a=await e.text();else {let o=await e.arrayBuffer();a=await tr(o);}return a}catch(e){throw new Error(`Failed to load animation data from URL: ${n}. ${e}`)}}function Es(n){return /^#([\da-f]{6}|[\da-f]{8})$/iu.test(n)}function pn(n){if(!Es(n))return 0;let e=n.replace("#","");return e=e.length===6?`${e}ff`:e,parseInt(e,16)}var mn=class{constructor(e){P(this,"_canvas");P(this,"_context");P(this,"_eventManager",new gt);P(this,"_renderer",null);P(this,"_beginTime",0);P(this,"_elapsedTime",0);P(this,"_totalFrames",0);P(this,"_loop",!1);P(this,"_speed",1);P(this,"_currentFrame",0);P(this,"_duration",0);P(this,"_loopCount",0);P(this,"_autoplay",!1);P(this,"_mode","forward");P(this,"_direction",1);P(this,"_bounceCount",0);P(this,"_animationFrameId",null);P(this,"_segments",null);P(this,"_playbackState","stopped");P(this,"_backgroundColor",vt);P(this,"_renderConfig",{});P(this,"_isFrozen",!1);P(this,"_animationFrameManager",new yt);if(this._animationLoop=this._animationLoop.bind(this),this._canvas=e.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=e.loop??!1,this._speed=e.speed??1,this._autoplay=e.autoplay??!1,this._mode=e.mode??"forward",this._segments=e.segments??null,this._backgroundColor=e.backgroundColor??vt,this._renderConfig=e.renderConfig??{},Me.load().then(t=>{this._renderer=new t.Renderer,this.setBackgroundColor(this._backgroundColor),e.src?this._loadAnimationFromURL(e.src):e.data&&this._initializeAnimationFromData(e.data);}).catch(t=>{this._eventManager.dispatch({type:"loadError",error:t});});}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"}get isFrozen(){return this._isFrozen}_loadAnimationFromURL(e){dn(e).then(t=>{this._initializeAnimationFromData(t);}).catch(t=>{this._eventManager.dispatch({type:"loadError",error:t});});}_initializeAnimationFromData(e){let t=a=>{try{this._renderer?.load(a,this._canvas.width,this._canvas.height)?(this._setupAnimationDetails(),this._eventManager.dispatch({type:"load"}),this.resize(),this._autoplay?this.play():(this._currentFrame=this._mode.includes("reverse")?this._getEffectiveEndFrame():this._getEffectiveStartFrame(),this.setFrame(this._currentFrame))):this._eventManager.dispatch({type:"loadError",error:new Error("Error encountered while initializing animation from data.")});}catch(o){this._eventManager.dispatch({type:"loadError",error:o});}};typeof e=="string"?t(e):e instanceof ArrayBuffer?tr(e).then(t).catch(a=>{this._eventManager.dispatch({type:"loadError",error:a});}):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 e=this._canvas.width,t=this._canvas.height;if(this._renderer.resize(e,t),this._renderer.update()){let a=this._renderer.render();if(a.length===0){console.warn("Empty buffer received from renderer.");return}let o=new Uint8ClampedArray(a),u=this._context.createImageData(e,t);u.data.set(o),this._context.putImageData(u,0,0);}}_update(){if(this._duration===0||this._totalFrames===0)return !1;let e=this._getEffectiveStartFrame(),t=this._getEffectiveEndFrame(),o=this._getEffectiveDuration()/(t-e);this._elapsedTime=(Date.now()/xe-this._beginTime)*this._speed;let u=this._elapsedTime/o;this._mode==="forward"||this._mode==="reverse"?this._currentFrame=this._mode==="forward"?e+u:t-u:this._direction===1?(this._currentFrame=e+u,this._currentFrame>=t&&(this._currentFrame=t,this._direction=-1,this._beginTime=Date.now()/xe)):(this._currentFrame=t-u,this._currentFrame<=e&&(this._currentFrame=e,this._direction=1,this._beginTime=Date.now()/xe)),this._currentFrame=Math.max(e,Math.min(this._currentFrame,t));let c=!1;return this._renderer?.frame(this._currentFrame)&&(this._eventManager.dispatch({type:"frame",currentFrame:this._currentFrame}),c=!0),this._mode==="forward"||this._mode==="reverse"?(this._currentFrame>=t||this._currentFrame<=e)&&this._handleLoopOrCompletion():(this._currentFrame<=e||this._currentFrame>=t)&&(this._bounceCount+=1,this._bounceCount%2===0&&(this._bounceCount=0,this._handleLoopOrCompletion())),c}_handleLoopOrCompletion(){this._loop?(this._loopCount+=1,this._eventManager.dispatch({type:"loop",loopCount:this._loopCount}),this._beginTime=Date.now()/xe):(this._playbackState="stopped",this._eventManager.dispatch({type:"complete"}));}_animationLoop(){this._update()&&this._render(),this.isPlaying&&(this._animationFrameId=this._animationFrameManager.requestAnimationFrame(this._animationLoop));}_stopAnimationLoop(){this._animationFrameId&&(this._animationFrameManager.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null);}_startAnimationLoop(){this._animationFrameId||(this._animationFrameId=this._animationFrameManager.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(e){let t=this._getEffectiveDuration(),a=this._getEffectiveTotalFrames(),o=t/a,u=(e-this._getEffectiveStartFrame())*o;this._direction===-1&&(u=t-u),this._beginTime=Date.now()/xe-u/this._speed;}play(){if(this._totalFrames===0){console.error("Animation is not loaded yet.");return}let e=this._getEffectiveStartFrame(),t=this._getEffectiveEndFrame();this._playbackState!=="paused"?(this._currentFrame=this._mode==="reverse"||this._mode==="bounce-reverse"?t:e,this._beginTime=Date.now()/xe):this._synchronizeAnimationTiming(this._currentFrame),this.isPlaying||(this._playbackState="playing",this._isFrozen&&(this._isFrozen=!1,this._eventManager.dispatch({type:"unfreeze"})),this._eventManager.dispatch({type:"play"}),this._animationFrameId=this._animationFrameManager.requestAnimationFrame(this._animationLoop));}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(e){if(e<=0){console.error("Speed must be a positive number.");return}if(this._speed!==e){if(this.isPlaying){let t=Date.now()/xe;this._beginTime=t-this._elapsedTime/e;}this._speed=e;}}setLoop(e){this._loop=e;}setFrame(e){let t=this._getEffectiveStartFrame(),a=this._getEffectiveEndFrame();if(e<t||e>a){console.error(`Invalid frame number: ${e}. It should be between ${t} and ${a}.`);return}this._currentFrame=e,this.isPlaying&&this._synchronizeAnimationTiming(e),this._renderer?.frame(this._currentFrame)&&(this._render(),this._eventManager.dispatch({type:"frame",currentFrame:this._currentFrame}));}setMode(e){this._mode!==e&&(this._mode=e,this._bounceCount=0,this._direction=e.includes("reverse")?-1:1,this.isPlaying&&this._synchronizeAnimationTiming(this._currentFrame));}load(e){if(!this._renderer||!this._context)return;if(!e.src&&!e.data){console.error('Either "src" or "data" must be provided.');return}this._stopAnimationLoop(),this._playbackState="stopped",this._loop=e.loop??!1,this._speed=e.speed??1,this._autoplay=e.autoplay??!1,this._mode=e.mode??"forward",this._segments=e.segments??null,this._loopCount=0,this._bounceCount=0,this._direction=this._mode.includes("reverse")?-1:1,this._renderConfig=e.renderConfig??{};let t=this._getEffectiveStartFrame(),a=this._getEffectiveEndFrame();this._currentFrame=this._mode==="reverse"||this._mode==="bounce-reverse"?a:t,this._beginTime=0,this._totalFrames=0,this._duration=0,this._backgroundColor=e.backgroundColor??vt,this.setBackgroundColor(this._backgroundColor),this._context.clearRect(0,0,this._canvas.width,this._canvas.height),e.src?this._loadAnimationFromURL(e.src):e.data&&this._initializeAnimationFromData(e.data);}setSegments(e,t){if(!this._renderer){console.error("Animation not initialized.");return}if(e<0||t>=this._totalFrames||e>t){console.error("Invalid frame range.");return}this._segments=[e,t],(this._currentFrame<e||this._currentFrame>t)&&(this._currentFrame=this._direction===1?e:t,this._renderer.frame(this._currentFrame)&&(this._render(),this._eventManager.dispatch({type:"frame",currentFrame:this._currentFrame}))),this.isPlaying&&this._synchronizeAnimationTiming(this._currentFrame);}addEventListener(e,t){this._eventManager.addEventListener(e,t);}removeEventListener(e,t){this._eventManager.removeEventListener(e,t);}static setWasmUrl(e){Me.setWasmUrl(e);}destroy(){this._stopAnimationLoop(),this._playbackState="stopped",this._context=null,this._renderer=null,this._eventManager.dispatch({type:"destroy"}),this._eventManager.removeAllEventListeners();}freeze(){this._isFrozen||(this._stopAnimationLoop(),this._isFrozen=!0,this._eventManager.dispatch({type:"freeze"}));}unfreeze(){this.isFrozen&&(this._isFrozen=!1,this._eventManager.dispatch({type:"unfreeze"}),this.isPlaying&&(this._synchronizeAnimationTiming(this._currentFrame),this._startAnimationLoop()));}setBackgroundColor(e){this._backgroundColor=e;let t=pn(e);this._renderer?.setBgColor(t);}resize(){if(!mt)return;let{height:e,width:t}=this._canvas.getBoundingClientRect(),a=this._renderConfig.devicePixelRatio||window.devicePixelRatio||1;this._canvas.width=t*a,this._canvas.height=e*a,this._render();}};
3
-
4
- export { mn as DotLottie, gt as EventManager, Me as WasmLoader, tr as getAnimationJSONFromDotLottie, pn as hexStringToRGBAInt, Es as isHexColor, dn as loadAnimationJSONFromURL };
5
- //# sourceMappingURL=out.js.map
6
- //# sourceMappingURL=index.js.map
1
+ export * from './dotlottie';
2
+ export * from './event-manager';
3
+ export * from './utils';
4
+ export * from './renderer-loader';
@@ -0,0 +1,37 @@
1
+ import { Module } from './wasm/index.js';
2
+ import './wasm/renderer.js';
3
+
4
+ /**
5
+ * Copyright 2023 Design Barn Inc.
6
+ */
7
+
8
+ /**
9
+ * RendererLoader is a utility class for loading WebAssembly modules.
10
+ * It provides methods to load modules with a primary URL and a backup URL.
11
+ */
12
+ declare class RendererLoader {
13
+ private static _ModulePromise;
14
+ private static _wasmURL;
15
+ private constructor();
16
+ private static _tryLoad;
17
+ /**
18
+ * Tries to load the WASM module from the primary URL, falling back to a backup URL if necessary.
19
+ * Throws an error if both URLs fail to load the module.
20
+ * @returns Promise<Module> - A promise that resolves to the loaded module.
21
+ */
22
+ private static _loadWithBackup;
23
+ /**
24
+ * Public method to load the WebAssembly module.
25
+ * Utilizes a primary and backup URL for robustness.
26
+ * @returns Promise<Module> - A promise that resolves to the loaded module.
27
+ */
28
+ static load(): Promise<Module>;
29
+ /**
30
+ * Sets a new URL for the WASM file and invalidates the current module promise.
31
+ *
32
+ * @param string - The new URL for the WASM file.
33
+ */
34
+ static setWasmUrl(url: string): void;
35
+ }
36
+
37
+ export { RendererLoader };
@@ -0,0 +1,63 @@
1
+ import pkg from '../package.json';
2
+ import { createRendererModule } from './wasm';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => {
7
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
+ return value;
9
+ };
10
+ class RendererLoader {
11
+ constructor() {
12
+ throw new Error("RendererLoader is a static class and cannot be instantiated.");
13
+ }
14
+ static async _tryLoad(url) {
15
+ const module = await createRendererModule({ locateFile: () => url });
16
+ return module;
17
+ }
18
+ /**
19
+ * Tries to load the WASM module from the primary URL, falling back to a backup URL if necessary.
20
+ * Throws an error if both URLs fail to load the module.
21
+ * @returns Promise<Module> - A promise that resolves to the loaded module.
22
+ */
23
+ static async _loadWithBackup() {
24
+ if (!this._ModulePromise) {
25
+ this._ModulePromise = this._tryLoad(this._wasmURL).catch(async (initialError) => {
26
+ const backupUrl = `https://unpkg.com/${pkg.name}@${pkg.version}/dist/wasm/renderer.wasm`;
27
+ console.warn(`Trying backup URL for WASM loading: ${backupUrl}`);
28
+ try {
29
+ return await this._tryLoad(backupUrl);
30
+ } catch (backupError) {
31
+ console.error(
32
+ `Both primary and backup WASM URLs failed. Primary error: ${initialError.message}, Backup error: ${backupError.message}`
33
+ );
34
+ throw new Error("WASM loading failed from all sources.");
35
+ }
36
+ });
37
+ }
38
+ return this._ModulePromise;
39
+ }
40
+ /**
41
+ * Public method to load the WebAssembly module.
42
+ * Utilizes a primary and backup URL for robustness.
43
+ * @returns Promise<Module> - A promise that resolves to the loaded module.
44
+ */
45
+ static async load() {
46
+ return this._loadWithBackup();
47
+ }
48
+ /**
49
+ * Sets a new URL for the WASM file and invalidates the current module promise.
50
+ *
51
+ * @param string - The new URL for the WASM file.
52
+ */
53
+ static setWasmUrl(url) {
54
+ this._wasmURL = url;
55
+ this._ModulePromise = null;
56
+ }
57
+ }
58
+ // eslint-disable-next-line @typescript-eslint/naming-convention
59
+ __publicField(RendererLoader, "_ModulePromise", null);
60
+ // URL for the WASM file, constructed using package information
61
+ __publicField(RendererLoader, "_wasmURL", `https://cdn.jsdelivr.net/npm/${pkg.name}@${pkg.version}/dist/wasm/renderer.wasm`);
62
+
63
+ export { RendererLoader };
package/dist/utils.js CHANGED
@@ -1,5 +1,46 @@
1
- var we=Object.defineProperty;var Ae=(t,e,r)=>e in t?we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ft=(t,e,r)=>(Ae(t,typeof e!="symbol"?e+"":e,r),r);var Bt={},be=function(t,e,r,i,n){var a=new Worker(Bt[e]||(Bt[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(s){var u=s.data,c=u.$e$;if(c){var o=new Error(c[0]);o.code=c[1],o.stack=c[2],n(o,null);}else n(null,u);},a.postMessage(r,i),a},z=Uint8Array,J=Uint16Array,Ct=Int32Array,wt=new z([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),At=new z([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Vt=new z([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qt=function(t,e){for(var r=new J(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];for(var n=new Ct(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return {b:r,r:n}},Rt=qt(wt,2),bt=Rt.b,Ie=Rt.r;bt[28]=258,Ie[258]=28;var $t=qt(At,0),Ht=$t.b,at=new J(32768);for(_=0;_<32768;++_)R=(_&43690)>>1|(_&21845)<<1,R=(R&52428)>>2|(R&13107)<<2,R=(R&61680)>>4|(R&3855)<<4,at[_]=((R&65280)>>8|(R&255)<<8)>>1;var R,_,Z=function(t,e,r){for(var i=t.length,n=0,a=new J(e);n<i;++n)t[n]&&++a[t[n]-1];var s=new J(e);for(n=1;n<e;++n)s[n]=s[n-1]+a[n-1]<<1;var u;if(r){u=new J(1<<e);var c=15-e;for(n=0;n<i;++n)if(t[n])for(var o=n<<4|t[n],l=e-t[n],f=s[t[n]-1]++<<l,h=f|(1<<l)-1;f<=h;++f)u[at[f]>>c]=o;}else for(u=new J(i),n=0;n<i;++n)t[n]&&(u[n]=at[s[t[n]-1]++]>>15-t[n]);return u},tt=new z(288);for(_=0;_<144;++_)tt[_]=8;var _;for(_=144;_<256;++_)tt[_]=9;var _;for(_=256;_<280;++_)tt[_]=7;var _;for(_=280;_<288;++_)tt[_]=8;var _,Jt=new z(32);for(_=0;_<32;++_)Jt[_]=5;var _;var Wt=Z(tt,9,1);var Gt=Z(Jt,5,1),nt=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},L=function(t,e,r){var i=e/8|0;return (t[i]|t[i+1]<<8)>>(e&7)&r},it=function(t,e){var r=e/8|0;return (t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},Zt=function(t){return (t+7)/8|0},st=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var i=new z(r-e);return i.set(t.subarray(e,r)),i};var Yt=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,e,r){var i=new Error(e||Yt[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,E),!r)throw i;return i},Kt=function(t,e,r,i){var n=t.length,a=i?i.length:0;if(!n||e.f&&!e.l)return r||new z(0);var s=!r||e.i!=2,u=e.i;r||(r=new z(n*3));var c=function(jt){var Lt=r.length;if(jt>Lt){var Ut=new z(Math.max(Lt*2,jt));Ut.set(r),r=Ut;}},o=e.f||0,l=e.p||0,f=e.b||0,h=e.l,d=e.d,m=e.m,p=e.n,y=n*8;do{if(!h){o=L(t,l,1);var v=L(t,l+1,3);if(l+=3,v)if(v==1)h=Wt,d=Gt,m=9,p=5;else if(v==2){var O=L(t,l,31)+257,$=L(t,l+10,15)+4,j=O+L(t,l+5,31)+1;l+=14;for(var T=new z(j),N=new z(19),I=0;I<$;++I)N[Vt[I]]=L(t,l+I*3,7);l+=$*3;for(var M=nt(N),k=(1<<M)-1,pt=Z(N,M,1),I=0;I<j;){var X=pt[L(t,l,k)];l+=X&15;var g=X>>4;if(g<16)T[I++]=g;else {var x=0,C=0;for(g==16?(C=3+L(t,l,3),l+=2,x=T[I-1]):g==17?(C=3+L(t,l,7),l+=3):g==18&&(C=11+L(t,l,127),l+=7);C--;)T[I++]=x;}}var St=T.subarray(0,O),F=T.subarray(O);m=nt(St),p=nt(F),h=Z(St,m,1),d=Z(F,p,1);}else E(1);else {var g=Zt(l)+4,A=t[g-4]|t[g-3]<<8,S=g+A;if(S>n){u&&E(0);break}s&&c(f+A),r.set(t.subarray(g,S),f),e.b=f+=A,e.p=l=S*8,e.f=o;continue}if(l>y){u&&E(0);break}}s&&c(f+131072);for(var ye=(1<<m)-1,ge=(1<<p)-1,dt=l;;dt=l){var x=h[it(t,l)&ye],G=x>>4;if(l+=x&15,l>y){u&&E(0);break}if(x||E(2),G<256)r[f++]=G;else if(G==256){dt=l,h=null;break}else {var Tt=G-254;if(G>264){var I=G-257,Q=wt[I];Tt=L(t,l,(1<<Q)-1)+bt[I],l+=Q;}var mt=d[it(t,l)&ge],vt=mt>>4;mt||E(3),l+=mt&15;var F=Ht[vt];if(vt>3){var Q=At[vt];F+=it(t,l)&(1<<Q)-1,l+=Q;}if(l>y){u&&E(0);break}s&&c(f+131072);var yt=f+Tt;if(f<F){var Nt=a-F,_e=Math.min(F,yt);for(Nt+f<0&&E(3);f<_e;++f)r[f]=i[Nt+f];}for(;f<yt;f+=4)r[f]=r[f-F],r[f+1]=r[f+1-F],r[f+2]=r[f+2-F],r[f+3]=r[f+3-F];f=yt;}}e.l=h,e.p=dt,e.b=f,e.f=o,h&&(o=1,e.m=m,e.d=d,e.n=p);}while(!o);return f==r.length?r:st(r,0,f)};var xe=new z(0);var Ee=function(t,e){var r={};for(var i in t)r[i]=t[i];for(var i in e)r[i]=e[i];return r},Pt=function(t,e,r){for(var i=t(),n=t.toString(),a=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<i.length;++s){var u=i[s],c=a[s];if(typeof u=="function"){e+=";"+c+"=";var o=u.toString();if(u.prototype)if(o.indexOf("[native code]")!=-1){var l=o.indexOf(" ",8)+1;e+=o.slice(l,o.indexOf("(",l));}else {e+=o;for(var f in u.prototype)e+=";"+c+".prototype."+f+"="+u.prototype[f].toString();}else e+=o;}else r[c]=u;}return e},rt=[],ze=function(t){var e=[];for(var r in t)t[r].buffer&&e.push((t[r]=new t[r].constructor(t[r])).buffer);return e},De=function(t,e,r,i){if(!rt[r]){for(var n="",a={},s=t.length-1,u=0;u<s;++u)n=Pt(t[u],n,a);rt[r]={c:Pt(t[s],n,a),e:a};}var c=Ee({},rt[r].e);return be(rt[r].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",r,c,ze(c),i)},Oe=function(){return [z,J,Ct,wt,At,Vt,bt,Ht,Wt,Gt,at,Yt,Z,nt,L,it,Zt,st,E,Kt,It,Xt,Qt]};var Xt=function(t){return postMessage(t,[t.buffer])},Qt=function(t){return t&&{out:t.size&&new z(t.size),dictionary:t.dictionary}},Me=function(t,e,r,i,n,a){var s=De(r,i,n,function(u,c){s.terminate(),a(u,c);});return s.postMessage([t,e],e.consume?[t.buffer]:[]),function(){s.terminate();}};var V=function(t,e){return t[e]|t[e+1]<<8},B=function(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},gt=function(t,e){return B(t,e)+B(t,e+4)*4294967296};function Se(t,e,r){return r||(r=e,e={}),typeof r!="function"&&E(7),Me(t,e,[Oe],function(i){return Xt(It(i.data[0],Qt(i.data[1])))},1,r)}function It(t,e){return Kt(t,{i:2},e&&e.out,e&&e.dictionary)}var _t=typeof TextDecoder<"u"&&new TextDecoder,Te=0;try{_t.decode(xe,{stream:!0}),Te=1;}catch{}var Ne=function(t){for(var e="",r=0;;){var i=t[r++],n=(i>127)+(i>223)+(i>239);if(r+n>t.length)return {s:e,r:st(t,r-1)};n?n==3?(i=((i&15)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63)-65536,e+=String.fromCharCode(55296|i>>10,56320|i&1023)):n&1?e+=String.fromCharCode((i&31)<<6|t[r++]&63):e+=String.fromCharCode((i&15)<<12|(t[r++]&63)<<6|t[r++]&63):e+=String.fromCharCode(i);}};function ot(t,e){if(e){for(var r="",i=0;i<t.length;i+=16384)r+=String.fromCharCode.apply(null,t.subarray(i,i+16384));return r}else {if(_t)return _t.decode(t);var n=Ne(t),a=n.s,r=n.r;return r.length&&E(8),a}}var je=function(t,e){return e+30+V(t,e+26)+V(t,e+28)},Le=function(t,e,r){var i=V(t,e+28),n=ot(t.subarray(e+46,e+46+i),!(V(t,e+8)&2048)),a=e+46+i,s=B(t,e+20),u=r&&s==4294967295?Ue(t,a):[s,B(t,e+24),B(t,e+42)],c=u[0],o=u[1],l=u[2];return [V(t,e+10),c,o,n,a+V(t,e+30)+V(t,e+32),l]},Ue=function(t,e){for(;V(t,e)!=1;e+=4+V(t,e+2));return [gt(t,e+12),gt(t,e+4),gt(t,e+20)]};var kt=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(t){t();};function te(t,e,r){r||(r=e,e={}),typeof r!="function"&&E(7);var i=[],n=function(){for(var y=0;y<i.length;++y)i[y]();},a={},s=function(y,v){kt(function(){r(y,v);});};kt(function(){s=r;});for(var u=t.length-22;B(t,u)!=101010256;--u)if(!u||t.length-u>65558)return s(E(13,0,1),null),n;var c=V(t,u+8);if(c){var o=c,l=B(t,u+16),f=l==4294967295||o==65535;if(f){var h=B(t,u-12);f=B(t,h)==101075792,f&&(o=c=B(t,h+32),l=B(t,h+48));}for(var d=e&&e.filter,m=function(y){var v=Le(t,l,f),g=v[0],A=v[1],S=v[2],O=v[3],$=v[4],j=v[5],T=je(t,j);l=$;var N=function(M,k){M?(n(),s(M,null)):(k&&(a[O]=k),--c||s(null,a));};if(!d||d({name:O,size:A,originalSize:S,compression:g}))if(!g)N(null,st(t,T,T+A));else if(g==8){var I=t.subarray(T,T+A);if(A<32e4)try{N(null,It(I,{out:new z(S)}));}catch(M){N(M,null);}else i.push(Se(I,{size:S},N));}else N(E(14,"unknown compression type "+g,1),null);else N(null,null);},p=0;p<o;++p)m(p);}else s(null,{});return n}function ee(t){return (Array.isArray(t)?t:t.issues).reduce((e,r)=>{if(r.path){let i=r.path.map(({key:n})=>n).join(".");e.nested[i]=[...e.nested[i]||[],r.message];}else e.root=[...e.root||[],r.message];return e},{nested:{}})}var Fe=class extends Error{constructor(e){super(e[0].message);Ft(this,"issues");this.name="ValiError",this.issues=e;}};function Be(t,e){return {reason:t?.reason,validation:e.validation,origin:t?.origin||"value",message:e.message,input:e.input,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly}}function Pe(t,e){return {reason:e,origin:t?.origin,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly}}function H(t,e,r,i){if(!e||!e.length)return {output:t};let n,a,s=t;for(let u of e){let c=u(s);if(c.issue){n=n||Pe(r,i);let o=Be(n,c.issue);if(a?a.push(o):a=[o],n.abortEarly||n.abortPipeEarly)break}else s=c.output;}return a?{issues:a}:{output:s}}function P(t,e){return !t||typeof t=="string"?[t,e]:[void 0,t]}function q(t,e,r,i,n,a){return {issues:[{reason:e,validation:r,origin:t?.origin||"value",message:i,input:n,issues:a,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly}]}}function re(t=[]){return {schema:"any",async:!1,_parse(e,r){return H(e,t,r,"any")}}}function Y(t,e,r){let[i,n]=P(e,r);return {schema:"array",array:{item:t},async:!1,_parse(a,s){if(!Array.isArray(a))return q(s,"type","array",i||"Invalid type",a);let u,c=[];for(let o=0;o<a.length;o++){let l=a[o],f=t._parse(l,s);if(f.issues){let h={schema:"array",input:a,key:o,value:l};for(let d of f.issues)d.path?d.path.unshift(h):d.path=[h],u?.push(d);if(u||(u=f.issues),s?.abortEarly)break}else c.push(f.output);}return u?{issues:u}:H(c,n,s,"array")}}}function ut(t,e){let[r,i]=P(t,e);return {schema:"boolean",async:!1,_parse(n,a){return typeof n!="boolean"?q(a,"type","boolean",r||"Invalid type",n):H(n,i,a,"boolean")}}}function xt(t,e){return {schema:"literal",literal:t,async:!1,_parse(r,i){return r!==t?q(i,"type","literal",e||"Invalid type",r):{output:r}}}}function ne(t,e){return {schema:"native_enum",nativeEnum:t,async:!1,_parse(r,i){return Object.values(t).includes(r)?{output:r}:q(i,"type","native_enum",e||"Invalid type",r)}}}function U(t,e){let[r,i]=P(t,e);return {schema:"number",async:!1,_parse(n,a){return typeof n!="number"?q(a,"type","number",r||"Invalid type",n):H(n,i,a,"number")}}}function D(t,e,r){let[i,n]=P(e,r),a;return {schema:"object",object:t,async:!1,_parse(s,u){if(!s||typeof s!="object")return q(u,"type","object",i||"Invalid type",s);a=a||Object.entries(t);let c,o={};for(let[l,f]of a){let h=s[l],d=f._parse(h,u);if(d.issues){let m={schema:"object",input:s,key:l,value:h};for(let p of d.issues)p.path?p.path.unshift(m):p.path=[m],c?.push(p);if(c||(c=d.issues),u?.abortEarly)break}else o[l]=d.output;}return c?{issues:c}:H(o,n,u,"object")}}}function w(t){return {schema:"optional",wrapped:t,async:!1,_parse(e,r){return e===void 0?{output:e}:t._parse(e,r)}}}function b(t,e){let[r,i]=P(t,e);return {schema:"string",async:!1,_parse(n,a){return typeof n!="string"?q(a,"type","string",r||"Invalid type",n):H(n,i,a,"string")}}}function ke(t,e,r,i){if(typeof e=="object"&&!Array.isArray(e)){let[s,u]=P(r,i);return [t,e,s,u]}let[n,a]=P(e,r);return [b(),t,n,a]}var Ce=["__proto__","prototype","constructor"];function Et(t,e,r,i){let[n,a,s,u]=ke(t,e,r,i);return {schema:"record",record:{key:n,value:a},async:!1,_parse(c,o){if(!c||typeof c!="object")return q(o,"type","record",s||"Invalid type",c);let l,f={};for(let[h,d]of Object.entries(c))if(!Ce.includes(h)){let m,p=n._parse(h,{origin:"key",abortEarly:o?.abortEarly,abortPipeEarly:o?.abortPipeEarly});if(p.issues){m={schema:"record",input:c,key:h,value:d};for(let v of p.issues)v.path=[m],l?.push(v);if(l||(l=p.issues),o?.abortEarly)break}let y=a._parse(d,o);if(y.issues){m=m||{schema:"record",input:c,key:h,value:d};for(let v of y.issues)v.path?v.path.unshift(m):v.path=[m],l?.push(v);if(l||(l=y.issues),o?.abortEarly)break}!p.issues&&!y.issues&&(f[p.output]=y.output);}return l?{issues:l}:H(f,u,o,"record")}}}function Ve(t,e,r){if(typeof t=="object"&&!Array.isArray(t)){let[a,s]=P(e,r);return [t,a,s]}let[i,n]=P(t,e);return [void 0,i,n]}function zt(t,e,r,i){let[n,a,s]=Ve(e,r,i);return {schema:"tuple",tuple:{items:t,rest:n},async:!1,_parse(u,c){if(!Array.isArray(u)||!n&&t.length!==u.length||n&&t.length>u.length)return q(c,"type","tuple",a||"Invalid type",u);let o,l=[];for(let f=0;f<t.length;f++){let h=u[f],d=t[f]._parse(h,c);if(d.issues){let m={schema:"tuple",input:u,key:f,value:h};for(let p of d.issues)p.path?p.path.unshift(m):p.path=[m],o?.push(p);if(o||(o=d.issues),c?.abortEarly)break}else l[f]=d.output;}if(n)for(let f=t.length;f<u.length;f++){let h=u[f],d=n._parse(h,c);if(d.issues){let m={schema:"tuple",input:u,key:f,value:h};for(let p of d.issues)p.path?p.path.unshift(m):p.path=[m],o?.push(p);if(o||(o=d.issues),c?.abortEarly)break}else l[f]=d.output;}return o?{issues:o}:H(l,s,c,"tuple")}}}function lt(t,e){return {schema:"union",union:t,async:!1,_parse(r,i){let n,a;for(let s of t){let u=s._parse(r,i);if(u.issues)if(n)for(let c of u.issues)n.push(c);else n=u.issues;else {a=[u.output];break}}return a?{output:a[0]}:q(i,"type","union",e||"Invalid type",r,n)}}}function K(t,e,r){let[i,n]=P(e,r);return D(t.reduce((a,s)=>({...a,...s.object}),{}),i,n)}function ie(t,e,r,i){let[n,a]=P(r,i);return D(Object.entries(t.object).reduce((s,[u,c])=>e.includes(u)?s:{...s,[u]:c},{}),n,a)}function ae(t,e,r){let i=t._parse(e,r);return i.issues?{success:!1,error:new Fe(i.issues),issues:i.issues}:{success:!0,data:i.output,output:i.output}}function ct(t,e){return r=>r>t?{issue:{validation:"max_value",message:e||"Invalid value",input:r}}:{output:r}}function ft(t,e){return r=>r<t?{issue:{validation:"min_value",message:e||"Invalid value",input:r}}:{output:r}}var qe=Object.create,Dt=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,fe=Object.getOwnPropertyNames,$e=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty,Je=(t,e,r)=>e in t?Dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,et=(t,e)=>function(){return e||(0, t[fe(t)[0]])((e={exports:{}}).exports,e),e.exports},We=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of fe(e))!He.call(t,n)&&n!==r&&Dt(t,n,{get:()=>e[n],enumerable:!(i=Re(e,n))||i.enumerable});return t},Ge=(t,e,r)=>(r=t!=null?qe($e(t)):{},We(e||!t||!t.__esModule?Dt(r,"default",{value:t,enumerable:!0}):r,t)),Ze=(t,e,r)=>(Je(t,typeof e!="symbol"?e+"":e,r),r),Ye=et({"../../node_modules/.pnpm/@rgba-image+copy@0.1.3/node_modules/@rgba-image/copy/dist/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.copy=void 0;var e=(r,i,n=0,a=0,s=r.width-n,u=r.height-a,c=0,o=0)=>{if(n=n|0,a=a|0,s=s|0,u=u|0,c=c|0,o=o|0,s<=0||u<=0)return;let l=new Uint32Array(r.data.buffer),f=new Uint32Array(i.data.buffer);for(let h=0;h<u;h++){let d=a+h;if(d<0||d>=r.height)continue;let m=o+h;if(!(m<0||m>=i.height))for(let p=0;p<s;p++){let y=n+p;if(y<0||y>=r.width)continue;let v=c+p;if(v<0||v>=i.width)continue;let g=d*r.width+y,A=m*i.width+v;f[A]=l[g];}}};t.copy=e;}}),Ke=et({"../../node_modules/.pnpm/@rgba-image+create-image@0.1.1/node_modules/@rgba-image/create-image/dist/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CreateImageFactory=(e=[0,0,0,0],r=4)=>{if(r=Math.floor(r),isNaN(r)||r<1)throw TypeError("channels should be a positive non-zero number");if(!("length"in e)||e.length<r)throw TypeError(`fill should be iterable with at least ${r} members`);e=new Uint8ClampedArray(e).slice(0,r);let i=e.every(a=>a===0);return (a,s,u)=>{if(a===void 0||s===void 0)throw TypeError("Not enough arguments");if(a=Math.floor(a),s=Math.floor(s),isNaN(a)||a<1||isNaN(s)||s<1)throw TypeError("Index or size is negative or greater than the allowed amount");let c=a*s*r;if(u===void 0&&(u=new Uint8ClampedArray(c)),u instanceof Uint8ClampedArray){if(u.length!==c)throw TypeError("Index or size is negative or greater than the allowed amount");if(!i)for(let o=0;o<s;o++)for(let l=0;l<a;l++){let f=(o*a+l)*r;for(let h=0;h<r;h++)u[f+h]=e[h];}return {get width(){return a},get height(){return s},get data(){return u}}}throw TypeError("Expected data to be Uint8ClampedArray or undefined")}},t.createImage=t.CreateImageFactory();}}),Xe=et({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/filters.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.filters=void 0;var e=14,r=(a,s)=>{if(a<=-s||a>=s||a==0)return 0;let u=a*Math.PI;return Math.sin(u)/u*Math.sin(u/s)/(u/s)},i=a=>Math.round(a*((1<<e)-1)),n=(a,s,u,c,o)=>{let l=o?2:3,f=1/u,h=Math.min(1,u),d=l/h,m=Math.floor((d+1)*2),p=new Int16Array((m+2)*s),y=0;for(let v=0;v<s;v++){let g=(v+.5)*f+c,A=Math.max(0,Math.floor(g-d)),S=Math.min(a-1,Math.ceil(g+d)),O=S-A+1,$=new Float32Array(O),j=new Int16Array(O),T=0,N=0;for(let x=A;x<=S;x++){let C=r((x+.5-g)*h,l);T+=C,$[N]=C,N++;}let I=0;for(let x=0;x<$.length;x++){let C=$[x]/T;I+=C,j[x]=i(C);}j[s>>1]+=i(1-I);let M=0;for(;M<j.length&&j[M]===0;)M++;let k=j.length-1;for(;k>0&&j[k]===0;)k--;let pt=A+M,X=k-M+1;p[y++]=pt,p[y++]=X,p.set(j.subarray(M,k+1),y),y+=X;}return p};t.filters=n;}}),Qe=et({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/convolve.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convolve=void 0;var e=14,r=(i,n,a,s,u,c)=>{let o=0,l=0;for(let f=0;f<s;f++){let h=0;for(let d=0;d<u;d++){let m=c[h++],p=o+m*4|0,y=0,v=0,g=0,A=0;for(let S=c[h++];S>0;S--){let O=c[h++];y=y+O*i[p]|0,v=v+O*i[p+1]|0,g=g+O*i[p+2]|0,A=A+O*i[p+3]|0,p=p+4|0;}n[l]=y+8192>>e,n[l+1]=v+8192>>e,n[l+2]=g+8192>>e,n[l+3]=A+8192>>e,l=l+s*4|0;}l=(f+1)*4|0,o=(f+1)*a*4|0;}};t.convolve=r;}}),tr=et({"../../node_modules/.pnpm/@rgba-image+lanczos@0.1.1/node_modules/@rgba-image/lanczos/dist/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.lanczos2=t.lanczos=void 0;var e=Ye(),r=Ke(),i=Xe(),n=Qe(),a=(c,o,l=!1)=>{let f=o.width/c.width,h=o.height/c.height,d=i.filters(c.width,o.width,f,0,l),m=i.filters(c.height,o.height,h,0,l),p=new Uint8ClampedArray(o.width*c.height*4);n.convolve(c.data,p,c.width,c.height,o.width,d),n.convolve(p,o.data,c.height,o.width,o.height,m);},s=(c,o,l=0,f=0,h=c.width-l,d=c.height-f,m=0,p=0,y=o.width-m,v=o.height-p)=>{if(l=l|0,f=f|0,h=h|0,d=d|0,m=m|0,p=p|0,y=y|0,v=v|0,h<=0||d<=0||y<=0||v<=0)return;if(l===0&&f===0&&h===c.width&&d===c.height&&m===0&&p===0&&y===o.width&&v===o.height){a(c,o);return}let g=r.createImage(h,d),A=r.createImage(y,v);e.copy(c,g,l,f),a(g,A),e.copy(A,o,0,0,A.width,A.height,m,p);};t.lanczos=s;var u=(c,o,l=0,f=0,h=c.width-l,d=c.height-f,m=0,p=0,y=o.width-m,v=o.height-p)=>{if(l=l|0,f=f|0,h=h|0,d=d|0,m=m|0,p=p|0,y=y|0,v=v|0,h<=0||d<=0||y<=0||v<=0)return;if(l===0&&f===0&&h===c.width&&d===c.height&&m===0&&p===0&&y===o.width&&v===o.height){a(c,o,!0);return}let g=r.createImage(h,d),A=r.createImage(y,v);e.copy(c,g,l,f),a(g,A,!0),e.copy(A,o,0,0,A.width,A.height,m,p);};t.lanczos2=u;}});var he=(t=>(t.Bounce="bounce",t.Normal="normal",t))(he||{}),er=ne(he),pe=D({autoplay:w(ut()),defaultTheme:w(b()),direction:w(lt([xt(1),xt(-1)])),hover:w(ut()),id:b(),intermission:w(U()),loop:w(lt([ut(),U()])),playMode:w(er),speed:w(U()),themeColor:w(b())}),rr=D({animations:Y(b()),id:b()}),nr=D({activeAnimationId:w(b()),animations:Y(pe),author:w(b()),custom:w(Et(b(),re())),description:w(b()),generator:w(b()),keywords:w(b()),revision:w(U()),themes:w(Y(rr)),states:w(Y(b())),version:w(b())}),ir=ie(pe,["id"]),W=D({state:b()}),ar=W,sr=K([W,D({ms:U()})]),or=K([W,D({count:U()})]),ur=W,lr=W,cr=W,fr=K([W,D({threshold:w(Y(U([ft(0),ct(1)])))})]),hr=D({onAfter:w(sr),onClick:w(ar),onComplete:w(cr),onEnter:w(or),onMouseEnter:w(ur),onMouseLeave:w(lr),onShow:w(fr)}),pr=K([ir,D({playOnScroll:w(zt([U([ft(0),ct(1)]),U([ft(0),ct(1)])])),segments:w(lt([zt([U(),U()]),b()]))})]);K([hr,D({animationId:w(b()),playbackSettings:pr})]);var yr={jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",webp:"image/webp",mpeg:"audio/mpeg",mp3:"audio/mp3"},se={jpeg:[255,216,255],png:[137,80,78,71,13,10,26,10],gif:[71,73,70],bmp:[66,77],webp:[82,73,70,70,87,69,66,80],svg:[60,63,120],mp3:[73,68,51,3,0,0,0,0],mpeg:[73,68,51,3,0,0,0,0]};var gr=t=>{let e=null,r=[];if(!t)return null;let i=t.substring(t.indexOf(",")+1);typeof window>"u"?e=Buffer.from(i,"base64").toString("binary"):e=atob(i);let n=new Uint8Array(e.length);for(let a=0;a<e.length;a+=1)n[a]=e.charCodeAt(a);r=Array.from(n.subarray(0,8));for(let a in se){let s=se[a];if(s&&r.every((u,c)=>u===s[c]))return yr[a]}return null};var Ot=class extends Error{constructor(t,e){super(t),Ze(this,"code"),this.name="[dotlottie-js]",this.code=e;}};function de(t){let e;if(typeof window>"u")e=Buffer.from(t).toString("base64");else {let i=Array.prototype.map.call(t,n=>String.fromCharCode(n)).join("");e=window.btoa(i);}return `data:${gr(e)};base64,${e}`}function oe(t){return "w"in t&&"h"in t&&!("xt"in t)&&"p"in t}function ue(t){return !("h"in t)&&!("w"in t)&&"p"in t&&"e"in t&&"u"in t&&"id"in t}async function ht(t,e=()=>!0){if(!(t instanceof Uint8Array))throw new Ot("DotLottie not found","INVALID_DOTLOTTIE");return await new Promise((i,n)=>{te(t,{filter:e},(a,s)=>{a&&n(a),i(s);});})}async function _r(t,e,r){if(!(t instanceof Uint8Array))throw new Ot("DotLottie not found","INVALID_DOTLOTTIE");return (await ht(t,n=>n.name===e&&(!r||r(n))))[e]}async function Mt(t){let e="manifest.json",i=(await ht(t,n=>n.name===e))[e];if(!(typeof i>"u"))return JSON.parse(ot(i,!1))}async function wr(t){if(!(t instanceof Uint8Array))return {success:!1,error:"DotLottie not found"};let e=await Mt(t);if(typeof e>"u")return {success:!1,error:"Invalid .lottie file, manifest.json is missing"};let r=ae(nr,e);return r.success?{success:!0}:{success:!1,error:`Invalid .lottie file, manifest.json structure is invalid, ${JSON.stringify(ee(r.error).nested,null,2)}`}}async function me(t){let e=new Uint8Array(t),r=await wr(e);if(r.error)throw new Ot(r.error,"INVALID_DOTLOTTIE");return e}async function Ar(t,e){let r=await ht(t,n=>{let a=n.name.replace("audio/","");return n.name.startsWith("audio/")&&(!e||e({...n,name:a}))}),i={};for(let n in r){let a=r[n];if(a instanceof Uint8Array){let s=n.replace("audio/","");i[s]=de(a);}}return i}async function br(t,e){let r=new Map;for(let[n,a]of Object.entries(e))for(let s of a.assets||[])if(ue(s)){let u=s.p;r.has(u)||r.set(u,new Set),r.get(u)?.add(n);}let i=await Ar(t,n=>r.has(n.name));for(let[n,a]of r){let s=i[n];if(s)for(let u of a){let c=e[u];for(let o of c?.assets||[])ue(o)&&o.p===n&&(o.p=s,o.u="",o.e=1);}}}async function Ir(t,e){let r=await ht(t,n=>{let a=n.name.replace("images/","");return n.name.startsWith("images/")&&(!e||e({...n,name:a}))}),i={};for(let n in r){let a=r[n];if(a instanceof Uint8Array){let s=n.replace("images/","");i[s]=de(a);}}return i}async function xr(t,e){let r=new Map;for(let[n,a]of Object.entries(e))for(let s of a.assets||[])if(oe(s)){let u=s.p;r.has(u)||r.set(u,new Set),r.get(u)?.add(n);}let i=await Ir(t,n=>r.has(n.name));for(let[n,a]of r){let s=i[n];if(s)for(let u of a){let c=e[u];for(let o of c?.assets||[])oe(o)&&o.p===n&&(o.p=s,o.u="",o.e=1);}}}async function ve(t,e,{inlineAssets:r}={},i){let n=`animations/${e}.json`,a=await _r(t,n,i);if(typeof a>"u")return;let s=JSON.parse(ot(a,!1));if(!r)return s;let u={[e]:s};return await xr(t,u),await br(t,u),s}Ge(tr());async function $r(t){let e=await me(t),r=await Mt(e),i=r?.activeAnimationId||r?.animations[0]?.id||"";if(!i)throw new Error("Unable to determine the active animation ID from the .lottie manifest.");let n=await ve(e,i,{inlineAssets:!0});return JSON.stringify(n)}async function ln(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch the animation data from URL: ${t}. ${e.status}: ${e.statusText}`);let r=e.headers.get("content-type"),i;if(r?.includes("application/json"))i=await e.text();else {let n=await e.arrayBuffer();i=await $r(n);}return i}catch(e){throw new Error(`Failed to load animation data from URL: ${t}. ${e}`)}}function Hr(t){return /^#([\da-f]{6}|[\da-f]{8})$/iu.test(t)}function cn(t){if(!Hr(t))return 0;let e=t.replace("#","");return e=e.length===6?`${e}ff`:e,parseInt(e,16)}
1
+ import { loadFromArrayBuffer, getManifest, getAnimation } from '@dotlottie/dotlottie-js';
2
2
 
3
- export { $r as getAnimationJSONFromDotLottie, cn as hexStringToRGBAInt, Hr as isHexColor, ln as loadAnimationJSONFromURL };
4
- //# sourceMappingURL=out.js.map
5
- //# sourceMappingURL=utils.js.map
3
+ async function getAnimationJSONFromDotLottie(dotLottieBuffer) {
4
+ const loadedDotLottieFile = await loadFromArrayBuffer(dotLottieBuffer);
5
+ const manifest = await getManifest(loadedDotLottieFile);
6
+ const activeAnimationId = manifest?.activeAnimationId || manifest?.animations[0]?.id || "";
7
+ if (!activeAnimationId) {
8
+ throw new Error("Unable to determine the active animation ID from the .lottie manifest.");
9
+ }
10
+ const animationData = await getAnimation(loadedDotLottieFile, activeAnimationId, { inlineAssets: true });
11
+ return JSON.stringify(animationData);
12
+ }
13
+ async function loadAnimationJSONFromURL(animationURL) {
14
+ try {
15
+ const response = await fetch(animationURL);
16
+ if (!response.ok) {
17
+ throw new Error(
18
+ `Failed to fetch the animation data from URL: ${animationURL}. ${response.status}: ${response.statusText}`
19
+ );
20
+ }
21
+ const contentType = response.headers.get("content-type");
22
+ let animationJSON;
23
+ if (contentType?.includes("application/json")) {
24
+ animationJSON = await response.text();
25
+ } else {
26
+ const arrayBuffer = await response.arrayBuffer();
27
+ animationJSON = await getAnimationJSONFromDotLottie(arrayBuffer);
28
+ }
29
+ return animationJSON;
30
+ } catch (error) {
31
+ throw new Error(`Failed to load animation data from URL: ${animationURL}. ${error}`);
32
+ }
33
+ }
34
+ function isHexColor(color) {
35
+ return /^#([\da-f]{6}|[\da-f]{8})$/iu.test(color);
36
+ }
37
+ function hexStringToRGBAInt(colorHex) {
38
+ if (!isHexColor(colorHex)) {
39
+ return 0;
40
+ }
41
+ let hex = colorHex.replace("#", "");
42
+ hex = hex.length === 6 ? `${hex}ff` : hex;
43
+ return parseInt(hex, 16);
44
+ }
45
+
46
+ export { getAnimationJSONFromDotLottie, hexStringToRGBAInt, isHexColor, loadAnimationJSONFromURL };
@@ -0,0 +1,23 @@
1
+ export { default as createRendererModule } from './renderer.js';
2
+
3
+ /**
4
+ * Copyright 2023 Design Barn Inc.
5
+ */
6
+
7
+ interface Renderer {
8
+ duration(): number;
9
+ error(): string;
10
+ frame(no: number): boolean;
11
+ load(data: string, width: number, height: number): boolean;
12
+ render(): Uint8Array;
13
+ resize(width: number, height: number): void;
14
+ setBgColor(color: number): void;
15
+ size(): Float32Array;
16
+ totalFrames(): number;
17
+ update(): boolean;
18
+ }
19
+ interface Module {
20
+ Renderer: new () => Renderer;
21
+ }
22
+
23
+ export type { Module, Renderer };
@@ -0,0 +1 @@
1
+ export { default as createRendererModule } from './renderer';
@@ -0,0 +1,3 @@
1
+ declare function createRendererModule(moduleArg?: {}): any;
2
+
3
+ export { createRendererModule as default };