@drincs/pixi-vn 1.2.21 → 1.2.23

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.
@@ -18,7 +18,7 @@ Deprecated since v${i}`),console.warn(r))),xu[t]=true;}var xu,Z,_u,_t=g(()=>{xu=
18
18
  -ms-user-select: none;
19
19
  `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${yo}px`,e.style.height=`${yo}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=wc.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=true,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex);}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Xe(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n));}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"]);}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"]);}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"]);}_onKeyDown(t){t.keyCode!==l_||!this._activateOnTab||this._activate();}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate();}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown);}setAccessibilityEnabled(t){t?this._activate():this._deactivate();}};Ma.extension={type:[C.WebGLSystem,C.WebGPUSystem],name:"accessibility"};Ma.defaultOptions={enabledByDefault:false,debug:false,activateOnTab:true,deactivateOnMouseMove:true};Mc=Ma;});var Ac,Ic=g(()=>{Ac={accessible:false,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:true,_accessibleActive:false,_accessibleDiv:null,_renderId:-1};});var Lc=g(()=>{N();zi();Ec();Ic();W.add(Mc);W.mixin(de,Ac);});var Wi,Rc=g(()=>{N();Wi=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize());},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()));},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null);},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else {let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o;}this.renderer.resize(e,r),this.render();},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null;}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null;}};Wi.extension=C.Application;});var je,bo=g(()=>{je=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(je||{});});var Vr,Fc=g(()=>{Vr=class{constructor(t,e=null,r=0,s=false){this.next=null,this.previous=null,this._destroyed=false,this._fn=t,this._context=e,this.priority=r,this._once=s;}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(true),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this;}destroy(t=false){this._destroyed=true,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};});var Bc,Pt,Hi=g(()=>{bo();Fc();Bc=class Qt{constructor(){this.autoStart=false,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=false,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=false,this._lastFrame=-1,this._head=new Vr(null,null,1/0),this.deltaMS=1/Qt.targetFPMS,this.elapsedMS=1/Qt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)));};}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick));}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null);}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start();}add(t,e,r=je.NORMAL){return this._addListener(new Vr(t,e,r))}addOnce(t,e,r=je.NORMAL){return this._addListener(new Vr(t,e,r,true))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else {for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next;}t.previous||t.connect(r);}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=true,this._requestIfNeeded());}stop(){this.started&&(this.started=false,this._cancelIfNeeded());}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(true);this._head.destroy(),this._head=null;}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS;}this.deltaMS=e,this.deltaTime=this.deltaMS*Qt.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded();}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t;}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Qt.targetFPMS);this._maxElapsedMS=1/r;}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else {let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3);}}static get shared(){if(!Qt._shared){let t=Qt._shared=new Qt;t.autoStart=true,t._protected=true;}return Qt._shared}static get system(){if(!Qt._system){let t=Qt._system=new Qt;t.autoStart=true,t._protected=true;}return Qt._system}};Bc.targetFPMS=.06;Pt=Bc;});var Yi,kc=g(()=>{N();bo();Hi();Yi=class{static init(t){t=Object.assign({autoStart:true,sharedTicker:false},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,je.LOW);},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop();},this.start=()=>{this._ticker.start();},this._ticker=null,this.ticker=t.sharedTicker?Pt.shared:new Pt,t.autoStart&&this.start();}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy();}}};Yi.extension=C.Application;});var Ea=g(()=>{N();Rc();kc();W.add(Wi);W.add(Yi);});var Aa,Ce,Ia=g(()=>{bo();Hi();Aa=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=false,this._tickerAdded=false,this._pauseUpdate=true;}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t;}addTickerListener(){this._tickerAdded||!this.domElement||(Pt.system.add(this._tickerUpdate,this,je.INTERACTION),this._tickerAdded=true);}removeTickerListener(){this._tickerAdded&&(Pt.system.remove(this._tickerUpdate,this),this._tickerAdded=false);}pointerMoved(){this._didMove=true;}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=false;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}));}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update());}},Ce=new Aa;});var Ne,vo=g(()=>{we();xo();Ne=class extends Xe{constructor(){super(...arguments),this.client=new rt,this.movement=new rt,this.offset=new rt,this.global=new rt,this.screen=new rt;}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return "getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,l,h,u,c,f,d,x,b){throw new Error("Method not implemented.")}};});var zt,La=g(()=>{vo();zt=class extends Ne{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=false;}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}};});var Pe,Ra=g(()=>{vo();Pe=class extends Ne{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2;}};Pe.DOM_DELTA_PIXEL=0;Pe.DOM_DELTA_LINE=1;Pe.DOM_DELTA_PAGE=2;});var p_,m_,$i,So,Gc=g(()=>{Yt();we();Gt();Ia();vo();La();Ra();p_=2048,m_=new rt,$i=new rt,So=class{constructor(t){this.dispatch=new et,this.moveOnAll=false,this.enableGlobalMoveEvents=true,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=false,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel);}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority);}dispatchEvent(t,e){t.propagationStopped=false,t.propagationImmediatelyStopped=false,this.propagate(t,e),this.dispatch.emit(e||t.type,t);}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else K(`[EventBoundary]: Event mapping not defined for ${t.type}`);}hitTest(t,e){Ce.pauseUpdate=true;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,m_.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n);});}propagationPath(t){let e=[t];for(let r=0;r<p_&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent;}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=false){let a=false;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ce.pauseUpdate=false),t.interactiveChildren&&t.children){let u=t.children;for(let c=u.length-1;c>=0;c--){let f=u[c],d=this.hitTestMoveRecursive(f,this._isInteractive(e)?e:f.eventMode,r,s,o,n||o(t,r));if(d){if(d.length>0&&!d[d.length-1].parent)continue;let x=t.isInteractive();(d.length>0||x)&&(x&&this._allInteractiveElements.push(t),d.push(t)),this._hitElements.length===0&&(this._hitElements=d),a=true;}}}let l=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:l&&!o(t,r)&&s(t,r)?h?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ce.pauseUpdate=false),t.interactiveChildren&&t.children){let l=t.children,h=r;for(let u=l.length-1;u>=0;u--){let c=l[u],f=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,h,s,o);if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=t.isInteractive();return (f.length>0||d)&&f.push(t),f}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return !t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,$i),!t.hitArea.contains($i.x,$i.y)))return true;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return true}return false}hitTestFn(t,e){return t.hitArea?true:t?.containsPoint?(t.worldTransform.applyInverse(e,$i),t.containsPoint($i)):false}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e);}mapPointerDown(t){if(!(t instanceof zt)){K("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown");}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e);}mapPointerMove(t){if(!(t instanceof zt)){K("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=true;let e=this.createPointerEvent(t);this._isPointerMoveEvent=false;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,o);if(this.dispatchEvent(h,"pointerout"),r&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(o)){let u=this.createPointerEvent(t,"pointerleave",o);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u);}this.freeEvent(h);}if(o!==e.target){let l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),r&&this.dispatchEvent(h,"mouseover");let u=o?.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===this.rootTarget.parent){let f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==o&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),r&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f);}this.freeEvent(h);}let n=[],a=this.enableGlobalMoveEvents??true;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e);}mapPointerOver(t){if(!(t instanceof zt)){K("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o);}mapPointerOut(t){if(!(t instanceof zt)){K("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n);}this.cursor=null;}mapPointerUp(t){if(!(t instanceof zt)){K("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup");}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside");}a=a.parent;}delete s.pressTargetsByButton[t.button],n=a;}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){let h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click");}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a);}this.freeEvent(r);}mapPointerUpOutside(t){if(!(t instanceof zt)){K("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button];}this.freeEvent(s);}mapWheel(t){if(!(t instanceof Pe)){K("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e);}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(zt);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Pe);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(zt);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;}copyPointerData(t,e){t instanceof zt&&e instanceof zt&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist);}copyMouseData(t,e){t instanceof Ne&&e instanceof Ne&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global));}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page);}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=false,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t);}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,true),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,true),r[s].fn.call(r[s].context,t);}};});var g_,x_,Ba,To,ka=g(()=>{N();Gc();Ia();La();Ra();g_=1,x_={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ba=class Fa{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new So(null),Ce.init(this),this.autoPreventDefault=true,this._eventsAdded=false,this._rootPointerEvent=new zt(null),this._rootWheelEvent=new Pe(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Fa.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,true)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this);}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Fa._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove;}resolutionChange(t){this.resolution=t;}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null;}setCursor(t){t||(t="default");let e=true;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=false),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case "string":e&&(this.domElement.style.cursor=r);break;case "function":r(t);break;case "object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t);}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n);}this.setCursor(this.rootBoundary.cursor);}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ce.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a);}this.setCursor(this.rootBoundary.cursor);}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o);}this.setCursor(this.rootBoundary.cursor);}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e);}setTargetElement(t){this._removeEvents(),this.domElement=t,Ce.domElement=t,this._addEvents();}_addEvents(){if(this._eventsAdded||!this.domElement)return;Ce.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,true),this.domElement.addEventListener("pointerdown",this._onPointerDown,true),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.addEventListener("pointerover",this._onPointerOverOut,true),globalThis.addEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,true),this.domElement.addEventListener("mousedown",this._onPointerDown,true),this.domElement.addEventListener("mouseout",this._onPointerOverOut,true),this.domElement.addEventListener("mouseover",this._onPointerOverOut,true),globalThis.addEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,true),this.domElement.addEventListener("touchend",this._onPointerUp,true),this.domElement.addEventListener("touchmove",this._onPointerMove,true))),this.domElement.addEventListener("wheel",this.onWheel,{passive:true,capture:true}),this._eventsAdded=true;}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Ce.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,true),this.domElement.removeEventListener("pointerdown",this._onPointerDown,true),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,true),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,true),globalThis.removeEventListener("pointerup",this._onPointerUp,true)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,true),this.domElement.removeEventListener("mousedown",this._onPointerDown,true),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,true),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,true),globalThis.removeEventListener("mouseup",this._onPointerUp,true),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,true),this.domElement.removeEventListener("touchend",this._onPointerUp,true),this.domElement.removeEventListener("touchmove",this._onPointerMove,true))),this.domElement.removeEventListener("wheel",this.onWheel,true),this.domElement=null,this._eventsAdded=false;}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o;}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=true,o.type=t.type,e.push(o);}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=true),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=g_),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=true,e.push(r);}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=x_[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey;}};Ba.extension={name:"events",type:[C.WebGLSystem,C.CanvasSystem,C.WebGPUSystem],priority:-1};Ba.defaultEventFeatures={move:true,globalMove:true,click:true,wheel:true};To=Ba;});var Oc,Dc=g(()=>{ka();xo();Oc={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive";},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??To.defaultEventMode},set eventMode(i){this._internalEventMode=i;},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:true,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===true:false,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(i,a,n);}),o?l.once(i,a,n):l.on(i,a,n);},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s);},dispatchEvent(i){if(!(i instanceof Xe))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=false,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};});var Uc=g(()=>{N();zi();ka();Dc();W.add(To);W.mixin(de,Oc);});var Xi,Nc=g(()=>{N();Xi=class{constructor(t){this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000";}addRenderable(t,e){this._attachedDomElements.includes(t)||this._attachedDomElements.push(t);}updateRenderable(t){}validateRenderable(t){return true}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement);let r=parseFloat(e.style.width)/e.width*this._renderer.resolution,s=parseFloat(e.style.height)/e.height*this._renderer.resolution;this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px) scale(${r}, ${s})`;for(let o=0;o<t.length;o++){let n=t[o],a=n.element;if(!n.parent||n.globalDisplayStatus<7)a?.remove(),t.splice(o,1),o--;else {this._domElement.contains(a)||(a.style.position="absolute",a.style.pointerEvents="auto",this._domElement.appendChild(a));let l=n.worldTransform,h=n._anchor,u=n.width*h.x,c=n.height*h.y;a.style.transformOrigin=`${u}px ${c}px`,a.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, ${l.tx-u}, ${l.ty-c})`,a.style.opacity=n.groupAlpha.toString();}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)this._attachedDomElements[t].element?.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null;}};Xi.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"dom"};});var Wr,Ga=g(()=>{ce();zi();Wr=class extends de{constructor(t){super(t),this.canBundle=true,this.allowChildren=false,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this._bounds=new mt(0,1,0,0),this._boundsDirty=true;}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=false,this._bounds):this._bounds}get roundPixels(){return !!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0;}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=true,this.didViewUpdate)return;this.didViewUpdate=true;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this);}destroy(t){super.destroy(t),this._bounds=null;for(let e in this._gpuData)this._gpuData[e].destroy?.();this._gpuData=null;}collectRenderablesSimple(t,e,r){let{renderPipes:s}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=false;let n=this.children,a=n.length;for(let l=0;l<a;l++)n[l].collectRenderables(t,e,r);}};});var zc=g(()=>{N();Nc();W.add(Xi);});var Hr,Oa=g(()=>{Hr=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Hr||{});});var Vc,Wc=g(()=>{Vc={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};});var Hc,gt,fe=g(()=>{Wc();Hc=Vc,gt={get(){return Hc},set(i){Hc=i;}};});function pe(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ji(i){return i.split("?")[0].split("#")[0]}function __(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y_(i,t,e){return i.replace(new RegExp(__(t),"g"),e)}function b_(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else {if(n===47)break;n=47;}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0;}else n===46&&o!==-1?++o:o=-1;}return e}var jt,wo=g(()=>{fe();jt={toPosix(i){return y_(i,"\\","/")},isUrl(i){return /^https?:/.test(this.toPosix(i))},isDataUrl(i){return /^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return /^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){pe(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(pe(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=ji(this.toPosix(t??gt.get().getBaseUrl())),s=ji(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?jt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(pe(i),i.length===0)return ".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=b_(i),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return pe(i),i=this.toPosix(i),this.hasProtocol(i)?true:i.startsWith("/")},join(...i){if(i.length===0)return ".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(pe(r),r.length>0)if(t===void 0)t=r;else {let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`;}}return t===void 0?".":this.normalize(t)},dirname(i){if(pe(i),i.length===0)return ".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=true,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=false;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){pe(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/");}return t},basename(i,t){pe(i),t&&pe(t),i=ji(this.toPosix(i));let e=0,r=-1,s=true,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return "";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let l=i.charCodeAt(o);if(l===47){if(!s){e=o+1;break}}else a===-1&&(s=false,a=o+1),n>=0&&(l===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a));}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=false,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){pe(i),i=ji(this.toPosix(i));let t=-1,e=0,r=-1,s=true,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=false,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1);}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){pe(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ji(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s;t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,l=-1,h=true,u=i.length-1,c=0;for(;u>=s;--u){if(e=i.charCodeAt(u),e===47){if(!h){a=u+1;break}continue}l===-1&&(h=false,l=u+1),e===46?n===-1?n=u:c!==1&&(c=1):n!==-1&&(c=-1);}return n===-1||l===-1||c===0||c===1&&n===l-1&&n===a+1?l!==-1&&(a===0&&r?t.base=t.name=i.slice(1,l):t.base=t.name=i.slice(a,l)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,l)):(t.name=i.slice(a,n),t.base=i.slice(a,l)),t.ext=i.slice(n,l)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};});var Ke,Da=g(()=>{Ke=(i,t,e=false)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i);});function Yc(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Yc(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a));}}function $c(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n);}),Yc(i,s,0,e,r);}else r.push(i);return r}var Xc=g(()=>{});var Ua,jc=g(()=>{Ua=i=>!Array.isArray(i);});function v_(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Ki,Kc=g(()=>{Gt();wo();Da();Xc();jc();Ki=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={};}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params));}),this._resolverHash={};}set basePath(t){this._basePath=t;}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t;}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null;}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else {let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&");}}getAlias(t){let{alias:e,src:r}=t;return Ke(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,true)}addManifest(t){this._manifest&&K("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets);});}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,l;if(typeof a=="string"){let h=this._createBundleAssetId(t,a);r.push(h),l=[a,h];}else {let h=a.map(u=>this._createBundleAssetId(t,u));r.push(...h),l=[...a,...h];}this.add({...o,alias:l,src:n});}),this._bundles[t]=r;}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&K(`[Resolver] already has key: ${o} overwriting`);},Ke(e).forEach(o=>{let{src:n}=o,{data:a,format:l,loadParser:h}=o,u=Ke(n).map(d=>typeof d=="string"?$c(d):Array.isArray(d)?d:[d]),c=this.getAlias(o);Array.isArray(c)?c.forEach(r):r(c);let f=[];u.forEach(d=>{d.forEach(x=>{let b={};if(typeof x!="object"){b.src=x;for(let m=0;m<this._parsers.length;m++){let p=this._parsers[m];if(p.test(x)){b=p.parse(x);break}}}else a=x.data??a,l=x.format??l,h=x.loadParser??h,b={...b,...x};if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this._buildResolvedAsset(b,{aliases:c,data:a,format:l,loadParser:h}),f.push(b);});}),c.forEach(d=>{this._assetMap[d]=f;});});}resolveBundle(t){let e=Ua(t);t=Ke(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let l in n){let h=n[l];a[this._extractAssetIdFromBundle(s,l)]=h;}r[s]=a;}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Ua(t);t=Ke(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(l=>{let h=o.filter(u=>u[a]?u[a]===l:false);h.length&&(o=h);});}),this._resolverHash[s]=o[0];}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s];}),e?r[t[0]]:r}hasKey(t){return !!this._assetMap[t]}hasBundle(t){return !!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return `${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return (this._basePath||this._rootPath)&&(t.src=jt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??v_(t.src),t}};Ki.RETINA_PREFIX=/@([0-9\.]+)x/;});var Na,qc=g(()=>{Na=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i};});var Zc,za,Qc=g(()=>{Xt();De();Ft();Zc=class qi{constructor(t,e){this.linkedSheets=[];let r=t;t?.source instanceof Ct&&(r={texture:t,data:e});let{texture:s,data:o,cachePrefix:n=""}=r;this.cachePrefix=n,this._texture=s instanceof U?s:null,this.textureSource=s.source,this.textures={},this.animations={},this.data=o;let a=parseFloat(o.meta.scale);a?(this.resolution=a,s.source.resolution=this.resolution):this.resolution=s.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null;}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=qi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch();})}_processFrames(t){let e=t,r=qi.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,l=null,h=o.trimmed!==false&&o.sourceSize?o.sourceSize:o.frame,u=new st(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);o.rotated?a=new st(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new st(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==false&&o.spriteSourceSize&&(l=new st(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new U({source:this.textureSource,frame:a,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()});}e++;}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s]);}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures);}_nextBatch(){this._processFrames(this._batchIndex*qi.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*qi.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete());},0);}destroy(t=false){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[];}};Zc.BATCH_SIZE=1e3;za=Zc;});function Jc(i,t,e){let r={};if(i.forEach(s=>{r[s]=t;}),Object.keys(t.textures).forEach(s=>{r[`${t.cachePrefix}${s}`]=t.textures[s];}),!e){let s=jt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Jc([`${s}/${t.data.meta.related_multi_packs[n]}`],o,true);Object.assign(r,a);});}return r}var S_,td,ed=g(()=>{Oa();Kc();qc();N();Ft();wo();Qc();S_=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];td={extension:C.Asset,cache:{test:i=>i instanceof za,getCacheableAssets:(i,t)=>Jc(i,t,false)},resolver:{extension:{type:C.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&S_.includes(s)},parse:i=>{let t=i.split(".");return {resolution:parseFloat(Ki.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:C.LoadParser,priority:Hr.Normal,name:"spritesheetLoader"},async testParse(i,t){return jt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o,cachePrefix:n}=t?.data??{},a=jt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(r instanceof U)l=r;else {let c=Na(a+(s??i.meta.image),t.src);l=(await e.load([{src:c,data:o}]))[c];}let h=new za({texture:l.source,data:i,cachePrefix:n});await h.parse();let u=i?.meta?.related_multi_packs;if(Array.isArray(u)){let c=[];for(let d of u){if(typeof d!="string")continue;let x=a+d;t.data?.ignoreMultiPack||(x=Na(x,t.src),c.push(e.load({src:x,data:{textureOptions:o,ignoreMultiPack:true}})));}let f=await Promise.all(c);h.linkedSheets=f,f.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(x=>x!==d));});}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(false);}}};});var Co=g(()=>{N();ed();W.add(td);});function Po(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a;}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s;}var Va=g(()=>{});var Zi,rd=g(()=>{ia();Ft();Va();_t();Ga();Zi=class i extends Wr{constructor(t=U.EMPTY){t instanceof U&&(t={texture:t});let{texture:e=U.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=true,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new At({_onUpdate:()=>{this.onViewUpdate();}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=false,this.roundPixels=s??false,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n);}static from(t,e=false){return t instanceof U?new i(t):new i(U.from(t,e))}set texture(t){t||(t=U.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate());}get texture(){return this._texture}get visualBounds(){return Po(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return D("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o;}destroy(t=false){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r);}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null,this._gpuData=null;}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t);}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t;}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t;}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height);}};});function Mo(i,t,e){let r=T_;i.measurable=true,oo(i,e,r),t.addBoundsMask(r),i.measurable=false;}var T_,Wa=g(()=>{ce();ao();T_=new mt;});function Eo(i,t,e){let r=Zt.get();i.measurable=true;let s=bt.get().identity(),o=id(i,e,s);ho(i,r,o),i.measurable=false,t.addBoundsMask(r),bt.return(s),Zt.return(r);}function id(i,t,e){return i?(i!==t&&(id(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(K("Mask bounds, renderable is not inside the root container"),e)}var Ha=g(()=>{da();mr();Gt();});var Qi,sd=g(()=>{N();rd();Wa();Ha();Qi=class{constructor(t){this.priority=0,this.inverse=false,this.pipe="alphaMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Zi),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask=null;}addBounds(t,e){this.inverse||Mo(this.mask,t,e);}addLocalBounds(t,e){Eo(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof Zi}};Qi.extension=C.MaskEffect;});var Ji,od=g(()=>{N();Ji=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t;}destroy(){}static test(t){return typeof t=="number"}};Ji.extension=C.MaskEffect;});var ts,nd=g(()=>{N();zi();Wa();Ha();ts=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask);}init(t){this.mask=t,this.mask.includeInBuild=false,this.mask.measurable=false;}reset(){this.mask.measurable=true,this.mask.includeInBuild=true,this.mask=null;}addBounds(t,e){Mo(this.mask,t,e);}addLocalBounds(t,e){Eo(this.mask,t,e);}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset();}static test(t){return t instanceof de}};ts.extension=C.MaskEffect;});var Yr,ad=g(()=>{fe();N();De();Yr=class extends Ct{constructor(t){t.resource||(t.resource=gt.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent;}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight);}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};Yr.extension=C.TextureSource;});var Me,Ao=g(()=>{N();De();Me=class extends Ct{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=true;}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Me.extension=C.TextureSource;});async function ld(){return Ya??(Ya=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return "premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=false,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load();});if(!e)return "premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,false),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ya}var Ya,hd=g(()=>{});var Io,cd,dd=g(()=>{N();Hi();hd();De();Io=class ud extends Ct{constructor(t){super(t),this.isReady=false,this.uploadMethodId="video",t={...ud.defaultOptions,...t},this._autoUpdate=true,this._isConnectedToTicker=false,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==false,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==false&&this.load();}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Pt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t);}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update();}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback);}get isValid(){return !!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return (t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=true),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,true)),this.alphaMode=await ld(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`));})),t.load());}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,true),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null);}_isSourcePlaying(){let t=this.resource;return !t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate();}_onPlayStop(){this._configureAutoUpdate();}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0);}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady();}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady();}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=true,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play();}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,true),t.pause(),t.src="",t.load()),super.destroy();}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate());}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate());}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Pt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Pt.shared.add(this.updateFrame,this),this._isConnectedToTicker=true,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Pt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=false,this._msToNextUpdate=0));}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Io.extension=C.TextureSource;Io.defaultOptions={...Ct.defaultOptions,autoLoad:true,autoPlay:true,updateFPS:0,crossorigin:true,loop:false,muted:true,playsinline:true,preload:false};Io.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};cd=Io;});var $a,vt,es=g(()=>{Gt();Da();$a=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map;}reset(){this._cacheMap.clear(),this._cache.clear();}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||K(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ke(t),s;for(let l=0;l<this.parsers.length;l++){let h=this.parsers[l];if(h.test(e)){s=h.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(l=>{o.set(l,e);});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(l=>{this._cacheMap.set(l,a);}),n.forEach(l=>{let h=s?s[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&K("[Cache] already has key:",l),this._cache.set(l,o.get(l));});}remove(t){if(!this._cacheMap.has(t)){K(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s);}),e.keys.forEach(s=>{this._cacheMap.delete(s);});}get parsers(){return this._parsers}},vt=new $a;});function fd(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Xa.length;s++){let o=Xa[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function pd(i={},t=false){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&vt.has(r))return vt.get(r);let o=new U({source:fd(s)});return o.on("destroy",()=>{vt.has(r)&&vt.remove(r);}),t||vt.set(r,o),o}function md(i,t=false){return typeof i=="string"?vt.get(i):i instanceof Ct?new U({source:i}):pd(i,t)}var Xa,ja=g(()=>{es();N();De();Ft();Xa=[];W.handleByList(C.TextureSource,Xa);U.from=md;Ct.from=fd;});var Lo=g(()=>{N();sd();od();nd();ya();ad();Ao();dd();ja();W.add(Qi,Ji,ts,cd,Me,Yr,br);});var le,rs=g(()=>{le=class{constructor(t){this.resources=Object.create(null),this._dirty=true;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++);}this._updateKey();}_updateKey(){if(!this._dirty)return;this._dirty=false;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|");}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=true);}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t;}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null;}onResourceChange(t){if(this._dirty=true,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null);}else this._updateKey();}};});function xd(i,t,e){let r=2166136261;for(let s=0;s<t;s++)r^=i[s].uid,r=Math.imul(r,16777619),r>>>=0;return gd[r]||w_(i,t,r,e)}function w_(i,t,e,r){let s={},o=0;for(let a=0;a<r;a++){let l=a<t?i[a]:U.EMPTY.source;s[o++]=l.source,s[o++]=l.style;}let n=new le(s);return gd[e]=n,n}var gd,_d=g(()=>{rs();Ft();gd={};});var Ee,Ka=g(()=>{Ee=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength;}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null;}static sizeOf(t){switch(t){case "int8":case "uint8":return 1;case "int16":case "uint16":return 2;case "int32":case "uint32":case "float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};});function qa(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n);}}var yd=g(()=>{});var bd,vd=g(()=>{bd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};});function ze(i,t){return t.alphaMode==="no-premultiply-alpha"&&bd[i]||i}var is=g(()=>{vd();});function Fo(){return (!Ro||Ro?.isContextLost())&&(Ro=gt.get().createCanvas().getContext("webgl",{})),Ro}var Ro,Za=g(()=>{fe();});function P_(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
20
  else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Sd(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=C_.replace(/%forloop%/gi,P_(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e);}return i}var C_,Td=g(()=>{C_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `);});function wd(){if($r)return $r;let i=Fo();return $r=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),$r=Sd($r,i),i.getExtension("WEBGL_lose_context")?.loseContext(),$r}var $r,Cd=g(()=>{Za();Td();$r=null;});var Bo,Pd=g(()=>{Bo=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0;}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null;}this.count=0;}};});function Md(){return Ja>0?Ad[--Ja]:new Qa}function Ed(i){Ad[Ja++]=i;}var Qa,Ad,Ja,ss,Id,Rd,Fd=g(()=>{Nt();Ka();_t();yd();is();Cd();Pd();Qa=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Bo,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},Ad=[],Ja=0;ss=0,Id=class Ld{constructor(t){this.uid=it("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],t={...Ld.defaultOptions,...t},t.maxTextures||(D("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=wd());let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ee(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e;}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Ed(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=true;}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize;}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return !r&&r!==0?false:(t._textureId=r,t.texture=e,true)}updateElement(t){this.dirty=true;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId);}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=Md(),s=r.textures;s.clear();let o=e[this.elementStart],n=ze(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",x=this.maxTextures;for(let b=this.elementStart;b<this.elementSize;++b){let m=e[b];e[b]=null;let y=m.texture._source,v=ze(m.blendMode,y),S=n!==v||a!==m.topology;if(y._batchTick===ss&&!S){m._textureId=y._textureBindLocation,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=r;continue}y._batchTick=ss,(s.count>=x||S)&&(this._finishBatch(r,f,c-f,s,n,a,t,d),d="renderBatch",f=c,n=v,a=m.topology,r=Md(),s=r.textures,s.clear(),++ss),m._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,m._batch=r,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,c-f,s,n,a,t,d),f=c,++ss),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c;}_finishBatch(t,e,r,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ss,this.batches[this.batchIndex++]=t,a.add(t);}finish(t){this.break(t);}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4);}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t);}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ee(e);qa(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r;}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else qa(e.buffer,s.buffer);this.indexBuffer=s;}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3;}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[r++]=s+o[h+a]-l;}destroy(){for(let t=0;t<this.batches.length;t++)Ed(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null;}};Id.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Rd=Id;});var lt,Xr=g(()=>{lt=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(lt||{});});var Bt,jr=g(()=>{Yt();Nt();Xr();Bt=class extends et{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=it("buffer"),this._resourceType="buffer",this._resourceId=it("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=true,this.destroyed=false,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??true;}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,true);}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return !!(this.descriptor.usage&lt.STATIC)}set static(t){t?this.descriptor.usage|=lt.STATIC:this.descriptor.usage&=~lt.STATIC;}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=it("resource"),this.emit("change",this));return}r&&this.emit("update",this);}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners();}};});function tl(i,t){if(!(i instanceof Bt)){let e=t?lt.INDEX:lt.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=lt.INDEX|lt.COPY_DST):(i=new Float32Array(i),e=lt.VERTEX|lt.COPY_DST)),i=new Bt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var Bd=g(()=>{jr();Xr();});function kd(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,u=(r.offset||0)/h,c=(r.stride||2*4)/h;for(let f=u;f<s.length;f+=c){let d=s[f],x=s[f+1];d>a&&(a=d),x>l&&(l=x),d<o&&(o=d),x<n&&(n=x);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var Gd=g(()=>{});function M_(i){return (i instanceof Bt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=tl(i.buffer,false),i}var Ae,os=g(()=>{Yt();ce();Nt();jr();Bd();Gd();Ae=class extends et{constructor(t={}){super(),this.uid=it("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new mt,this._boundsDirty=true;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list";}onBufferUpdate(){this._boundsDirty=true,this.emit("update",this);}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=M_(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r;}addIndex(t){this.indexBuffer=tl(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,kd(this,"aPosition",this._bounds)):this._bounds}destroy(t=false){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null;}};});var E_,A_,ko,Od=g(()=>{jr();Xr();os();E_=new Float32Array(1),A_=new Uint32Array(1),ko=class extends Ae{constructor(){let e=new Bt({data:E_,label:"attribute-batch-buffer",usage:lt.VERTEX|lt.COPY_DST,shrinkToFit:false}),r=new Bt({data:A_,label:"index-batch-buffer",usage:lt.INDEX|lt.COPY_DST,shrinkToFit:false}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r});}};});function Kr(i,t){let e=Dd[i];return e===void 0&&(el[t]===void 0&&(el[t]=1),Dd[i]=e=el[t]++),e}var el,Dd,Go=g(()=>{el=Object.create(null),Dd=Object.create(null);});function Ud(){if(!Oo){Oo="mediump";let i=Fo();i&&i.getShaderPrecisionFormat&&(Oo=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return Oo}var Oo,Nd=g(()=>{Za();});function zd(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
21
+ `);});function wd(){if($r)return $r;let i=Fo();return $r=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),$r=Sd($r,i),i.getExtension("WEBGL_lose_context")?.loseContext(),$r}var $r,Cd=g(()=>{Za();Td();$r=null;});var Bo,Pd=g(()=>{Bo=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0;}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null;}this.count=0;}};});function Md(){return Ja>0?Ad[--Ja]:new Qa}function Ed(i){Ad[Ja++]=i;}var Qa,Ad,Ja,ss,Id,Rd,Fd=g(()=>{Nt();Ka();_t();yd();is();Cd();Pd();Qa=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Bo,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=true;}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null;}},Ad=[],Ja=0;ss=0,Id=class Ld{constructor(t){this.uid=it("batcher"),this.dirty=true,this.batchIndex=0,this.batches=[],this._elements=[],t={...Ld.defaultOptions,...t},t.maxTextures||(D("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=wd());let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ee(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e;}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Ed(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=true;}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize;}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return !r&&r!==0?false:(t._textureId=r,t.texture=e,true)}updateElement(t){this.dirty=true;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId);}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=Md(),s=r.textures;s.clear();let o=e[this.elementStart],n=ze(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",x=this.maxTextures;for(let b=this.elementStart;b<this.elementSize;++b){let m=e[b];e[b]=null;let y=m.texture._source,v=ze(m.blendMode,y),S=n!==v||a!==m.topology;if(y._batchTick===ss&&!S){m._textureId=y._textureBindLocation,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=r;continue}y._batchTick=ss,(s.count>=x||S)&&(this._finishBatch(r,f,c-f,s,n,a,t,d),d="renderBatch",f=c,n=v,a=m.topology,r=Md(),s=r.textures,s.clear(),++ss),m._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,m._batch=r,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize));}s.count>0&&(this._finishBatch(r,f,c-f,s,n,a,t,d),f=c,++ss),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c;}_finishBatch(t,e,r,s,o,n,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++ss,this.batches[this.batchIndex++]=t,a.add(t);}finish(t){this.break(t);}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4);}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t);}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ee(e);qa(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r;}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else qa(e.buffer,s.buffer);this.indexBuffer=s;}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3;}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let h=0;h<n;h++)e[r++]=s+o[h+a]-l;}destroy(){for(let t=0;t<this.batches.length;t++)Ed(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null;}};Id.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Rd=Id;});var lt,Xr=g(()=>{lt=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(lt||{});});var Bt,jr=g(()=>{Yt();Nt();Xr();Bt=class extends et{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=it("buffer"),this._resourceType="buffer",this._resourceId=it("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=true,this.destroyed=false,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??true;}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,true);}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return !!(this.descriptor.usage&lt.STATIC)}set static(t){t?this.descriptor.usage|=lt.STATIC:this.descriptor.usage&=~lt.STATIC;}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=it("resource"),this.emit("change",this));return}r&&this.emit("update",this);}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this);}destroy(){this.destroyed=true,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners();}};});function tl(i,t){if(!(i instanceof Bt)){let e=t?lt.INDEX:lt.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=lt.INDEX|lt.COPY_DST):(i=new Float32Array(i),e=lt.VERTEX|lt.COPY_DST)),i=new Bt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e});}return i}var Bd=g(()=>{jr();Xr();});function kd(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,l=-1/0,h=s.BYTES_PER_ELEMENT,u=(r.offset||0)/h,c=(r.stride||8)/h;for(let f=u;f<s.length;f+=c){let d=s[f],x=s[f+1];d>a&&(a=d),x>l&&(l=x),d<o&&(o=d),x<n&&(n=x);}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=l,e}var Gd=g(()=>{});function M_(i){return (i instanceof Bt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=tl(i.buffer,false),i}var Ae,os=g(()=>{Yt();ce();Nt();jr();Bd();Gd();Ae=class extends et{constructor(t={}){super(),this.uid=it("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new mt,this._boundsDirty=true;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list";}onBufferUpdate(){this._boundsDirty=true,this.emit("update",this);}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=M_(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r;}addIndex(t){this.indexBuffer=tl(t,true),this.buffers.push(this.indexBuffer);}get bounds(){return this._boundsDirty?(this._boundsDirty=false,kd(this,"aPosition",this._bounds)):this._bounds}destroy(t=false){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null;}};});var E_,A_,ko,Od=g(()=>{jr();Xr();os();E_=new Float32Array(1),A_=new Uint32Array(1),ko=class extends Ae{constructor(){let e=new Bt({data:E_,label:"attribute-batch-buffer",usage:lt.VERTEX|lt.COPY_DST,shrinkToFit:false}),r=new Bt({data:A_,label:"index-batch-buffer",usage:lt.INDEX|lt.COPY_DST,shrinkToFit:false}),s=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:20}},indexBuffer:r});}};});function Kr(i,t){let e=Dd[i];return e===void 0&&(el[t]===void 0&&(el[t]=1),Dd[i]=e=el[t]++),e}var el,Dd,Go=g(()=>{el=Object.create(null),Dd=Object.create(null);});function Ud(){if(!Oo){Oo="mediump";let i=Fo();i&&i.getShaderPrecisionFormat&&(Oo=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump");}return Oo}var Oo,Nd=g(()=>{Za();});function zd(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
22
22
 
23
23
  #ifdef GL_ES // This checks if it is WebGL1
24
24
  #define in varying
@@ -250,7 +250,7 @@ ${s.join(`
250
250
  {
251
251
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
252
  }
253
- `}};});var ml,Lf,Rf=g(()=>{ml=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Lf=ml.reduce((i,t)=>(i[t]=true,i),{});});function Ff(i,t){switch(i){case "f32":return 0;case "vec2<f32>":return new Float32Array(2*t);case "vec3<f32>":return new Float32Array(3*t);case "vec4<f32>":return new Float32Array(4*t);case "mat2x2<f32>":return new Float32Array([1,0,0,1]);case "mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case "mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Bf=g(()=>{});var kf,Vt,Qe=g(()=>{Nt();Go();Rf();Bf();kf=class Gf{constructor(t,e){this._touched=0,this.uid=it("uniform"),this._resourceType="uniformGroup",this._resourceId=it("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...Gf.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Lf[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ml.join(", ")}`);o.value??(o.value=Ff(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Kr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};kf.defaultOptions={ubo:false,isStatic:false};Vt=kf;});function jo(i){let t=Of[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Of[i]=new Vt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var Of,gl=g(()=>{Qe();Of={};});var Ie,ns=g(()=>{Ie=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Ie||{});});var Le,as=g(()=>{Yt();Nt();Do();rs();zo();ns();Qe();Le=class i extends et{constructor(t){super(),this.uid=it("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Ie.WEBGPU),r&&(n|=Ie.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let h in a)for(let u in a[h]){let c=a[h][u];l[c]={group:h,binding:u,name:c};}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c;});let h=0;for(let u in o)l[u]||(s[99]||(s[99]=new le,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:h,name:u},a[99]=a[99]||{},a[99][h]=u,h++);for(let u in o){let c=u,f=o[u];!f.source&&!f._resourceType&&(f=new Vt(f));let d=l[c];d&&(s[d.group]||(s[d.group]=new le,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding));}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l);}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new le,this._ownedBindGroups.push(this.groups[e]));}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding);}});}return r}destroy(t=false){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy();}),this._ownedBindGroups=null,this.resources=null,this.groups=null;}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=qe.from(e)),r&&(n=qr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Ko,Df=g(()=>{Vo();cl();pl();Xo();gl();as();Ko=class extends Le{constructor(t){let e=Jr({name:"batch",bits:[Ho,$o(t),ei]}),r=Qr({name:"batch",bits:[Wo,Yo(t),ti]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:jo(t)}});}};});var xl,Uf,zf,Vf=g(()=>{N();Fd();Od();Df();xl=null,Uf=class Nf extends Rd{constructor(t){super(t),this.geometry=new ko,this.name=Nf.extension.name,this.vertexSize=6,xl??(xl=new Ko(t.maxTextures)),this.shader=xl;}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,{positions:x,uvs:b}=t,m=t.color,p=t.attributeOffset,y=p+t.attributeSize;for(let v=p;v<y;v++){let S=v*2,P=x[S],T=x[S+1];e[s++]=l*P+u*T+f,e[s++]=c*T+h*P+d,e[s++]=b[S],e[s++]=b[S+1],r[s++]=m,r[s++]=n;}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,x=t.bounds,b=x.maxX,m=x.minX,p=x.maxY,y=x.minY,v=n.uvs,S=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=l*m+u*y+f,e[s+1]=c*y+h*m+d,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=S,r[s+5]=P,e[s+6]=l*b+u*y+f,e[s+7]=c*y+h*b+d,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=S,r[s+11]=P,e[s+12]=l*b+u*p+f,e[s+13]=c*p+h*b+d,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=S,r[s+17]=P,e[s+18]=l*m+u*p+f,e[s+19]=c*p+h*m+d,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=S,r[s+23]=P;}};Uf.extension={type:[C.Batcher],name:"default"};zf=Uf;});function Wf(i,t,e,r,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,u=a.b,c=a.c,f=a.d,d=a.tx,x=a.ty;for(;l<n;){let b=i[e],m=i[e+1];r[s]=h*b+c*m+d,r[s+1]=u*b+f*m+x,s+=o,e+=t,l++;}}function Hf(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var Yf=g(()=>{});function _l(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,u=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let c=e*r;for(let f=0;f<s;f++){let d=i[c],x=i[c+1];i[c]=o*d+a*x+h,i[c+1]=n*d+l*x+u,c+=r;}}var $f=g(()=>{});var z_,Sr,yl=g(()=>{ut();ua();z_=new F,Sr=class{constructor(){this.packAsQuad=false,this.batcherName="default",this.topology="triangle-list",this.applyTransform=true,this.roundPixels=0,this._batcher=null,this._batch=null;}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?lo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||z_}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology;}reset(){this.applyTransform=true,this.renderable=null,this.topology="triangle-list";}};});var ri,Xf,jf,Kf=g(()=>{N();ri={extension:{type:C.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let S=i;if(n=a=S.radius,n<=0)return false;e=S.x,r=S.y,s=o=0;}else if(i.type==="ellipse"){let S=i;if(n=S.halfWidth,a=S.halfHeight,n<=0||a<=0)return false;e=S.x,r=S.y,s=o=0;}else {let S=i,P=S.width/2,T=S.height/2;e=S.x+P,r=S.y+T,n=a=Math.max(0,Math.min(S.radius,Math.min(P,T))),s=P-n,o=T-a;}if(s<0||o<0)return false;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return false;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,true;let u=0,c=l*4+(s?2:0)+2,f=c,d=h,x=s+n,b=o,m=e+x,p=e-x,y=r+b;if(t[u++]=m,t[u++]=y,t[--c]=y,t[--c]=p,o){let S=r-b;t[f++]=p,t[f++]=S,t[--d]=S,t[--d]=m;}for(let S=1;S<l;S++){let P=Math.PI/2*(S/l),T=s+Math.cos(P)*n,w=o+Math.sin(P)*a,G=e+T,E=e-T,L=r+w,R=r-w;t[u++]=G,t[u++]=L,t[--c]=L,t[--c]=E,t[f++]=E,t[f++]=R,t[--d]=R,t[--d]=G;}x=s,b=o+a,m=e+x,p=e-x,y=r+b;let v=r-b;return t[u++]=m,t[u++]=y,t[--d]=v,t[--d]=m,s&&(t[u++]=p,t[u++]=y,t[--d]=v,t[--d]=p),true},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let u=0;u<i.length;u+=2)n+=i[u],a+=i[u+1];n/=i.length/2,a/=i.length/2;let l=r;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let u=0;u<i.length;u+=2)t[l*e]=i[u],t[l*e+1]=i[u+1],u>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1;}},Xf={...ri,extension:{...ri.extension,name:"ellipse"}},jf={...ri,extension:{...ri.extension,name:"roundedRectangle"}};});function qf(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a;}return e<0?-1:1}var Zf=g(()=>{});function Qf(i,t,e,r,s,o,n,a){let l=i-e*s,h=t-r*s,u=i+e*o,c=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let x=l+f,b=h+d,m=u+f,p=c+d;return a.push(x,b),a.push(m,p),2}function Tr(i,t,e,r,s,o,n,a){let l=e-i,h=r-t,u=Math.atan2(l,h),c=Math.atan2(s-i,o-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let f=u,d=c-u,x=Math.abs(d),b=Math.sqrt(l*l+h*h),m=(15*x*Math.sqrt(b)/Math.PI>>0)+1,p=d/m;if(f+=p,a){n.push(i,t),n.push(e,r);for(let y=1,v=f;y<m;y++,v+=p)n.push(i,t),n.push(i+Math.sin(v)*b,t+Math.cos(v)*b);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let y=1,v=f;y<m;y++,v+=p)n.push(i+Math.sin(v)*b,t+Math.cos(v)*b),n.push(i,t);n.push(s,o),n.push(i,t);}return m*2}function Jf(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let ht=qf(i);l=(l-.5)*ht+.5;}let h=new rt(i[0],i[1]),u=new rt(i[i.length-2],i[i.length-1]),c=r,f=Math.abs(h.x-u.x)<n&&Math.abs(h.y-u.y)<n;if(c){i=i.slice(),f&&(i.pop(),i.pop(),u.set(i[i.length-2],i[i.length-1]));let ht=(h.x+u.x)*.5,$e=(u.y+h.y)*.5;i.unshift(ht,$e),i.push(ht,$e);}let d=s,x=i.length/2,b=i.length,m=d.length/2,p=a.width/2,y=p*p,v=a.miterLimit*a.miterLimit,S=i[0],P=i[1],T=i[2],w=i[3],G=0,E=0,L=-(P-w),R=S-T,j=0,ot=0,Rt=Math.sqrt(L*L+R*R);L/=Rt,R/=Rt,L*=p,R*=p;let Ai=l,$=(1-Ai)*2,q=Ai*2;c||(a.cap==="round"?b+=Tr(S-L*($-q)*.5,P-R*($-q)*.5,S-L*$,P-R*$,S+L*q,P+R*q,d,true)+2:a.cap==="square"&&(b+=Qf(S,P,L,R,$,q,true,d))),d.push(S-L*$,P-R*$),d.push(S+L*q,P+R*q);for(let ht=1;ht<x-1;++ht){S=i[(ht-1)*2],P=i[(ht-1)*2+1],T=i[ht*2],w=i[ht*2+1],G=i[(ht+1)*2],E=i[(ht+1)*2+1],L=-(P-w),R=S-T,Rt=Math.sqrt(L*L+R*R),L/=Rt,R/=Rt,L*=p,R*=p,j=-(w-E),ot=T-G,Rt=Math.sqrt(j*j+ot*ot),j/=Rt,ot/=Rt,j*=p,ot*=p;let $e=T-S,Ii=P-w,Li=T-G,Ri=E-w,Vh=$e*Li+Ii*Ri,Vs=Ii*Li-Ri*$e,Fi=Vs<0;if(Math.abs(Vs)<.001*Math.abs(Vh)){d.push(T-L*$,w-R*$),d.push(T+L*q,w+R*q),Vh>=0&&(a.join==="round"?b+=Tr(T,w,T-L*$,w-R*$,T-j*$,w-ot*$,d,false)+4:b+=2,d.push(T-j*q,w-ot*q),d.push(T+j*$,w+ot*$));continue}let Wh=(-L+S)*(-R+w)-(-L+T)*(-R+P),Hh=(-j+G)*(-ot+w)-(-j+T)*(-ot+E),Ws=($e*Hh-Li*Wh)/Vs,Hs=(Ri*Wh-Ii*Hh)/Vs,Hn=(Ws-T)*(Ws-T)+(Hs-w)*(Hs-w),hr=T+(Ws-T)*$,ur=w+(Hs-w)*$,cr=T-(Ws-T)*q,dr=w-(Hs-w)*q,Rx=Math.min($e*$e+Ii*Ii,Li*Li+Ri*Ri),Yh=Fi?$:q,Fx=Rx+Yh*Yh*y;Hn<=Fx?a.join==="bevel"||Hn/y>v?(Fi?(d.push(hr,ur),d.push(T+L*q,w+R*q),d.push(hr,ur),d.push(T+j*q,w+ot*q)):(d.push(T-L*$,w-R*$),d.push(cr,dr),d.push(T-j*$,w-ot*$),d.push(cr,dr)),b+=2):a.join==="round"?Fi?(d.push(hr,ur),d.push(T+L*q,w+R*q),b+=Tr(T,w,T+L*q,w+R*q,T+j*q,w+ot*q,d,true)+4,d.push(hr,ur),d.push(T+j*q,w+ot*q)):(d.push(T-L*$,w-R*$),d.push(cr,dr),b+=Tr(T,w,T-L*$,w-R*$,T-j*$,w-ot*$,d,false)+4,d.push(T-j*$,w-ot*$),d.push(cr,dr)):(d.push(hr,ur),d.push(cr,dr)):(d.push(T-L*$,w-R*$),d.push(T+L*q,w+R*q),a.join==="round"?Fi?b+=Tr(T,w,T+L*q,w+R*q,T+j*q,w+ot*q,d,true)+2:b+=Tr(T,w,T-L*$,w-R*$,T-j*$,w-ot*$,d,false)+2:a.join==="miter"&&Hn/y<=v&&(Fi?(d.push(cr,dr),d.push(cr,dr)):(d.push(hr,ur),d.push(hr,ur)),b+=2),d.push(T-j*$,w-ot*$),d.push(T+j*q,w+ot*q),b+=2);}S=i[(x-2)*2],P=i[(x-2)*2+1],T=i[(x-1)*2],w=i[(x-1)*2+1],L=-(P-w),R=S-T,Rt=Math.sqrt(L*L+R*R),L/=Rt,R/=Rt,L*=p,R*=p,d.push(T-L*$,w-R*$),d.push(T+L*q,w+R*q),c||(a.cap==="round"?b+=Tr(T-L*($-q)*.5,w-R*($-q)*.5,T-L*$,w-R*$,T+L*q,w+R*q,d,false)+2:a.cap==="square"&&(b+=Qf(T,w,L,R,$,q,false,d)));let Lx=1e-4*1e-4;for(let ht=m;ht<b+m-2;++ht)S=d[ht*2],P=d[ht*2+1],T=d[(ht+1)*2],w=d[(ht+1)*2+1],G=d[(ht+2)*2],E=d[(ht+2)*2+1],!(Math.abs(S*(w-E)+T*(E-P)+G*(P-w))<Lx)&&o.push(ht,ht+1,ht+2);}var tp=g(()=>{we();Zf();});function ep(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],l=i[i.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=e,c=i.length/2,f=u.length/2;for(let d=0;d<c;d++)u.push(i[d*2]),u.push(i[d*2+1]);for(let d=0;d<c-1;d++)r.push(f+d,f+d+1);h&&r.push(f+c-1,f);}var rp=g(()=>{});function Qo(i,t,e=2){let r=t&&t.length,s=r?t[0]*e:i.length,o=sp(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;let a,l,h;if(r&&(o=j_(i,t,o,e)),i.length>80*e){a=1/0,l=1/0;let u=-1/0,c=-1/0;for(let f=e;f<s;f+=e){let d=i[f],x=i[f+1];d<a&&(a=d),x<l&&(l=x),d>u&&(u=d),x>c&&(c=x);}h=Math.max(u-a,c-l),h=h!==0?32767/h:0;}return hs(o,n,e,a,l,h,0),n}function sp(i,t,e,r,s){let o;if(s===oy(i,t,e,r)>0)for(let n=t;n<e;n+=r)o=ip(n/r|0,i[n],i[n+1],o);else for(let n=e-r;n>=t;n-=r)o=ip(n/r|0,i[n],i[n+1],o);return o&&ii(o,o.next)&&(cs(o),o=o.next),o}function wr(i,t){if(!i)return i;t||(t=i);let e=i,r;do if(r=false,!e.steiner&&(ii(e,e.next)||xt(e.prev,e,e.next)===0)){if(cs(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function hs(i,t,e,r,s,o,n){if(!i)return;!n&&o&&J_(i,r,s,o);let a=i;for(;i.prev!==i.next;){let l=i.prev,h=i.next;if(o?Y_(i,r,s,o):H_(i)){t.push(l.i,i.i,h.i),cs(i),i=h.next,a=h.next;continue}if(i=h,i===a){n?n===1?(i=$_(wr(i),t),hs(i,t,e,r,s,o,2)):n===2&&X_(i,t,e,r,s,o):hs(wr(i),t,e,r,s,o,1);break}}}function H_(i){let t=i.prev,e=i,r=i.next;if(xt(t,e,r)>=0)return false;let s=t.x,o=e.x,n=r.x,a=t.y,l=e.y,h=r.y,u=Math.min(s,o,n),c=Math.min(a,l,h),f=Math.max(s,o,n),d=Math.max(a,l,h),x=r.next;for(;x!==t;){if(x.x>=u&&x.x<=f&&x.y>=c&&x.y<=d&&ls(s,a,o,l,n,h,x.x,x.y)&&xt(x.prev,x,x.next)>=0)return false;x=x.next;}return true}function Y_(i,t,e,r){let s=i.prev,o=i,n=i.next;if(xt(s,o,n)>=0)return false;let a=s.x,l=o.x,h=n.x,u=s.y,c=o.y,f=n.y,d=Math.min(a,l,h),x=Math.min(u,c,f),b=Math.max(a,l,h),m=Math.max(u,c,f),p=bl(d,x,t,e,r),y=bl(b,m,t,e,r),v=i.prevZ,S=i.nextZ;for(;v&&v.z>=p&&S&&S.z<=y;){if(v.x>=d&&v.x<=b&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0||(v=v.prevZ,S.x>=d&&S.x<=b&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0))return false;S=S.nextZ;}for(;v&&v.z>=p;){if(v.x>=d&&v.x<=b&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0)return false;v=v.prevZ;}for(;S&&S.z<=y;){if(S.x>=d&&S.x<=b&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0)return false;S=S.nextZ;}return true}function $_(i,t){let e=i;do{let r=e.prev,s=e.next.next;!ii(r,s)&&np(r,e,e.next,s)&&us(r,s)&&us(s,r)&&(t.push(r.i,e.i,s.i),cs(e),cs(e.next),e=i=s),e=e.next;}while(e!==i);return wr(e)}function X_(i,t,e,r,s,o){let n=i;do{let a=n.next.next;for(;a!==n.prev;){if(n.i!==a.i&&ry(n,a)){let l=ap(n,a);n=wr(n,n.next),l=wr(l,l.next),hs(n,t,e,r,s,o,0),hs(l,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function j_(i,t,e,r){let s=[];for(let o=0,n=t.length;o<n;o++){let a=t[o]*r,l=o<n-1?t[o+1]*r:i.length,h=sp(i,a,l,r,false);h===h.next&&(h.steiner=true),s.push(ey(h));}s.sort(K_);for(let o=0;o<s.length;o++)e=q_(s[o],e);return e}function K_(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let r=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=r-s;}return e}function q_(i,t){let e=Z_(i,t);if(!e)return t;let r=ap(e,i);return wr(r,r.next),wr(e,e.next)}function Z_(i,t){let e=t,r=i.x,s=i.y,o=-1/0,n;if(ii(i,e))return e;do{if(ii(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let c=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(c<=r&&c>o&&(o=c,n=e.x<e.next.x?e:e.next,c===r))return n}e=e.next;}while(e!==t);if(!n)return null;let a=n,l=n.x,h=n.y,u=1/0;e=n;do{if(r>=e.x&&e.x>=l&&r!==e.x&&op(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)){let c=Math.abs(s-e.y)/(r-e.x);us(e,i)&&(c<u||c===u&&(e.x>n.x||e.x===n.x&&Q_(n,e)))&&(n=e,u=c);}e=e.next;}while(e!==a);return n}function Q_(i,t){return xt(i.prev,i,t.prev)<0&&xt(t.next,i,i.next)<0}function J_(i,t,e,r){let s=i;do s.z===0&&(s.z=bl(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,ty(s);}function ty(i){let t,e=1;do{let r=i,s;i=null;let o=null;for(t=0;r;){t++;let n=r,a=0;for(let h=0;h<e&&(a++,n=n.nextZ,!!n);h++);let l=e;for(;a>0||l>0&&n;)a!==0&&(l===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;r=n;}o.nextZ=null,e*=2;}while(t>1);return i}function bl(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function ey(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function op(i,t,e,r,s,o,n,a){return (s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function ls(i,t,e,r,s,o,n,a){return !(i===n&&t===a)&&op(i,t,e,r,s,o,n,a)}function ry(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!iy(i,t)&&(us(i,t)&&us(t,i)&&sy(i,t)&&(xt(i.prev,i,t.prev)||xt(i,t.prev,t))||ii(i,t)&&xt(i.prev,i,i.next)>0&&xt(t.prev,t,t.next)>0)}function xt(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function ii(i,t){return i.x===t.x&&i.y===t.y}function np(i,t,e,r){let s=Zo(xt(i,t,e)),o=Zo(xt(i,t,r)),n=Zo(xt(e,r,i)),a=Zo(xt(e,r,t));return !!(s!==o&&n!==a||s===0&&qo(i,e,t)||o===0&&qo(i,r,t)||n===0&&qo(e,i,r)||a===0&&qo(e,t,r))}function qo(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Zo(i){return i>0?1:i<0?-1:0}function iy(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&np(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function us(i,t){return xt(i.prev,i,i.next)<0?xt(i,t,i.next)>=0&&xt(i,i.prev,t)>=0:xt(i,t,i.prev)<0||xt(i,i.next,t)<0}function sy(i,t){let e=i,r=false,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function ap(i,t){let e=vl(i.i,i.x,i.y),r=vl(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function ip(i,t,e,r){let s=vl(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function cs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ);}function vl(i,t,e){return {i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:false}}function oy(i,t,e,r){let s=0;for(let o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}var lp=g(()=>{});var hp,up=g(()=>{lp();Yt();hp=Qo.default||Qo;});function Jo(i,t,e,r,s,o,n){let a=hp(i,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)o[n++]=a[h]+s,o[n++]=a[h+1]+s,o[n++]=a[h+2]+s;let l=s*r;for(let h=0;h<i.length;h+=2)e[l]=i[h],e[l+1]=i[h+1],l+=r;}var Sl=g(()=>{up();});var ny,cp,dp=g(()=>{N();Sl();ny=[],cp={extension:{type:C.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return true},triangulate(i,t,e,r,s,o){Jo(i,ny,t,e,r,s,o);}};});var fp,pp=g(()=>{N();fp={extension:{type:C.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>0&&n>0?(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n,true):false},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2;}};});var mp,gp=g(()=>{N();mp={extension:{type:C.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,true},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2;}};});function _p(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function yp(i,t){let e=gt.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function ay(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(D("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Kt.defaultLinearOptions.textureSize}),t}var xp,wl,Kt,si=g(()=>{$t();fe();ut();Ao();Ft();Nt();_t();ga();xp=[{offset:0,color:"white"},{offset:1,color:"black"}],wl=class Tl{constructor(...t){this.uid=it("fillGradient"),this.type="linear",this.colorStops=[];let e=ay(t);e={...e.type==="radial"?Tl.defaultRadialOptions:Tl.defaultLinearOptions,...uo(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color);});}addColorStop(t,e){return this.colorStops.push({offset:t,color:J.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let m=t;t=r,r=m,o*=-1;}if(n<0){let m=e;e=s,s=m,n*=-1;}}let l=this.colorStops.length?this.colorStops:xp,h=this._textureSize,{canvas:u,context:c}=yp(h,1),f=a?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);_p(f,l),c.fillStyle=f,c.fillRect(0,0,h,1),this.texture=new U({source:new Me({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),x=Math.atan2(n,o),b=new F;b.scale(d/h,1),b.rotate(x),b.translate(t,e),this.textureSpace==="local"&&b.scale(h,h),this.transform=b;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:xp,e=this._textureSize,{canvas:r,context:s}=yp(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,u=this.outerRadius,c=a-u,f=l-u,d=e/(u*2),x=(o-c)*d,b=(n-f)*d,m=s.createRadialGradient(x,b,h*d,(a-c)*d,(l-f)*d,u*d);_p(m,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=m,s.translate(x,b),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-x,-b),s.fillRect(0,0,e,e),this.texture=new U({source:new Me({resource:r,addressMode:this._wrapMode})});let p=new F;p.scale(1/d,1/d),p.translate(c,f),this.textureSpace==="local"&&p.scale(e,e),this.transform=p;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};wl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};wl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Kt=wl;});function bp(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(hy);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,u=1/n.height,c=-a*h,f=-l*u,d=s.a,x=s.b,b=s.c,m=s.d;s.a*=h,s.b*=h,s.c*=u,s.d*=u,s.tx=c*d+f*b+s.tx,s.ty=c*x+f*m+s.ty;}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return !(t.fill instanceof Kt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(ly.copyFrom(r).invert()),s}var ly,hy,vp=g(()=>{ut();Xt();si();ly=new F,hy=new st;});function Tp(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")dy(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,h=o.data.hole;n&&h&&Sp(h.shapePath,l,true,r,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),Sp(a,l,n,r,e);}}}function dy(i,t,e){let r=[],s=tn.rectangle,o=uy;o.x=i.dx,o.y=i.dy,o.width=i.dw,o.height=i.dh;let n=i.transform;if(!s.build(o,r))return;let{vertices:a,uvs:l,indices:h}=e,u=h.length,c=a.length/2;n&&_l(r,n),s.triangulate(r,a,2,c,h,u);let f=i.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let x=wt.get(Sr);x.indexOffset=u,x.indexSize=h.length-u,x.attributeOffset=c,x.attributeSize=a.length/2-c,x.baseColor=i.style,x.alpha=i.alpha,x.texture=f,x.geometryData=e,t.push(x);}function Sp(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:l,transform:h,holes:u})=>{let c=[],f=tn[l.type];if(!f.build(l,c))return;let d=a.length,x=o.length/2,b="triangle-list";if(h&&_l(c,h),e){let v=l.closePath??true,S=t;S.pixelLine?(ep(c,v,o,a),b="line-list"):Jf(c,S,false,v,o,a);}else if(u){let v=[],S=c.slice();fy(u).forEach(T=>{v.push(S.length/2),S.push(...T);}),Jo(S,v,o,2,x,a,d);}else f.triangulate(c,o,2,x,a,d);let m=n.length/2,p=t.texture;if(p!==U.WHITE){let v=bp(cy,t,l,h);Wf(o,2,x,n,m,2,o.length/2-x,v);}else Hf(n,m,2,o.length/2-x);let y=wt.get(Sr);y.indexOffset=d,y.indexSize=a.length-d,y.attributeOffset=x,y.attributeSize=o.length/2-x,y.baseColor=t.color,y.alpha=t.alpha,y.texture=p,y.geometryData=s,y.topology=b,r.push(y);});}function fy(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];tn[r.type].build(r,s)&&t.push(s);}return t}var tn,uy,cy,wp=g(()=>{N();ut();Xt();Yf();$f();Ft();pr();yl();Kf();tp();rp();dp();pp();gp();vp();Sl();tn={};W.handleByMap(C.ShapeBuilder,tn);W.add(fp,cp,mp,ri,Xf,jf);uy=new st,cy=new F;});var Cl,Pl,El,oi,en=g(()=>{N();_d();Vf();pa();_t();pr();wp();Cl=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},Pl=class{constructor(){this.instructions=new Dr;}init(t){this.batcher=new zf({maxTextures:t}),this.instructions.reset();}get geometry(){return D(_u,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},El=class Ml{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){Ml.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Ml.defaultOptions.bezierSmoothness;}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),Tp(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=false:r==="auto"?e.isBatchable=e.geometryData.vertices.length<400:e.isBatchable=true,t.dirty=false;}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=wt.get(Pl,{maxTextures:this._renderer.limits.maxBatchableTextures}),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<r.length;u++){let c=r[u];a.add(c);}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,true),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,true);let h=a.batches;for(let u=0;u<h.length;u++){let c=h[u];c.bindGroup=xd(c.textures.textures,c.textures.count,this._renderer.limits.maxBatchableTextures);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Cl;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null;}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(wt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{wt.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};El.extension={type:[C.WebGLSystem,C.WebGPUSystem,C.CanvasSystem],name:"graphicsContext"};El.defaultOptions={bezierSmoothness:.5};oi=El;});var py,Al,Il,Ll,Rl,Fl,Bl,kl,Cr,rn=g(()=>{py={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Al=0,Il=1,Ll=2,Rl=3,Fl=4,Bl=5,kl=class Cp{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<Al)}set blend(t){!!(this.data&1<<Al)!==t&&(this.data^=1<<Al);}get offsets(){return !!(this.data&1<<Il)}set offsets(t){!!(this.data&1<<Il)!==t&&(this.data^=1<<Il);}set cullMode(t){if(t==="none"){this.culling=false;return}this.culling=true,this.clockwiseFrontFace=t==="front";}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return !!(this.data&1<<Ll)}set culling(t){!!(this.data&1<<Ll)!==t&&(this.data^=1<<Ll);}get depthTest(){return !!(this.data&1<<Rl)}set depthTest(t){!!(this.data&1<<Rl)!==t&&(this.data^=1<<Rl);}get depthMask(){return !!(this.data&1<<Bl)}set depthMask(t){!!(this.data&1<<Bl)!==t&&(this.data^=1<<Bl);}get clockwiseFrontFace(){return !!(this.data&1<<Fl)}set clockwiseFrontFace(t){!!(this.data&1<<Fl)!==t&&(this.data^=1<<Fl);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=py[t]||0;}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t;}toString(){return `[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new Cp;return t.depthTest=false,t.blend=true,t}};kl.default2d=kl.for2d();Cr=kl;});function Je(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r;}var ds=g(()=>{});var Gl,fs,Pp=g(()=>{N();rn();pr();ds();yl();Gl=class{constructor(){this.batches=[],this.batched=false;}destroy(){this.batches.forEach(t=>{wt.return(t);}),this.batches.length=0;}},fs=class{constructor(t,e){this.state=Cr.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this);}contextChange(){this._adaptor.contextChange(this.renderer);}validateRenderable(t){let e=t.context,r=!!t._gpuData,s=this.renderer.graphicsContext.updateGpuContext(e);return !!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t));}updateRenderable(t){let r=this._getGpuDataForRenderable(t).batches;for(let s=0;s<r.length;s++){let o=r[s];o._batcher.updateElement(o);}}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Je(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t);}_rebuild(t){let e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e);}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(t).batches;for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e);}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new Gl;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){let r=t.context,s=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|t._roundPixels;e.batches=s.batches.map(n=>{let a=wt.get(Sr);return n.copyTo(a),a.renderable=t,a.roundPixels=o,a});}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;}};fs.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"graphics"};});var Ol=g(()=>{N();en();Pp();W.add(fs);W.add(oi);});var tr,sn=g(()=>{tr=class{constructor(){this.batcherName="default",this.packAsQuad=false,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1;}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t;}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1;}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1);}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}};});var on,ps,Mp=g(()=>{N();ut();rs();Qe();is();ds();sn();on=class{destroy(){}},ps=class{constructor(t,e){this.localUniforms=new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new le({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init();}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return true;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,true;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return false}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e);}else r.break(e),e.add(t);}updateRenderable(t){if(t.batched){let e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e);}}execute(t){if(!t.isRenderable)return;t.state.blendMode=ze(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Je(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t);}_getMeshData(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new on),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new on),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new tr;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null;}};ps.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"mesh"};});var Dl=g(()=>{N();Mp();W.add(ps);});var nn,Ep=g(()=>{nn=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let h=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,h,0);}};});function Ul(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var Ap=g(()=>{});function Lp(i){return {dynamicUpdate:Ip(i,true),staticUpdate:Ip(i,false)}}function Ip(i,t){let e=[];e.push(`
253
+ `}};});var ml,Lf,Rf=g(()=>{ml=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Lf=ml.reduce((i,t)=>(i[t]=true,i),{});});function Ff(i,t){switch(i){case "f32":return 0;case "vec2<f32>":return new Float32Array(2*t);case "vec3<f32>":return new Float32Array(3*t);case "vec4<f32>":return new Float32Array(4*t);case "mat2x2<f32>":return new Float32Array([1,0,0,1]);case "mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case "mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Bf=g(()=>{});var kf,Vt,Qe=g(()=>{Nt();Go();Rf();Bf();kf=class Gf{constructor(t,e){this._touched=0,this.uid=it("uniform"),this._resourceType="uniformGroup",this._resourceId=it("resource"),this.isUniformGroup=true,this._dirtyId=0,this.destroyed=false,e={...Gf.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Lf[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ml.join(", ")}`);o.value??(o.value=Ff(o.type,o.size)),r[s]=o.value;}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Kr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group");}update(){this._dirtyId++;}};kf.defaultOptions={ubo:false,isStatic:false};Vt=kf;});function jo(i){let t=Of[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Of[i]=new Vt({uTextures:{value:e,type:"i32",size:i}},{isStatic:true}),t}var Of,gl=g(()=>{Qe();Of={};});var Ie,ns=g(()=>{Ie=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Ie||{});});var Le,as=g(()=>{Yt();Nt();Do();rs();zo();ns();Qe();Le=class i extends et{constructor(t){super(),this.uid=it("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Ie.WEBGPU),r&&(n|=Ie.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let h in a)for(let u in a[h]){let c=a[h][u];l[c]={group:h,binding:u,name:c};}else if(e&&s&&!a){let h=e.structsAndGroups.groups;a={},h.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u;});}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c;});let h=0;for(let u in o)l[u]||(s[99]||(s[99]=new le,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:h,name:u},a[99]=a[99]||{},a[99][h]=u,h++);for(let u in o){let c=u,f=o[u];!f.source&&!f._resourceType&&(f=new Vt(f));let d=l[c];d&&(s[d.group]||(s[d.group]=new le,this._ownedBindGroups.push(s[d.group])),s[d.group].setResource(f,d.binding));}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l);}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new le,this._ownedBindGroups.push(this.groups[e]));}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding);}});}return r}destroy(t=false){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy();}),this._ownedBindGroups=null,this.resources=null,this.groups=null;}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=qe.from(e)),r&&(n=qr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}};});var Ko,Df=g(()=>{Vo();cl();pl();Xo();gl();as();Ko=class extends Le{constructor(t){let e=Jr({name:"batch",bits:[Ho,$o(t),ei]}),r=Qr({name:"batch",bits:[Wo,Yo(t),ti]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:jo(t)}});}};});var xl,Uf,zf,Vf=g(()=>{N();Fd();Od();Df();xl=null,Uf=class Nf extends Rd{constructor(t){super(t),this.geometry=new ko,this.name=Nf.extension.name,this.vertexSize=6,xl??(xl=new Ko(t.maxTextures)),this.shader=xl;}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,{positions:x,uvs:b}=t,m=t.color,p=t.attributeOffset,y=p+t.attributeSize;for(let v=p;v<y;v++){let S=v*2,P=x[S],T=x[S+1];e[s++]=l*P+u*T+f,e[s++]=c*T+h*P+d,e[s++]=b[S],e[s++]=b[S+1],r[s++]=m,r[s++]=n;}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,l=a.a,h=a.b,u=a.c,c=a.d,f=a.tx,d=a.ty,x=t.bounds,b=x.maxX,m=x.minX,p=x.maxY,y=x.minY,v=n.uvs,S=t.color,P=o<<16|t.roundPixels&65535;e[s+0]=l*m+u*y+f,e[s+1]=c*y+h*m+d,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=S,r[s+5]=P,e[s+6]=l*b+u*y+f,e[s+7]=c*y+h*b+d,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=S,r[s+11]=P,e[s+12]=l*b+u*p+f,e[s+13]=c*p+h*b+d,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=S,r[s+17]=P,e[s+18]=l*m+u*p+f,e[s+19]=c*p+h*m+d,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=S,r[s+23]=P;}};Uf.extension={type:[C.Batcher],name:"default"};zf=Uf;});function Wf(i,t,e,r,s,o,n,a=null){let l=0;e*=t,s*=o;let h=a.a,u=a.b,c=a.c,f=a.d,d=a.tx,x=a.ty;for(;l<n;){let b=i[e],m=i[e+1];r[s]=h*b+c*m+d,r[s+1]=u*b+f*m+x,s+=o,e+=t,l++;}}function Hf(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++;}var Yf=g(()=>{});function _l(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,l=t.d,h=t.tx,u=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let c=e*r;for(let f=0;f<s;f++){let d=i[c],x=i[c+1];i[c]=o*d+a*x+h,i[c+1]=n*d+l*x+u,c+=r;}}var $f=g(()=>{});var z_,Sr,yl=g(()=>{ut();ua();z_=new F,Sr=class{constructor(){this.packAsQuad=false,this.batcherName="default",this.topology="triangle-list",this.applyTransform=true,this.roundPixels=0,this._batcher=null,this._batch=null;}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?lo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||z_}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology;}reset(){this.applyTransform=true,this.renderable=null,this.topology="triangle-list";}};});var ri,Xf,jf,Kf=g(()=>{N();ri={extension:{type:C.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let S=i;if(n=a=S.radius,n<=0)return false;e=S.x,r=S.y,s=o=0;}else if(i.type==="ellipse"){let S=i;if(n=S.halfWidth,a=S.halfHeight,n<=0||a<=0)return false;e=S.x,r=S.y,s=o=0;}else {let S=i,P=S.width/2,T=S.height/2;e=S.x+P,r=S.y+T,n=a=Math.max(0,Math.min(S.radius,Math.min(P,T))),s=P-n,o=T-a;}if(s<0||o<0)return false;let l=Math.ceil(2.3*Math.sqrt(n+a)),h=l*8+(s?4:0)+(o?4:0);if(h===0)return false;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,true;let u=0,c=l*4+(s?2:0)+2,f=c,d=h,x=s+n,b=o,m=e+x,p=e-x,y=r+b;if(t[u++]=m,t[u++]=y,t[--c]=y,t[--c]=p,o){let S=r-b;t[f++]=p,t[f++]=S,t[--d]=S,t[--d]=m;}for(let S=1;S<l;S++){let P=Math.PI/2*(S/l),T=s+Math.cos(P)*n,w=o+Math.sin(P)*a,G=e+T,E=e-T,L=r+w,R=r-w;t[u++]=G,t[u++]=L,t[--c]=L,t[--c]=E,t[f++]=E,t[f++]=R,t[--d]=R,t[--d]=G;}x=s,b=o+a,m=e+x,p=e-x,y=r+b;let v=r-b;return t[u++]=m,t[u++]=y,t[--d]=v,t[--d]=m,s&&(t[u++]=p,t[u++]=y,t[--d]=v,t[--d]=p),true},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let u=0;u<i.length;u+=2)n+=i[u],a+=i[u+1];n/=i.length/2,a/=i.length/2;let l=r;t[l*e]=n,t[l*e+1]=a;let h=l++;for(let u=0;u<i.length;u+=2)t[l*e]=i[u],t[l*e+1]=i[u+1],u>0&&(s[o++]=l,s[o++]=h,s[o++]=l-1),l++;s[o++]=h+1,s[o++]=h,s[o++]=l-1;}},Xf={...ri,extension:{...ri.extension,name:"ellipse"}},jf={...ri,extension:{...ri.extension,name:"roundedRectangle"}};});function qf(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a;}return e<0?-1:1}var Zf=g(()=>{});function Qf(i,t,e,r,s,o,n,a){let l=i-e*s,h=t-r*s,u=i+e*o,c=t+r*o,f,d;n?(f=r,d=-e):(f=-r,d=e);let x=l+f,b=h+d,m=u+f,p=c+d;return a.push(x,b),a.push(m,p),2}function Tr(i,t,e,r,s,o,n,a){let l=e-i,h=r-t,u=Math.atan2(l,h),c=Math.atan2(s-i,o-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let f=u,d=c-u,x=Math.abs(d),b=Math.sqrt(l*l+h*h),m=(15*x*Math.sqrt(b)/Math.PI>>0)+1,p=d/m;if(f+=p,a){n.push(i,t),n.push(e,r);for(let y=1,v=f;y<m;y++,v+=p)n.push(i,t),n.push(i+Math.sin(v)*b,t+Math.cos(v)*b);n.push(i,t),n.push(s,o);}else {n.push(e,r),n.push(i,t);for(let y=1,v=f;y<m;y++,v+=p)n.push(i+Math.sin(v)*b,t+Math.cos(v)*b),n.push(i,t);n.push(s,o),n.push(i,t);}return m*2}function Jf(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,l=a.alignment;if(t.alignment!==.5){let ht=qf(i);l=(l-.5)*ht+.5;}let h=new rt(i[0],i[1]),u=new rt(i[i.length-2],i[i.length-1]),c=r,f=Math.abs(h.x-u.x)<n&&Math.abs(h.y-u.y)<n;if(c){i=i.slice(),f&&(i.pop(),i.pop(),u.set(i[i.length-2],i[i.length-1]));let ht=(h.x+u.x)*.5,$e=(u.y+h.y)*.5;i.unshift(ht,$e),i.push(ht,$e);}let d=s,x=i.length/2,b=i.length,m=d.length/2,p=a.width/2,y=p*p,v=a.miterLimit*a.miterLimit,S=i[0],P=i[1],T=i[2],w=i[3],G=0,E=0,L=-(P-w),R=S-T,j=0,ot=0,Rt=Math.sqrt(L*L+R*R);L/=Rt,R/=Rt,L*=p,R*=p;let Ai=l,$=(1-Ai)*2,q=Ai*2;c||(a.cap==="round"?b+=Tr(S-L*($-q)*.5,P-R*($-q)*.5,S-L*$,P-R*$,S+L*q,P+R*q,d,true)+2:a.cap==="square"&&(b+=Qf(S,P,L,R,$,q,true,d))),d.push(S-L*$,P-R*$),d.push(S+L*q,P+R*q);for(let ht=1;ht<x-1;++ht){S=i[(ht-1)*2],P=i[(ht-1)*2+1],T=i[ht*2],w=i[ht*2+1],G=i[(ht+1)*2],E=i[(ht+1)*2+1],L=-(P-w),R=S-T,Rt=Math.sqrt(L*L+R*R),L/=Rt,R/=Rt,L*=p,R*=p,j=-(w-E),ot=T-G,Rt=Math.sqrt(j*j+ot*ot),j/=Rt,ot/=Rt,j*=p,ot*=p;let $e=T-S,Ii=P-w,Li=T-G,Ri=E-w,Vh=$e*Li+Ii*Ri,Vs=Ii*Li-Ri*$e,Fi=Vs<0;if(Math.abs(Vs)<.001*Math.abs(Vh)){d.push(T-L*$,w-R*$),d.push(T+L*q,w+R*q),Vh>=0&&(a.join==="round"?b+=Tr(T,w,T-L*$,w-R*$,T-j*$,w-ot*$,d,false)+4:b+=2,d.push(T-j*q,w-ot*q),d.push(T+j*$,w+ot*$));continue}let Wh=(-L+S)*(-R+w)-(-L+T)*(-R+P),Hh=(-j+G)*(-ot+w)-(-j+T)*(-ot+E),Ws=($e*Hh-Li*Wh)/Vs,Hs=(Ri*Wh-Ii*Hh)/Vs,Hn=(Ws-T)*(Ws-T)+(Hs-w)*(Hs-w),hr=T+(Ws-T)*$,ur=w+(Hs-w)*$,cr=T-(Ws-T)*q,dr=w-(Hs-w)*q,Rx=Math.min($e*$e+Ii*Ii,Li*Li+Ri*Ri),Yh=Fi?$:q,Fx=Rx+Yh*Yh*y;Hn<=Fx?a.join==="bevel"||Hn/y>v?(Fi?(d.push(hr,ur),d.push(T+L*q,w+R*q),d.push(hr,ur),d.push(T+j*q,w+ot*q)):(d.push(T-L*$,w-R*$),d.push(cr,dr),d.push(T-j*$,w-ot*$),d.push(cr,dr)),b+=2):a.join==="round"?Fi?(d.push(hr,ur),d.push(T+L*q,w+R*q),b+=Tr(T,w,T+L*q,w+R*q,T+j*q,w+ot*q,d,true)+4,d.push(hr,ur),d.push(T+j*q,w+ot*q)):(d.push(T-L*$,w-R*$),d.push(cr,dr),b+=Tr(T,w,T-L*$,w-R*$,T-j*$,w-ot*$,d,false)+4,d.push(T-j*$,w-ot*$),d.push(cr,dr)):(d.push(hr,ur),d.push(cr,dr)):(d.push(T-L*$,w-R*$),d.push(T+L*q,w+R*q),a.join==="round"?Fi?b+=Tr(T,w,T+L*q,w+R*q,T+j*q,w+ot*q,d,true)+2:b+=Tr(T,w,T-L*$,w-R*$,T-j*$,w-ot*$,d,false)+2:a.join==="miter"&&Hn/y<=v&&(Fi?(d.push(cr,dr),d.push(cr,dr)):(d.push(hr,ur),d.push(hr,ur)),b+=2),d.push(T-j*$,w-ot*$),d.push(T+j*q,w+ot*q),b+=2);}S=i[(x-2)*2],P=i[(x-2)*2+1],T=i[(x-1)*2],w=i[(x-1)*2+1],L=-(P-w),R=S-T,Rt=Math.sqrt(L*L+R*R),L/=Rt,R/=Rt,L*=p,R*=p,d.push(T-L*$,w-R*$),d.push(T+L*q,w+R*q),c||(a.cap==="round"?b+=Tr(T-L*($-q)*.5,w-R*($-q)*.5,T-L*$,w-R*$,T+L*q,w+R*q,d,false)+2:a.cap==="square"&&(b+=Qf(T,w,L,R,$,q,false,d)));let Lx=1e-4*1e-4;for(let ht=m;ht<b+m-2;++ht)S=d[ht*2],P=d[ht*2+1],T=d[(ht+1)*2],w=d[(ht+1)*2+1],G=d[(ht+2)*2],E=d[(ht+2)*2+1],!(Math.abs(S*(w-E)+T*(E-P)+G*(P-w))<Lx)&&o.push(ht,ht+1,ht+2);}var tp=g(()=>{we();Zf();});function ep(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],l=i[i.length-1],h=t||Math.abs(o-a)<s&&Math.abs(n-l)<s,u=e,c=i.length/2,f=u.length/2;for(let d=0;d<c;d++)u.push(i[d*2]),u.push(i[d*2+1]);for(let d=0;d<c-1;d++)r.push(f+d,f+d+1);h&&r.push(f+c-1,f);}var rp=g(()=>{});function Qo(i,t,e=2){let r=t&&t.length,s=r?t[0]*e:i.length,o=sp(i,0,s,e,true),n=[];if(!o||o.next===o.prev)return n;let a,l,h;if(r&&(o=j_(i,t,o,e)),i.length>80*e){a=i[0],l=i[1];let u=a,c=l;for(let f=e;f<s;f+=e){let d=i[f],x=i[f+1];d<a&&(a=d),x<l&&(l=x),d>u&&(u=d),x>c&&(c=x);}h=Math.max(u-a,c-l),h=h!==0?32767/h:0;}return hs(o,n,e,a,l,h,0),n}function sp(i,t,e,r,s){let o;if(s===oy(i,t,e,r)>0)for(let n=t;n<e;n+=r)o=ip(n/r|0,i[n],i[n+1],o);else for(let n=e-r;n>=t;n-=r)o=ip(n/r|0,i[n],i[n+1],o);return o&&ii(o,o.next)&&(cs(o),o=o.next),o}function wr(i,t){if(!i)return i;t||(t=i);let e=i,r;do if(r=false,!e.steiner&&(ii(e,e.next)||xt(e.prev,e,e.next)===0)){if(cs(e),e=t=e.prev,e===e.next)break;r=true;}else e=e.next;while(r||e!==t);return t}function hs(i,t,e,r,s,o,n){if(!i)return;!n&&o&&J_(i,r,s,o);let a=i;for(;i.prev!==i.next;){let l=i.prev,h=i.next;if(o?Y_(i,r,s,o):H_(i)){t.push(l.i,i.i,h.i),cs(i),i=h.next,a=h.next;continue}if(i=h,i===a){n?n===1?(i=$_(wr(i),t),hs(i,t,e,r,s,o,2)):n===2&&X_(i,t,e,r,s,o):hs(wr(i),t,e,r,s,o,1);break}}}function H_(i){let t=i.prev,e=i,r=i.next;if(xt(t,e,r)>=0)return false;let s=t.x,o=e.x,n=r.x,a=t.y,l=e.y,h=r.y,u=Math.min(s,o,n),c=Math.min(a,l,h),f=Math.max(s,o,n),d=Math.max(a,l,h),x=r.next;for(;x!==t;){if(x.x>=u&&x.x<=f&&x.y>=c&&x.y<=d&&ls(s,a,o,l,n,h,x.x,x.y)&&xt(x.prev,x,x.next)>=0)return false;x=x.next;}return true}function Y_(i,t,e,r){let s=i.prev,o=i,n=i.next;if(xt(s,o,n)>=0)return false;let a=s.x,l=o.x,h=n.x,u=s.y,c=o.y,f=n.y,d=Math.min(a,l,h),x=Math.min(u,c,f),b=Math.max(a,l,h),m=Math.max(u,c,f),p=bl(d,x,t,e,r),y=bl(b,m,t,e,r),v=i.prevZ,S=i.nextZ;for(;v&&v.z>=p&&S&&S.z<=y;){if(v.x>=d&&v.x<=b&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0||(v=v.prevZ,S.x>=d&&S.x<=b&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0))return false;S=S.nextZ;}for(;v&&v.z>=p;){if(v.x>=d&&v.x<=b&&v.y>=x&&v.y<=m&&v!==s&&v!==n&&ls(a,u,l,c,h,f,v.x,v.y)&&xt(v.prev,v,v.next)>=0)return false;v=v.prevZ;}for(;S&&S.z<=y;){if(S.x>=d&&S.x<=b&&S.y>=x&&S.y<=m&&S!==s&&S!==n&&ls(a,u,l,c,h,f,S.x,S.y)&&xt(S.prev,S,S.next)>=0)return false;S=S.nextZ;}return true}function $_(i,t){let e=i;do{let r=e.prev,s=e.next.next;!ii(r,s)&&np(r,e,e.next,s)&&us(r,s)&&us(s,r)&&(t.push(r.i,e.i,s.i),cs(e),cs(e.next),e=i=s),e=e.next;}while(e!==i);return wr(e)}function X_(i,t,e,r,s,o){let n=i;do{let a=n.next.next;for(;a!==n.prev;){if(n.i!==a.i&&ry(n,a)){let l=ap(n,a);n=wr(n,n.next),l=wr(l,l.next),hs(n,t,e,r,s,o,0),hs(l,t,e,r,s,o,0);return}a=a.next;}n=n.next;}while(n!==i)}function j_(i,t,e,r){let s=[];for(let o=0,n=t.length;o<n;o++){let a=t[o]*r,l=o<n-1?t[o+1]*r:i.length,h=sp(i,a,l,r,false);h===h.next&&(h.steiner=true),s.push(ey(h));}s.sort(K_);for(let o=0;o<s.length;o++)e=q_(s[o],e);return e}function K_(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){let r=(i.next.y-i.y)/(i.next.x-i.x),s=(t.next.y-t.y)/(t.next.x-t.x);e=r-s;}return e}function q_(i,t){let e=Z_(i,t);if(!e)return t;let r=ap(e,i);return wr(r,r.next),wr(e,e.next)}function Z_(i,t){let e=t,r=i.x,s=i.y,o=-1/0,n;if(ii(i,e))return e;do{if(ii(i,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){let c=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(c<=r&&c>o&&(o=c,n=e.x<e.next.x?e:e.next,c===r))return n}e=e.next;}while(e!==t);if(!n)return null;let a=n,l=n.x,h=n.y,u=1/0;e=n;do{if(r>=e.x&&e.x>=l&&r!==e.x&&op(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)){let c=Math.abs(s-e.y)/(r-e.x);us(e,i)&&(c<u||c===u&&(e.x>n.x||e.x===n.x&&Q_(n,e)))&&(n=e,u=c);}e=e.next;}while(e!==a);return n}function Q_(i,t){return xt(i.prev,i,t.prev)<0&&xt(t.next,i,i.next)<0}function J_(i,t,e,r){let s=i;do s.z===0&&(s.z=bl(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,ty(s);}function ty(i){let t,e=1;do{let r=i,s;i=null;let o=null;for(t=0;r;){t++;let n=r,a=0;for(let h=0;h<e&&(a++,n=n.nextZ,!!n);h++);let l=e;for(;a>0||l>0&&n;)a!==0&&(l===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,l--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;r=n;}o.nextZ=null,e*=2;}while(t>1);return i}function bl(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function ey(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function op(i,t,e,r,s,o,n,a){return (s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function ls(i,t,e,r,s,o,n,a){return !(i===n&&t===a)&&op(i,t,e,r,s,o,n,a)}function ry(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!iy(i,t)&&(us(i,t)&&us(t,i)&&sy(i,t)&&(xt(i.prev,i,t.prev)||xt(i,t.prev,t))||ii(i,t)&&xt(i.prev,i,i.next)>0&&xt(t.prev,t,t.next)>0)}function xt(i,t,e){return (t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function ii(i,t){return i.x===t.x&&i.y===t.y}function np(i,t,e,r){let s=Zo(xt(i,t,e)),o=Zo(xt(i,t,r)),n=Zo(xt(e,r,i)),a=Zo(xt(e,r,t));return !!(s!==o&&n!==a||s===0&&qo(i,e,t)||o===0&&qo(i,r,t)||n===0&&qo(e,i,r)||a===0&&qo(e,t,r))}function qo(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Zo(i){return i>0?1:i<0?-1:0}function iy(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&np(e,e.next,i,t))return true;e=e.next;}while(e!==i);return false}function us(i,t){return xt(i.prev,i,i.next)<0?xt(i,t,i.next)>=0&&xt(i,i.prev,t)>=0:xt(i,t,i.prev)<0||xt(i,i.next,t)<0}function sy(i,t){let e=i,r=false,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function ap(i,t){let e=vl(i.i,i.x,i.y),r=vl(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function ip(i,t,e,r){let s=vl(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function cs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ);}function vl(i,t,e){return {i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:false}}function oy(i,t,e,r){let s=0;for(let o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}var lp=g(()=>{});var hp,up=g(()=>{lp();Yt();hp=Qo.default||Qo;});function Jo(i,t,e,r,s,o,n){let a=hp(i,t,2);if(!a)return;for(let h=0;h<a.length;h+=3)o[n++]=a[h]+s,o[n++]=a[h+1]+s,o[n++]=a[h+2]+s;let l=s*r;for(let h=0;h<i.length;h+=2)e[l]=i[h],e[l+1]=i[h+1],l+=r;}var Sl=g(()=>{up();});var ny,cp,dp=g(()=>{N();Sl();ny=[],cp={extension:{type:C.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return true},triangulate(i,t,e,r,s,o){Jo(i,ny,t,e,r,s,o);}};});var fp,pp=g(()=>{N();fp={extension:{type:C.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>0&&n>0?(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n,true):false},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2;}};});var mp,gp=g(()=>{N();mp={extension:{type:C.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,true},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2;}};});function _p(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color);}}function yp(i,t){let e=gt.get().createCanvas(i,t),r=e.getContext("2d");return {canvas:e,context:r}}function ay(i){let t=i[0]??{};return (typeof t=="number"||i[1])&&(D("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Kt.defaultLinearOptions.textureSize}),t}var xp,wl,Kt,si=g(()=>{$t();fe();ut();Ao();Ft();Nt();_t();ga();xp=[{offset:0,color:"white"},{offset:1,color:"black"}],wl=class Tl{constructor(...t){this.uid=it("fillGradient"),this.type="linear",this.colorStops=[];let e=ay(t);e={...e.type==="radial"?Tl.defaultRadialOptions:Tl.defaultLinearOptions,...uo(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color);});}addColorStop(t,e){return this.colorStops.push({offset:t,color:J.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let m=t;t=r,r=m,o*=-1;}if(n<0){let m=e;e=s,s=m,n*=-1;}}let l=this.colorStops.length?this.colorStops:xp,h=this._textureSize,{canvas:u,context:c}=yp(h,1),f=a?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);_p(f,l),c.fillStyle=f,c.fillRect(0,0,h,1),this.texture=new U({source:new Me({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(o*o+n*n),x=Math.atan2(n,o),b=new F;b.scale(d/h,1),b.rotate(x),b.translate(t,e),this.textureSpace==="local"&&b.scale(h,h),this.transform=b;}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient();}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:xp,e=this._textureSize,{canvas:r,context:s}=yp(e,e),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,h=this.innerRadius,u=this.outerRadius,c=a-u,f=l-u,d=e/(u*2),x=(o-c)*d,b=(n-f)*d,m=s.createRadialGradient(x,b,h*d,(a-c)*d,(l-f)*d,u*d);_p(m,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=m,s.translate(x,b),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-x,-b),s.fillRect(0,0,e,e),this.texture=new U({source:new Me({resource:r,addressMode:this._wrapMode})});let p=new F;p.scale(1/d,1/d),p.translate(c,f),this.textureSpace==="local"&&p.scale(e,e),this.transform=p;}get styleKey(){return this.uid}destroy(){this.texture?.destroy(true),this.texture=null;}};wl.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};wl.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Kt=wl;});function bp(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(hy);t.width&&n.pad(t.width);let{x:a,y:l}=n,h=1/n.width,u=1/n.height,c=-a*h,f=-l*u,d=s.a,x=s.b,b=s.c,m=s.d;s.a*=h,s.b*=h,s.c*=u,s.d*=u,s.tx=c*d+f*b+s.tx,s.ty=c*x+f*m+s.ty;}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return !(t.fill instanceof Kt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(ly.copyFrom(r).invert()),s}var ly,hy,vp=g(()=>{ut();Xt();si();ly=new F,hy=new st;});function Tp(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")dy(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,l=o.data.style,h=o.data.hole;n&&h&&Sp(h.shapePath,l,true,r,e),h&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),Sp(a,l,n,r,e);}}}function dy(i,t,e){let r=[],s=tn.rectangle,o=uy;o.x=i.dx,o.y=i.dy,o.width=i.dw,o.height=i.dh;let n=i.transform;if(!s.build(o,r))return;let{vertices:a,uvs:l,indices:h}=e,u=h.length,c=a.length/2;n&&_l(r,n),s.triangulate(r,a,2,c,h,u);let f=i.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let x=wt.get(Sr);x.indexOffset=u,x.indexSize=h.length-u,x.attributeOffset=c,x.attributeSize=a.length/2-c,x.baseColor=i.style,x.alpha=i.alpha,x.texture=f,x.geometryData=e,t.push(x);}function Sp(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:l,transform:h,holes:u})=>{let c=[],f=tn[l.type];if(!f.build(l,c))return;let d=a.length,x=o.length/2,b="triangle-list";if(h&&_l(c,h),e){let v=l.closePath??true,S=t;S.pixelLine?(ep(c,v,o,a),b="line-list"):Jf(c,S,false,v,o,a);}else if(u){let v=[],S=c.slice();fy(u).forEach(T=>{v.push(S.length/2),S.push(...T);}),Jo(S,v,o,2,x,a,d);}else f.triangulate(c,o,2,x,a,d);let m=n.length/2,p=t.texture;if(p!==U.WHITE){let v=bp(cy,t,l,h);Wf(o,2,x,n,m,2,o.length/2-x,v);}else Hf(n,m,2,o.length/2-x);let y=wt.get(Sr);y.indexOffset=d,y.indexSize=a.length-d,y.attributeOffset=x,y.attributeSize=o.length/2-x,y.baseColor=t.color,y.alpha=t.alpha,y.texture=p,y.geometryData=s,y.topology=b,r.push(y);});}function fy(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];tn[r.type].build(r,s)&&t.push(s);}return t}var tn,uy,cy,wp=g(()=>{N();ut();Xt();Yf();$f();Ft();pr();yl();Kf();tp();rp();dp();pp();gp();vp();Sl();tn={};W.handleByMap(C.ShapeBuilder,tn);W.add(fp,cp,mp,ri,Xf,jf);uy=new st,cy=new F;});var Cl,Pl,El,oi,en=g(()=>{N();_d();Vf();pa();_t();pr();wp();Cl=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]};}},Pl=class{constructor(){this.instructions=new Dr;}init(t){this.batcher=new zf({maxTextures:t}),this.instructions.reset();}get geometry(){return D(_u,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},El=class Ml{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash");}init(t){Ml.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Ml.defaultOptions.bezierSmoothness;}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),Tp(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=false:r==="auto"?e.isBatchable=e.geometryData.vertices.length<400:e.isBatchable=true,t.dirty=false;}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=wt.get(Pl,{maxTextures:this._renderer.limits.maxBatchableTextures}),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=false;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let u=0;u<r.length;u++){let c=r[u];a.add(c);}a.finish(e.instructions);let l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,true),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,true);let h=a.batches;for(let u=0;u<h.length;u++){let c=h[u];c.bindGroup=xd(c.textures.textures,c.textures.count,this._renderer.limits.maxBatchableTextures);}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Cl;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null;}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(wt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{wt.return(r);});}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context);}};El.extension={type:[C.WebGLSystem,C.WebGPUSystem,C.CanvasSystem],name:"graphicsContext"};El.defaultOptions={bezierSmoothness:.5};oi=El;});var py,Al,Il,Ll,Rl,Fl,Bl,kl,Cr,rn=g(()=>{py={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Al=0,Il=1,Ll=2,Rl=3,Fl=4,Bl=5,kl=class Cp{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=true,this.depthMask=true;}get blend(){return !!(this.data&1<<Al)}set blend(t){!!(this.data&1<<Al)!==t&&(this.data^=1<<Al);}get offsets(){return !!(this.data&1<<Il)}set offsets(t){!!(this.data&1<<Il)!==t&&(this.data^=1<<Il);}set cullMode(t){if(t==="none"){this.culling=false;return}this.culling=true,this.clockwiseFrontFace=t==="front";}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return !!(this.data&1<<Ll)}set culling(t){!!(this.data&1<<Ll)!==t&&(this.data^=1<<Ll);}get depthTest(){return !!(this.data&1<<Rl)}set depthTest(t){!!(this.data&1<<Rl)!==t&&(this.data^=1<<Rl);}get depthMask(){return !!(this.data&1<<Bl)}set depthMask(t){!!(this.data&1<<Bl)!==t&&(this.data^=1<<Bl);}get clockwiseFrontFace(){return !!(this.data&1<<Fl)}set clockwiseFrontFace(t){!!(this.data&1<<Fl)!==t&&(this.data^=1<<Fl);}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=py[t]||0;}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t;}toString(){return `[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new Cp;return t.depthTest=false,t.blend=true,t}};kl.default2d=kl.for2d();Cr=kl;});function Je(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r;}var ds=g(()=>{});var Gl,fs,Pp=g(()=>{N();rn();pr();ds();yl();Gl=class{constructor(){this.batches=[],this.batched=false;}destroy(){this.batches.forEach(t=>{wt.return(t);}),this.batches.length=0;}},fs=class{constructor(t,e){this.state=Cr.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this);}contextChange(){this._adaptor.contextChange(this.renderer);}validateRenderable(t){let e=t.context,r=!!t._gpuData,s=this.renderer.graphicsContext.updateGpuContext(e);return !!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t));}updateRenderable(t){let r=this._getGpuDataForRenderable(t).batches;for(let s=0;s<r.length;s++){let o=r[s];o._batcher.updateElement(o);}}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Je(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t);}_rebuild(t){let e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e);}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getGpuDataForRenderable(t).batches;for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e);}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new Gl;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){let r=t.context,s=this.renderer.graphicsContext.getGpuContext(r),o=this.renderer._roundPixels|t._roundPixels;e.batches=s.batches.map(n=>{let a=wt.get(Sr);return n.copyTo(a),a.renderable=t,a.roundPixels=o,a});}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;}};fs.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"graphics"};});var Ol=g(()=>{N();en();Pp();W.add(fs);W.add(oi);});var tr,sn=g(()=>{tr=class{constructor(){this.batcherName="default",this.packAsQuad=false,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1;}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t;}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1;}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1);}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}};});var on,ps,Mp=g(()=>{N();ut();rs();Qe();is();ds();sn();on=class{destroy(){}},ps=class{constructor(t,e){this.localUniforms=new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new le({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init();}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return true;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,true;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return false}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e);}else r.break(e),e.add(t);}updateRenderable(t){if(t.batched){let e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e);}}execute(t){if(!t.isRenderable)return;t.state.blendMode=ze(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Je(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t);}_getMeshData(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new on),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return (e=t._gpuData)[r=this.renderer.uid]||(e[r]=new on),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new tr;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null;}};ps.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"mesh"};});var Dl=g(()=>{N();Mp();W.add(ps);});var nn,Ep=g(()=>{nn=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let h=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,h,0);}};});function Ul(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var Ap=g(()=>{});function Lp(i){return {dynamicUpdate:Ip(i,true),staticUpdate:Ip(i,false)}}function Ip(i,t){let e=[];e.push(`
254
254
 
255
255
  var index = 0;
256
256
 
@@ -473,7 +473,7 @@ fn mainFragment(
473
473
  font-weight: ${i.fontWeight};
474
474
  font-style: ${i.fontStyle};
475
475
  }`}var Sg=g(()=>{vg();});async function Tg(i,t,e){let r=i.filter(s=>vt.has(`${s}-and-url`)).map((s,o)=>{if(!In.has(s)){let{url:n}=vt.get(`${s}-and-url`);o===0?In.set(s,vh({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):In.set(s,vh({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n));}return In.get(s)});return (await Promise.all(r)).join(`
476
- `)}var In,wg=g(()=>{es();Sg();In=new Map;});function Cg(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var Pg=g(()=>{});function Mg(i,t){let e=Fe.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var Eg=g(()=>{Ss();});function Ag(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r();},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous";})}var Ig=g(()=>{});function Rg(i,t,e,r){r||(r=Lg||(Lg=new fi));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return {width:a.width-l,height:a.height-l}}var Lg,Fg=g(()=>{bh();});var Ms,Bg=g(()=>{N();Ss();Nr();ns();lg();Gt();pr();ah();bh();xg();yg();wg();Pg();Eg();Ig();Fg();Ms=class{constructor(t){this._renderer=t,this._createCanvas=t.type===Ie.WEBGPU;}getTexture(t){return this.getTexturePromise(t)}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:s,textureStyle:o}=t,n=wt.get(fi),a=_g(e,r),l=await Tg(a,r,An.defaultTextStyle),h=Rg(e,r,l,n),u=Math.ceil(Math.ceil(Math.max(1,h.width)+r.padding*2)*s),c=Math.ceil(Math.ceil(Math.max(1,h.height)+r.padding*2)*s),f=n.image,d=2;f.width=(u|0)+d,f.height=(c|0)+d;let x=Cg(e,r,s,l,n);await Ag(f,x,ag()&&a.length>0);let b=f,m;this._createCanvas&&(m=Mg(f,s));let p=bn(m?m.canvas:b,f.width-d,f.height-d,s);return o&&(p.source.style=o),this._createCanvas&&(this._renderer.texture.initSource(p.source),Fe.returnCanvasAndContext(m)),wt.return(n),p}returnTexturePromise(t){t.then(e=>{this._cleanUp(e);}).catch(()=>{K("HTMLTextSystem: Failed to clean texture");});}_cleanUp(t){Ot.returnTexture(t,true),t.source.resource=null,t.source.uploadMethodId="unknown";}destroy(){this._renderer=null;}};Ms.extension={type:[C.WebGLSystem,C.WebGPUSystem,C.CanvasSystem],name:"htmlText"};});var Sh=g(()=>{N();ng();Bg();W.add(Ms);W.add(Ps);});var kg,pi,Ln=g(()=>{jr();Xr();os();_t();kg=class Gg extends Ae{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(D(Z,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...Gg.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Bt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),l=new Bt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),h=new Bt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:lt.INDEX|lt.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:e.topology}),this.batchMode="auto";}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t;}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t;}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t;}};kg.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};pi=kg;});var Es,Og,Dg=g(()=>{Es={name:"local-uniform-bit",vertex:{header:`
476
+ `)}var In,wg=g(()=>{es();Sg();In=new Map;});function Cg(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:l,height:h}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(a)}var Pg=g(()=>{});function Mg(i,t){let e=Fe.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var Eg=g(()=>{Ss();});function Ag(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r();},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous";})}var Ig=g(()=>{});function Rg(i,t,e,r){r||(r=Lg||(Lg=new fi));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let l=t.padding*2;return {width:a.width-l,height:a.height-l}}var Lg,Fg=g(()=>{bh();});var Ms,Bg=g(()=>{N();Ss();Nr();ns();lg();Gt();pr();ah();bh();xg();yg();wg();Pg();Eg();Ig();Fg();Ms=class{constructor(t){this._renderer=t,this._createCanvas=t.type===Ie.WEBGPU;}getTexture(t){return this.getTexturePromise(t)}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:s,textureStyle:o}=t,n=wt.get(fi),a=_g(e,r),l=await Tg(a,r,An.defaultTextStyle),h=Rg(e,r,l,n),u=Math.ceil(Math.ceil(Math.max(1,h.width)+r.padding*2)*s),c=Math.ceil(Math.ceil(Math.max(1,h.height)+r.padding*2)*s),f=n.image,d=2;f.width=(u|0)+d,f.height=(c|0)+d;let x=Cg(e,r,s,l,n);await Ag(f,x,ag()&&a.length>0);let b=f,m;this._createCanvas&&(m=Mg(f,s));let p=bn(m?m.canvas:b,f.width-d,f.height-d,s);return o&&(p.source.style=o),this._createCanvas&&(this._renderer.texture.initSource(p.source),Fe.returnCanvasAndContext(m)),wt.return(n),p}returnTexturePromise(t){t.then(e=>{this._cleanUp(e);}).catch(()=>{K("HTMLTextSystem: Failed to clean texture");});}_cleanUp(t){Ot.returnTexture(t,true),t.source.resource=null,t.source.uploadMethodId="unknown";}destroy(){this._renderer=null;}};Ms.extension={type:[C.WebGLSystem,C.WebGPUSystem,C.CanvasSystem],name:"htmlText"};});var Sh=g(()=>{N();ng();Bg();W.add(Ms);W.add(Ps);});var kg,pi,Ln=g(()=>{jr();Xr();os();_t();kg=class Gg extends Ae{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(D(Z,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...Gg.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Bt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),l=new Bt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:lt.VERTEX|lt.COPY_DST}),h=new Bt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:lt.INDEX|lt.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:8,offset:0},aUV:{buffer:l,format:"float32x2",stride:8,offset:0}},indexBuffer:h,topology:e.topology}),this.batchMode="auto";}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t;}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t;}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t;}};kg.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:false};pi=kg;});var Es,Og,Dg=g(()=>{Es={name:"local-uniform-bit",vertex:{header:`
477
477
 
478
478
  struct LocalUniforms {
479
479
  uTransformMatrix:mat3x3<f32>,
@@ -568,5 +568,5 @@ fn mainFragment(
568
568
 
569
569
  outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
570
570
 
571
- `}};});var Th,wh,Rn,Vg=g(()=>{ut();Vo();Dg();Xo();as();Qe();Ft();zg();Rn=class extends Le{constructor(){Th??(Th=Qr({name:"tiling-sprite-shader",bits:[Es,Ug,ti]})),wh??(wh=Jr({name:"tiling-sprite-shader",bits:[Og,Ng,ei]}));let t=new Vt({uMapCoord:{value:new F,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new F,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:wh,gpuProgram:Th,resources:{localUniforms:new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:U.EMPTY.source,uSampler:U.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*l/t,r.b*l/e,r.c*h/t,r.d*h/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var Fn,Wg=g(()=>{Ln();Fn=class extends pi{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function Hg(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var Yg=g(()=>{});function $g(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,l=r.c,h=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+l*d+u,i[e+1]=a*f+h*d+c,e+=t,s++;}}var Xg=g(()=>{});function jg(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=F.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),$g(t,2,0,a);}var Kg=g(()=>{ut();Xg();});var Bn,Ch,As,qg=g(()=>{N();is();rn();ns();ds();sn();Ln();Vg();Wg();Yg();Kg();Bn=new Fn,Ch=class{constructor(){this.canBatch=true,this.geometry=new pi({indices:Bn.indices.slice(),positions:Bn.positions.slice(),uvs:Bn.uvs.slice()});}destroy(){this.geometry.destroy(),this.shader?.destroy();}},As=class{constructor(t){this._state=Cr.default2d,this._renderer=t;}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new tr);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new Rn),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Je(t.groupColorAlpha,r.uColor,0),this._state.blendMode=ze(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Bn,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ch;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),jg(t,r.uvs),Hg(t,r.positions);}destroy(){this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Ie.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};As.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"tilingSprite"};});var Ph=g(()=>{N();qg();W.add(As);});var Zg,Jg,tx=g(()=>{_t();Ln();Zg=class Qg extends pi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(D(Z,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={...Qg.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*l,d*h),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,x=d*this.verticesX+f,b=d*this.verticesX+f+1,m=(d+1)*this.verticesX+f,p=(d+1)*this.verticesX+f+1;o.push(x,b,m,b,p,m);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};Zg.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Jg=Zg;});var ex,ix,sx=g(()=>{tx();ex=class rx extends Jg{constructor(t={}){t={...rx.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,x=Math.min(c,d),b=l*e,m=h*r;t[0]=t[8]=t[16]=t[24]=-b,t[2]=t[10]=t[18]=t[26]=s*x-b,t[4]=t[12]=t[20]=t[28]=e-o*x-b,t[6]=t[14]=t[22]=t[30]=e-b,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=n*x-m,t[17]=t[19]=t[21]=t[23]=r-a*x-m,t[25]=t[27]=t[29]=t[31]=r-m,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};ex.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};ix=ex;});var Mh,Is,ox=g(()=>{N();sn();sx();Mh=class extends tr{constructor(){super(),this.geometry=new ix;}destroy(){this.geometry.destroy();}},Is=class{constructor(t){this._renderer=t;}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=t._gpuData[this._renderer.uid]=new Mh,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._renderer=null;}};Is.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"nineSliceSprite"};});var Eh=g(()=>{N();ox();W.add(Is);});var Ls,nx=g(()=>{N();Ls=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ls.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"filter"};});function ax(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var lx=g(()=>{});var Qy,Ah,Rs,hx=g(()=>{N();ut();rs();os();Qe();Ft();Nr();ns();ce();lx();Gt();Qy=new Ae({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ah=class{constructor(){this.skip=false,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new mt,this.container=null,this.blendRequired=false,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0};}},Rs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Vt({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new le({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,s=this._pushFilterData();s.skip=false,s.filters=r,s.container=t.container,s.outputRenderSurface=e.renderTarget.renderSurface;let o=e.renderTarget.renderTarget.colorTexture.source,n=o.resolution,a=o.antialias;if(r.length===0){s.skip=true;return}let l=s.bounds;if(this._calculateFilterArea(t,l),this._calculateFilterBounds(s,e.renderTarget.rootViewPort,a,n,1),s.skip)return;let h=this._getPreviousFilterData(),u=this._findFilterResolution(n),c=0,f=0;h&&(c=h.bounds.minX,f=h.bounds.minY),this._calculateGlobalFrame(s,c,f,u,o.width,o.height),this._setupFilterTextures(s,l,e,h);}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=false,r.filters=e;let s=t.source,o=s.resolution,n=s.antialias;if(e.length===0)return r.skip=true,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,n,o,0),r.skip)return t;let l=o;this._calculateGlobalFrame(r,0,0,l,s.width,s.height),r.outputRenderSurface=Ot.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=U.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,true);let f=r.outputRenderSurface;return f.source.alphaMode="premultiplied-alpha",f}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,false),e.blendRequired&&Ot.returnTexture(e.backTexture),Ot.returnTexture(e.inputTexture));}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Ot.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),h=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:h},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._activeFilterData,l=n.outputRenderSurface===r,h=o.renderTarget.rootRenderTarget.colorTexture.source._resolution,u=this._findFilterResolution(h),c=0,f=0;if(l){let d=this._findPreviousFilterOffset();c=d.x,f=d.y;}this._updateFilterUniforms(e,r,n,c,f,u,l,s),this._setupBindGroupsAndRender(t,e,o);}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(F.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}destroy(){}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let s=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(s,0);}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:Qy,shader:t,state:t._state,topology:"triangle-list"}),r.type===Ie.WEBGL&&r.renderTarget.finishRenderPass();}_setupFilterTextures(t,e,r,s){if(t.backTexture=U.EMPTY,t.blendRequired){r.renderTarget.finishRenderPass();let o=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(o,e,s?.bounds);}t.inputTexture=Ot.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),r.renderTarget.bind(t.inputTexture,true),r.globalUniforms.push({offset:e});}_calculateGlobalFrame(t,e,r,s,o,n){let a=t.globalFrame;a.x=e*s,a.y=r*s,a.width=o*s,a.height=n*s;}_updateFilterUniforms(t,e,r,s,o,n,a,l){let h=this._filterGlobalUniforms.uniforms,u=h.uOutputFrame,c=h.uInputSize,f=h.uInputPixel,d=h.uInputClamp,x=h.uGlobalFrame,b=h.uOutputTexture;a?(u[0]=r.bounds.minX-s,u[1]=r.bounds.minY-o):(u[0]=0,u[1]=0),u[2]=t.frame.width,u[3]=t.frame.height,c[0]=t.source.width,c[1]=t.source.height,c[2]=1/c[0],c[3]=1/c[1],f[0]=t.source.pixelWidth,f[1]=t.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],d[0]=.5*f[2],d[1]=.5*f[3],d[2]=t.frame.width*c[2]-.5*f[2],d[3]=t.frame.height*c[3]-.5*f[3];let m=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=s*n,x[1]=o*n,x[2]=m.source.width*n,x[3]=m.source.height*n,e instanceof U&&(e.source.resource=null);let p=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!l),e instanceof U?(b[0]=e.frame.width,b[1]=e.frame.height):(b[0]=p.width,b[1]=p.height),b[2]=p.isRoot?-1:1,this._filterGlobalUniforms.update();}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let s=this._filterStack[r];if(!s.skip){t=s.bounds.minX,e=s.bounds.minY;break}}return {x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?ax(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,e),t.container){let s=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;s&&e.applyMatrix(s);}}_applyFiltersToTexture(t,e){let r=t.inputTexture,s=t.bounds,o=t.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),o.length===1)o[0].apply(this,r,t.outputRenderSurface,e);else {let n=t.inputTexture,a=Ot.getOptimalTexture(s.width,s.height,n.source._resolution,false),l=a,h=0;for(h=0;h<o.length-1;++h){o[h].apply(this,n,l,true);let c=n;n=l,l=c;}o[h].apply(this,n,t.outputRenderSurface,e),Ot.returnTexture(a);}}_calculateFilterBounds(t,e,r,s,o){let n=this.renderer,a=t.bounds,l=t.filters,h=1/0,u=0,c=true,f=false,d=false,x=true;for(let b=0;b<l.length;b++){let m=l[b];if(h=Math.min(h,m.resolution==="inherit"?s:m.resolution),u+=m.padding,m.antialias==="off"?c=false:m.antialias==="inherit"&&c&&(c=r),m.clipToViewport||(x=false),!!!(m.compatibleRenderers&n.type)){d=false;break}if(m.blendRequired&&!(n.backBuffer?.useBackBuffer??true)){K("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),d=false;break}d=m.enabled||d,f||(f=m.blendRequired);}if(!d){t.skip=true;return}if(x&&a.fitBounds(0,e.width/s,0,e.height/s),a.scale(h).ceil().scale(1/h).pad((u|0)*o),!a.isPositive){t.skip=true;return}t.antialias=c,t.resolution=h,t.blendRequired=f;}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>1&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new Ah),this._filterStackIndex++,t}};Rs.extension={type:[C.WebGLSystem,C.WebGPUSystem],name:"filter"};});var Ih=g(()=>{N();nx();hx();W.add(Rs);W.add(Ls);});var Jy={};var ux=g(()=>{Lc();Ea();Uc();zc();Co();Lo();Ol();Dl();Vl();dh();yh();Sh();Ph();Eh();Ih();});var tb={};var dx=g(()=>{Ea();Co();Lo();Ol();Dl();Vl();dh();yh();Sh();Ph();Eh();Ih();});var Px=$s((Vn,Cx)=>{(function(i,t){typeof Vn=="object"?Cx.exports=Vn=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(Vn,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof Yn=="function")try{r=Yn("crypto");}catch{}var s=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(y){var v;return p.prototype=y,v=new p,p.prototype=null,v}}(),n={},a=n.lib={},l=a.Base=function(){return {extend:function(p){var y=o(this);return p&&y.mixIn(p),(!y.hasOwnProperty("init")||this.init===y.init)&&(y.init=function(){y.$super.init.apply(this,arguments);}),y.init.prototype=y,y.$super=this,y},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var y in p)p.hasOwnProperty(y)&&(this[y]=p[y]);p.hasOwnProperty("toString")&&(this.toString=p.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),h=a.WordArray=l.extend({init:function(p,y){p=this.words=p||[],y!=e?this.sigBytes=y:this.sigBytes=p.length*4;},toString:function(p){return (p||c).stringify(this)},concat:function(p){var y=this.words,v=p.words,S=this.sigBytes,P=p.sigBytes;if(this.clamp(),S%4)for(var T=0;T<P;T++){var w=v[T>>>2]>>>24-T%4*8&255;y[S+T>>>2]|=w<<24-(S+T)%4*8;}else for(var G=0;G<P;G+=4)y[S+G>>>2]=v[G>>>2];return this.sigBytes+=P,this},clamp:function(){var p=this.words,y=this.sigBytes;p[y>>>2]&=4294967295<<32-y%4*8,p.length=t.ceil(y/4);},clone:function(){var p=l.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var y=[],v=0;v<p;v+=4)y.push(s());return new h.init(y,p)}}),u=n.enc={},c=u.Hex={stringify:function(p){for(var y=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=y[P>>>2]>>>24-P%4*8&255;S.push((T>>>4).toString(16)),S.push((T&15).toString(16));}return S.join("")},parse:function(p){for(var y=p.length,v=[],S=0;S<y;S+=2)v[S>>>3]|=parseInt(p.substr(S,2),16)<<24-S%8*4;return new h.init(v,y/2)}},f=u.Latin1={stringify:function(p){for(var y=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=y[P>>>2]>>>24-P%4*8&255;S.push(String.fromCharCode(T));}return S.join("")},parse:function(p){for(var y=p.length,v=[],S=0;S<y;S++)v[S>>>2]|=(p.charCodeAt(S)&255)<<24-S%4*8;return new h.init(v,y)}},d=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(f.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return f.parse(unescape(encodeURIComponent(p)))}},x=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(p){typeof p=="string"&&(p=d.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes;},_process:function(p){var y,v=this._data,S=v.words,P=v.sigBytes,T=this.blockSize,w=T*4,G=P/w;p?G=t.ceil(G):G=t.max((G|0)-this._minBufferSize,0);var E=G*T,L=t.min(E*4,P);if(E){for(var R=0;R<E;R+=T)this._doProcessBlock(S,R);y=S.splice(0,E),v.sigBytes-=L;}return new h.init(y,L)},clone:function(){var p=l.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});a.Hasher=x.extend({cfg:l.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var y=this._doFinalize();return y},blockSize:512/32,_createHelper:function(p){return function(y,v){return new p.init(v).finalize(y)}},_createHmacHelper:function(p){return function(y,v){return new m.HMAC.init(p,v).finalize(y)}}});var m=n.algo={};return n}(Math);return i});});var Ex=$s((Wn,Mx)=>{(function(i,t){typeof Wn=="object"?Mx.exports=Wn=t(Px()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(Wn,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,s=e.Hasher,o=t.algo,n=[],a=o.SHA1=s.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,h){for(var u=this._hash.words,c=u[0],f=u[1],d=u[2],x=u[3],b=u[4],m=0;m<80;m++){if(m<16)n[m]=l[h+m]|0;else {var p=n[m-3]^n[m-8]^n[m-14]^n[m-16];n[m]=p<<1|p>>>31;}var y=(c<<5|c>>>27)+b+n[m];m<20?y+=(f&d|~f&x)+1518500249:m<40?y+=(f^d^x)+1859775393:m<60?y+=(f&d|f&x|d&x)-1894007588:y+=(f^d^x)-899497514,b=x,x=d,d=f<<30|f>>>2,f=c,c=y;}u[0]=u[0]+c|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+x|0,u[4]=u[4]+b|0;},_doFinalize:function(){var l=this._data,h=l.words,u=this._nDataBytes*8,c=l.sigBytes*8;return h[c>>>5]|=128<<24-c%32,h[(c+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(c+64>>>9<<4)+15]=u,l.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var l=s.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=s._createHelper(a),t.HmacSHA1=s._createHmacHelper(a);}(),i.SHA1});});var Te={};Nx(Te,{DistortionFilter:()=>js,EqualizerFilter:()=>oe,Filter:()=>Tt,MonoFilter:()=>Ks,ReverbFilter:()=>qs,StereoFilter:()=>Zs,StreamFilter:()=>Qs,TelephoneFilter:()=>Js});var Xh;function jh(i){return Xh=i,i}function nt(){return Xh}var Tt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var js=class extends Tt{constructor(t=0){let e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,nt().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var yt=class{static setParamValue(t,e){if(t.setValueAtTime){let r=nt().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var at=class extends Tt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,l=0,h=0){let u=[],c=[{f:at.F32,type:"lowshelf",gain:i},{f:at.F64,type:"peaking",gain:t},{f:at.F125,type:"peaking",gain:e},{f:at.F250,type:"peaking",gain:r},{f:at.F500,type:"peaking",gain:s},{f:at.F1K,type:"peaking",gain:o},{f:at.F2K,type:"peaking",gain:n},{f:at.F4K,type:"peaking",gain:a},{f:at.F8K,type:"peaking",gain:l},{f:at.F16K,type:"highshelf",gain:h}];nt().useLegacy||(u=c.map(f=>{let d=nt().context.audioContext.createBiquadFilter();return d.type=f.type,yt.setParamValue(d.Q,1),d.frequency.value=f.f,yt.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);yt.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(at.F32,i);}get f32(){return this.getGain(at.F32)}set f64(i){this.setGain(at.F64,i);}get f64(){return this.getGain(at.F64)}set f125(i){this.setGain(at.F125,i);}get f125(){return this.getGain(at.F125)}set f250(i){this.setGain(at.F250,i);}get f250(){return this.getGain(at.F250)}set f500(i){this.setGain(at.F500,i);}get f500(){return this.getGain(at.F500)}set f1k(i){this.setGain(at.F1K,i);}get f1k(){return this.getGain(at.F1K)}set f2k(i){this.setGain(at.F2K,i);}get f2k(){return this.getGain(at.F2K)}set f4k(i){this.setGain(at.F4K,i);}get f4k(){return this.getGain(at.F4K)}set f8k(i){this.setGain(at.F8K,i);}get f8k(){return this.getGain(at.F8K)}set f16k(i){this.setGain(at.F16K,i);}get f16k(){return this.getGain(at.F16K)}reset(){this.bands.forEach(i=>{yt.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},oe=at;oe.F32=32;oe.F64=64;oe.F125=125;oe.F250=250;oe.F500=500;oe.F1K=1e3;oe.F2K=2e3;oe.F4K=4e3;oe.F8K=8e3;oe.F16K=16e3;var Ks=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var qs=class extends Tt{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(nt().useLegacy)return;let{audioContext:t}=nt().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let h=0;h<r;h++)a=this._reverse?r-h:h,o[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let l=t.createConvolver();l.buffer=s,this.init(l);}};var Zs=class extends Tt{constructor(t=0){let e,r,s;if(!nt().useLegacy){let{audioContext:o}=nt().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?yt.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Qs=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Js=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",yt.setParamValue(s.frequency,2e3),o.type="lowpass",yt.setParamValue(o.frequency,2e3),n.type="highpass",yt.setParamValue(n.frequency,500),a.type="highpass",yt.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};N();var cx={extension:{type:C.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(ux(),Jy));}};N();var fx={extension:{type:C.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(dx(),tb));}};N();N();Lo();Co();Oa();fe();ja();Hi();Yt();wo();W.add(cx,fx);var Fs=class extends et{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var eb=0,Lh=class extends et{constructor(i){super(),this.id=eb++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Lh.PADDING),this._end=Math.min(this._end+Lh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),Pt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){Pt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){Pt.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},kn=Lh;kn.PADDING=.1;var Bs=class extends et{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new kn(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let l=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,l);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let l=r.autoPlayStart();t&&t(null,r,l);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let l=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(l)):console.error(l);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ks=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var Ar=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Rh=["audio/mpeg","audio/ogg"],Ir={};function px(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;Ar.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(Ir,r);}px();var ib=0,Gs=class extends et{constructor(t){super(),this.id=ib++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);yt.setParamValue(this._gain.gain,o*s*r),yt.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:l}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:h,gain:u}=this._media.nodes.cloneBufferSource();this._source=h,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=l,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){Pt.shared.remove(this._updateListener,this),t&&Pt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Lr=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var mx=class extends Lr{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(mx.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,yt.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Gn=mx;Gn.BUFFER_SIZE=0;var Rr=class{init(t){this.parent=t,this._nodes=new Gn(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Gs(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await gt.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var mi=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=nt().useLegacy?new Bs:new Rr;return new mi(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:jt.extname(e).slice(1)})).filter(({ext:e})=>Ir[e]).sort((e,r)=>Ar.indexOf(e.ext)-Ar.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return nt().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ks(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,l)=>{this._preloadQueue.forEach(h=>h()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,l),s(l));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(mi._pool.length>0){let i=mi._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),mi._pool.indexOf(i)<0&&mi._pool.push(i);}},rr=mi;rr._pool=[];var gi=class i extends Lr{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new et,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var On=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new gi),this._htmlAudioContext=new Fs,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return gi.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof rr)return this._sounds[t]=e,e;let r=this._getOptions(e),s=rr.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var gx=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=jt.basename(t,jt.extname(t))),e},xx={extension:C.Asset,detection:{test:async()=>true,add:async i=>[...i,...Ar.filter(t=>Ir[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[C.LoadParser],priority:Hr.High},test(i){let t=jt.extname(i).slice(1);return !!Ir[t]||Rh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>rr.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return nt().add(gx(t),e),e},async unload(i,t){nt().remove(gx(t));}}};W.add(xx);jh(new On);({DistortionFilter:Te.DistortionFilter,EqualizerFilter:Te.EqualizerFilter,MonoFilter:Te.MonoFilter,ReverbFilter:Te.ReverbFilter,StereoFilter:Te.StereoFilter,StreamFilter:Te.StreamFilter,TelephoneFilter:Te.TelephoneFilter});var Q={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var k;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(k||(k={}));var Y=class Y{static init(t){Y._getStepCounter=t.getStepCounter,Y._setStepCounter=t.setStepCounter,Y._getCurrentGameStepState=t.getCurrentGameStepState,Y._restoreGameStepState=t.restoreGameStepState,Y._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(Y._onGoNextEnd=t.onGoNextEnd),Y._getVariable=t.getVariable,Y._setVariable=t.setVariable,Y._removeVariable=t.removeVariable,Y._getFlag=t.getFlag,Y._setFlag=t.setFlag,t.onLabelClosing&&(Y._onLabelClosing=t.onLabelClosing),Y._addHistoryItem=t.addHistoryItem,Y._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,Y._getCharacter=t.getCharacter;}static get stepCounter(){return Y._getStepCounter()}static set stepCounter(t){Y._setStepCounter(t);}static get currentGameStepState(){return Y._getCurrentGameStepState()}static get restoreGameStepState(){return Y._restoreGameStepState}static get openedLabels(){return Y._getOpenedLabels()}static get onGoNextEnd(){return Y._onGoNextEnd}static get getVariable(){return Y._getVariable}static get setVariable(){return Y._setVariable}static get removeVariable(){return Y._removeVariable}static get getFlag(){return Y._getFlag}static get setFlag(){return Y._setFlag}static get onLabelClosing(){return Y._onLabelClosing}static get addHistoryItem(){return Y._addHistoryItem}static get currentStepsRunningNumber(){return Y._getCurrentStepsRunningNumber()}static get getCharacter(){return Y._getCharacter}};M(Y,"_getStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_restoreGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getOpenedLabels",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onGoNextEnd",async()=>{}),M(Y,"_getVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_removeVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onLabelClosing",()=>{}),M(Y,"_addHistoryItem",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentStepsRunningNumber",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCharacter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),M(Y,"onEnd"),M(Y,"onError");var H=Y;function ke(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw k.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var xi=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,vx=new Set,Fh=typeof process=="object"&&process?process:{},Sx=(i,t,e,r)=>{typeof Fh.emitWarning=="function"?Fh.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Nn=globalThis.AbortController,_x=globalThis.AbortSignal;if(typeof Nn>"u"){_x=class{constructor(){M(this,"onabort");M(this,"_onabort",[]);M(this,"reason");M(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},Nn=class{constructor(){M(this,"signal",new _x);t();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Fh.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,Sx("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var nb=i=>!vx.has(i),ir=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Tx=i=>ir(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?_i:null:null,_i=class extends Array{constructor(t){super(t),this.fill(0);}},yi,Fr=class Fr{constructor(t,e){M(this,"heap");M(this,"length");if(!_(Fr,yi))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Tx(t);if(!e)return [];V(Fr,yi,true);let r=new Fr(t,e);return V(Fr,yi,false),r}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};yi=new WeakMap,tt(Fr,yi,false);var Bh=Fr,yx,bx,me,te,ge,Br,xe,bi,vi,Mt,_e,St,dt,X,Wt,ee,Dt,It,ye,Lt,be,ve,re,Se,ar,Ht,Si,A,kh,kr,Ye,Ds,ie,wx,Gr,Ti,Us,sr,or,Gh,Dn,Un,ct,Oh,Os,nr,Dh,Uh=class Uh{constructor(t){tt(this,A);tt(this,me);tt(this,te);tt(this,ge);tt(this,Br);tt(this,xe);tt(this,bi);tt(this,vi);M(this,"ttl");M(this,"ttlResolution");M(this,"ttlAutopurge");M(this,"updateAgeOnGet");M(this,"updateAgeOnHas");M(this,"allowStale");M(this,"noDisposeOnSet");M(this,"noUpdateTTL");M(this,"maxEntrySize");M(this,"sizeCalculation");M(this,"noDeleteOnFetchRejection");M(this,"noDeleteOnStaleGet");M(this,"allowStaleOnFetchAbort");M(this,"allowStaleOnFetchRejection");M(this,"ignoreFetchAbort");tt(this,Mt);tt(this,_e);tt(this,St);tt(this,dt);tt(this,X);tt(this,Wt);tt(this,ee);tt(this,Dt);tt(this,It);tt(this,ye);tt(this,Lt);tt(this,be);tt(this,ve);tt(this,re);tt(this,Se);tt(this,ar);tt(this,Ht);tt(this,Si);tt(this,kr,()=>{});tt(this,Ye,()=>{});tt(this,Ds,()=>{});tt(this,ie,()=>false);tt(this,Gr,t=>{});tt(this,Ti,(t,e,r)=>{});tt(this,Us,(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});M(this,yx,"LRUCache");let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:u,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:x=0,maxEntrySize:b=0,sizeCalculation:m,fetchMethod:p,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:T,ignoreFetchAbort:w}=t;if(e!==0&&!ir(e))throw new TypeError("max option must be a nonnegative integer");let G=e?Tx(e):Array;if(!G)throw new Error("invalid max value: "+e);if(V(this,me,e),V(this,te,x),this.maxEntrySize=b||_(this,te),this.sizeCalculation=m,this.sizeCalculation){if(!_(this,te)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(V(this,vi,y),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(V(this,bi,p),V(this,ar,!!p),V(this,St,new Map),V(this,dt,new Array(e).fill(void 0)),V(this,X,new Array(e).fill(void 0)),V(this,Wt,new G(e)),V(this,ee,new G(e)),V(this,Dt,0),V(this,It,0),V(this,ye,Bh.create(e)),V(this,Mt,0),V(this,_e,0),typeof h=="function"&&V(this,ge,h),typeof u=="function"&&V(this,Br,u),typeof c=="function"?(V(this,xe,c),V(this,Lt,[])):(V(this,xe,void 0),V(this,Lt,void 0)),V(this,Se,!!_(this,ge)),V(this,Si,!!_(this,Br)),V(this,Ht,!!_(this,xe)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(_(this,te)!==0&&!ir(_(this,te)))throw new TypeError("maxSize must be a positive integer if specified");if(!ir(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");B(this,A,wx).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=ir(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!ir(this.ttl))throw new TypeError("ttl must be a positive integer if specified");B(this,A,kh).call(this);}if(_(this,me)===0&&this.ttl===0&&_(this,te)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!_(this,me)&&!_(this,te)){let E="LRU_CACHE_UNBOUNDED";nb(E)&&(vx.add(E),Sx("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,Uh));}}static unsafeExposeInternals(t){return {starts:_(t,ve),ttls:_(t,re),sizes:_(t,be),keyMap:_(t,St),keyList:_(t,dt),valList:_(t,X),next:_(t,Wt),prev:_(t,ee),get head(){return _(t,Dt)},get tail(){return _(t,It)},free:_(t,ye),isBackgroundFetch:e=>{var r;return B(r=t,A,ct).call(r,e)},backgroundFetch:(e,r,s,o)=>{var n;return B(n=t,A,Un).call(n,e,r,s,o)},moveToTail:e=>{var r;return B(r=t,A,Os).call(r,e)},indexes:e=>{var r;return B(r=t,A,sr).call(r,e)},rindexes:e=>{var r;return B(r=t,A,or).call(r,e)},isStale:e=>{var r;return _(r=t,ie).call(r,e)}}}get max(){return _(this,me)}get maxSize(){return _(this,te)}get calculatedSize(){return _(this,_e)}get size(){return _(this,Mt)}get fetchMethod(){return _(this,bi)}get memoMethod(){return _(this,vi)}get dispose(){return _(this,ge)}get onInsert(){return _(this,Br)}get disposeAfter(){return _(this,xe)}getRemainingTTL(t){return _(this,St).has(t)?1/0:0}*entries(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*rentries(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*keys(){for(let t of B(this,A,sr).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*rkeys(){for(let t of B(this,A,or).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*values(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}*rvalues(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}[(bx=Symbol.iterator,yx=Symbol.toStringTag,bx)](){return this.entries()}find(t,e={}){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,_(this,dt)[r],this))return this.get(_(this,dt)[r],e)}}forEach(t,e=this){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}rforEach(t,e=this){for(let r of B(this,A,or).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}purgeStale(){let t=false;for(let e of B(this,A,or).call(this,{allowStale:true}))_(this,ie).call(this,e)&&(B(this,A,nr).call(this,_(this,dt)[e],"expire"),t=true);return t}info(t){let e=_(this,St).get(t);if(e===void 0)return;let r=_(this,X)[e],s=B(this,A,ct).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(_(this,re)&&_(this,ve)){let n=_(this,re)[e],a=_(this,ve)[e];if(n&&a){let l=n-(xi.now()-a);o.ttl=l,o.start=Date.now();}}return _(this,be)&&(o.size=_(this,be)[e]),o}dump(){let t=[];for(let e of B(this,A,sr).call(this,{allowStale:true})){let r=_(this,dt)[e],s=_(this,X)[e],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(_(this,re)&&_(this,ve)){n.ttl=_(this,re)[e];let a=xi.now()-_(this,ve)[e];n.start=Math.floor(Date.now()-a);}_(this,be)&&(n.size=_(this,be)[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=xi.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){var f,d,x,b;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=r,{noUpdateTTL:h=this.noUpdateTTL}=r,u=_(this,Us).call(this,t,e,r.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),B(this,A,nr).call(this,t,"set"),this;let c=_(this,Mt)===0?void 0:_(this,St).get(t);if(c===void 0)c=_(this,Mt)===0?_(this,It):_(this,ye).length!==0?_(this,ye).pop():_(this,Mt)===_(this,me)?B(this,A,Dn).call(this,false):_(this,Mt),_(this,dt)[c]=t,_(this,X)[c]=e,_(this,St).set(t,c),_(this,Wt)[_(this,It)]=c,_(this,ee)[c]=_(this,It),V(this,It,c),Xs(this,Mt)._++,_(this,Ti).call(this,c,u,l),l&&(l.set="add"),h=false,_(this,Si)&&((f=_(this,Br))==null||f.call(this,e,t,"add"));else {B(this,A,Os).call(this,c);let m=_(this,X)[c];if(e!==m){if(_(this,ar)&&B(this,A,ct).call(this,m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=m;p!==void 0&&!n&&(_(this,Se)&&((d=_(this,ge))==null||d.call(this,p,t,"set")),_(this,Ht)&&_(this,Lt)?.push([p,t,"set"]));}else n||(_(this,Se)&&((x=_(this,ge))==null||x.call(this,m,t,"set")),_(this,Ht)&&_(this,Lt)?.push([m,t,"set"]));if(_(this,Gr).call(this,c),_(this,Ti).call(this,c,u,l),_(this,X)[c]=e,l){l.set="replace";let p=m&&B(this,A,ct).call(this,m)?m.__staleWhileFetching:m;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");_(this,Si)&&this.onInsert?.(e,t,e===m?"update":"replace");}if(s!==0&&!_(this,re)&&B(this,A,kh).call(this),_(this,re)&&(h||_(this,Ds).call(this,c,s,o),l&&_(this,Ye).call(this,l,c)),!n&&_(this,Ht)&&_(this,Lt)){let m=_(this,Lt),p;for(;p=m?.shift();)(b=_(this,xe))==null||b.call(this,...p);}return this}pop(){var t;try{for(;_(this,Mt);){let e=_(this,X)[_(this,Dt)];if(B(this,A,Dn).call(this,!0),B(this,A,ct).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(_(this,Ht)&&_(this,Lt)){let e=_(this,Lt),r;for(;r=e?.shift();)(t=_(this,xe))==null||t.call(this,...r);}}}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=_(this,St).get(t);if(o!==void 0){let n=_(this,X)[o];if(B(this,A,ct).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(_(this,ie).call(this,o))s&&(s.has="stale",_(this,Ye).call(this,s,o));else return r&&_(this,kr).call(this,o),s&&(s.has="hit",_(this,Ye).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=_(this,St).get(t);if(s===void 0||!r&&_(this,ie).call(this,s))return;let o=_(this,X)[s];return B(this,A,ct).call(this,o)?o.__staleWhileFetching:o}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:b,forceRefresh:m=false,status:p,signal:y}=e;if(!_(this,ar))return p&&(p.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:x,ignoreFetchAbort:d,status:p,signal:y},S=_(this,St).get(t);if(S===void 0){p&&(p.fetch="miss");let P=B(this,A,Un).call(this,t,S,v,b);return P.__returned=P}else {let P=_(this,X)[S];if(B(this,A,ct).call(this,P)){let L=r&&P.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",L&&(p.returnedStale=true)),L?P.__staleWhileFetching:P.__returned=P}let T=_(this,ie).call(this,S);if(!m&&!T)return p&&(p.fetch="hit"),B(this,A,Os).call(this,S),s&&_(this,kr).call(this,S),p&&_(this,Ye).call(this,p,S),P;let w=B(this,A,Un).call(this,t,S,v,b),E=w.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=T?"stale":"refresh",E&&T&&(p.returnedStale=true)),E?w.__staleWhileFetching:w.__returned=w}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=_(this,vi);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=r(t,a,{options:n,context:s});return this.set(t,l,n),l}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=_(this,St).get(t);if(a!==void 0){let l=_(this,X)[a],h=B(this,A,ct).call(this,l);return n&&_(this,Ye).call(this,n,a),_(this,ie).call(this,a)?(n&&(n.get="stale"),h?(n&&r&&l.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?l.__staleWhileFetching:void 0):(o||B(this,A,nr).call(this,t,"expire"),n&&r&&(n.returnedStale=true),r?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(B(this,A,Os).call(this,a),s&&_(this,kr).call(this,a),l))}else n&&(n.get="miss");}delete(t){return B(this,A,nr).call(this,t,"delete")}clear(){return B(this,A,Dh).call(this,"delete")}};me=new WeakMap,te=new WeakMap,ge=new WeakMap,Br=new WeakMap,xe=new WeakMap,bi=new WeakMap,vi=new WeakMap,Mt=new WeakMap,_e=new WeakMap,St=new WeakMap,dt=new WeakMap,X=new WeakMap,Wt=new WeakMap,ee=new WeakMap,Dt=new WeakMap,It=new WeakMap,ye=new WeakMap,Lt=new WeakMap,be=new WeakMap,ve=new WeakMap,re=new WeakMap,Se=new WeakMap,ar=new WeakMap,Ht=new WeakMap,Si=new WeakMap,A=new WeakSet,kh=function(){let t=new _i(_(this,me)),e=new _i(_(this,me));V(this,re,t),V(this,ve,e),V(this,Ds,(o,n,a=xi.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let l=setTimeout(()=>{_(this,ie).call(this,o)&&B(this,A,nr).call(this,_(this,dt)[o],"expire");},n+1);l.unref&&l.unref();}}),V(this,kr,o=>{e[o]=t[o]!==0?xi.now():0;}),V(this,Ye,(o,n)=>{if(t[n]){let a=t[n],l=e[n];if(!a||!l)return;o.ttl=a,o.start=l,o.now=r||s();let h=o.now-l;o.remainingTTL=a-h;}});let r=0,s=()=>{let o=xi.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=_(this,St).get(o);if(n===void 0)return 0;let a=t[n],l=e[n];if(!a||!l)return 1/0;let h=(r||s())-l;return a-h},V(this,ie,o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a});},kr=new WeakMap,Ye=new WeakMap,Ds=new WeakMap,ie=new WeakMap,wx=function(){let t=new _i(_(this,me));V(this,_e,0),V(this,be,t),V(this,Gr,e=>{V(this,_e,_(this,_e)-t[e]),t[e]=0;}),V(this,Us,(e,r,s,o)=>{if(B(this,A,ct).call(this,r))return 0;if(!ir(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!ir(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),V(this,Ti,(e,r,s)=>{if(t[e]=r,_(this,te)){let o=_(this,te)-t[e];for(;_(this,_e)>o;)B(this,A,Dn).call(this,true);}V(this,_e,_(this,_e)+t[e]),s&&(s.entrySize=r,s.totalCalculatedSize=_(this,_e));});},Gr=new WeakMap,Ti=new WeakMap,Us=new WeakMap,sr=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,It);!(!B(this,A,Gh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,Dt)));)e=_(this,ee)[e];},or=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,Dt);!(!B(this,A,Gh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,It)));)e=_(this,Wt)[e];},Gh=function(t){return t!==void 0&&_(this,St).get(_(this,dt)[t])===t},Dn=function(t){var o;let e=_(this,Dt),r=_(this,dt)[e],s=_(this,X)[e];return _(this,ar)&&B(this,A,ct).call(this,s)?s.__abortController.abort(new Error("evicted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((o=_(this,ge))==null||o.call(this,s,r,"evict")),_(this,Ht)&&_(this,Lt)?.push([s,r,"evict"])),_(this,Gr).call(this,e),t&&(_(this,dt)[e]=void 0,_(this,X)[e]=void 0,_(this,ye).push(e)),_(this,Mt)===1?(V(this,Dt,V(this,It,0)),_(this,ye).length=0):V(this,Dt,_(this,Wt)[e]),_(this,St).delete(r),Xs(this,Mt)._--,e},Un=function(t,e,r,s){let o=e===void 0?void 0:_(this,X)[e];if(B(this,A,ct).call(this,o))return o;let n=new Nn,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:r,context:s},h=(b,m=false)=>{let{aborted:p}=n.signal,y=r.ignoreFetchAbort&&b!==void 0;if(r.status&&(p&&!m?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,y&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!y&&!m)return c(n.signal.reason);let v=d;return _(this,X)[e]===d&&(b===void 0?v.__staleWhileFetching?_(this,X)[e]=v.__staleWhileFetching:B(this,A,nr).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,b,l.options))),b},u=b=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=b),c(b)),c=b=>{let{aborted:m}=n.signal,p=m&&r.allowStaleOnFetchAbort,y=p||r.allowStaleOnFetchRejection,v=y||r.noDeleteOnFetchRejection,S=d;if(_(this,X)[e]===d&&(!v||S.__staleWhileFetching===void 0?B(this,A,nr).call(this,t,"fetch"):p||(_(this,X)[e]=S.__staleWhileFetching)),y)return r.status&&S.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),S.__staleWhileFetching;if(S.__returned===S)throw b},f=(b,m)=>{var y;let p=(y=_(this,bi))==null?void 0:y.call(this,t,o,l);p&&p instanceof Promise&&p.then(v=>b(v===void 0?void 0:v),m),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=v=>h(v,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(h,u),x=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,x,{...l.options,status:void 0}),e=_(this,St).get(t)):_(this,X)[e]=x,x},ct=function(t){if(!_(this,ar))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Nn},Oh=function(t,e){_(this,ee)[e]=t,_(this,Wt)[t]=e;},Os=function(t){t!==_(this,It)&&(t===_(this,Dt)?V(this,Dt,_(this,Wt)[t]):B(this,A,Oh).call(this,_(this,ee)[t],_(this,Wt)[t]),B(this,A,Oh).call(this,_(this,It),t),V(this,It,t));},nr=function(t,e){var s,o;let r=false;if(_(this,Mt)!==0){let n=_(this,St).get(t);if(n!==void 0)if(r=true,_(this,Mt)===1)B(this,A,Dh).call(this,e);else {_(this,Gr).call(this,n);let a=_(this,X)[n];if(B(this,A,ct).call(this,a)?a.__abortController.abort(new Error("deleted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((s=_(this,ge))==null||s.call(this,a,t,e)),_(this,Ht)&&_(this,Lt)?.push([a,t,e])),_(this,St).delete(t),_(this,dt)[n]=void 0,_(this,X)[n]=void 0,n===_(this,It))V(this,It,_(this,ee)[n]);else if(n===_(this,Dt))V(this,Dt,_(this,Wt)[n]);else {let l=_(this,ee)[n];_(this,Wt)[l]=_(this,Wt)[n];let h=_(this,Wt)[n];_(this,ee)[h]=_(this,ee)[n];}Xs(this,Mt)._--,_(this,ye).push(n);}}if(_(this,Ht)&&_(this,Lt)?.length){let n=_(this,Lt),a;for(;a=n?.shift();)(o=_(this,xe))==null||o.call(this,...a);}return r},Dh=function(t){var e,r;for(let s of B(this,A,or).call(this,{allowStale:true})){let o=_(this,X)[s];if(B(this,A,ct).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=_(this,dt)[s];_(this,Se)&&((e=_(this,ge))==null||e.call(this,o,n,t)),_(this,Ht)&&_(this,Lt)?.push([o,n,t]);}}if(_(this,St).clear(),_(this,X).fill(void 0),_(this,dt).fill(void 0),_(this,re)&&_(this,ve)&&(_(this,re).fill(0),_(this,ve).fill(0)),_(this,be)&&_(this,be).fill(0),V(this,Dt,0),V(this,It,0),_(this,ye).length=0,V(this,_e,0),V(this,Mt,0),_(this,Ht)&&_(this,Lt)){let s=_(this,Lt),o;for(;o=s?.shift();)(r=_(this,xe))==null||r.call(this,...o);}};var zn=Uh;var wi=class{constructor(t){M(this,"cache");M(this,"map",new Map);this.cache=new zn({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ns=new wi({cacheSize:10}),Nh;(s=>{function i(o){let n=Ns.get(o);if(!n){k.error(`Label "${o}" not found`);return}return n}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}Ns.has(o.id)&&k.info(`Label "${o.id}" already exists, it will be overwritten`),Ns.set(o.id,o);}s.add=t;function e(){return Array.from(Ns.values())}s.values=e;function r(o){return Ns.has(o)}s.has=r;})(Nh||(Nh={}));var se=Nh;var Ax=$n(Ex());var Ci=class{constructor(t,e){M(this,"_id");M(this,"_onStepStart");M(this,"_onLoadingLabel");M(this,"_onStepEnd");this._id=t,this._onStepStart=e?.onStepStart,this._onLoadingLabel=e?.onLoadingLabel,this._onStepEnd=e?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(t,e)=>{if(this._onLoadingLabel&&t===0&&await this._onLoadingLabel(t,e),this._onStepStart)return await this._onStepStart(t,e)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var lr=class extends Ci{constructor(e,r,s){super(e,s);M(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e){if(e<0||e>=this.steps.length)return k.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[e];return (0,Ax.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return k.warn("stepSha not found, setting to ERROR",r),"error"}}};var lb="__close-label-id__";function zh(){return new lr(lb,[],{})}var Pi=class{constructor(t,e,r,s){M(this,"text");M(this,"_label");M(this,"type");M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{type:o="call",oneTime:n=false,onlyHaveNoChoice:a=false,autoSelect:l=false,...h}=s||{};this.text=t,this._label=e,this.type=o,this.oneTime=n,this.onlyHaveNoChoice=a,this.autoSelect=l,this.devProps=h,this.props=r;}get label(){let t=this._label;if(typeof t=="string"){let e=se.get(t);e?t=e:(k.error(`Label ${t} not found, so it will be closed`),t=zh());}return t}};function hb(i,t,e,r){let s=typeof t=="string"?t:t.id;return {...r,label:s,props:e,text:i,type:r?.type||"call"}}var Mi="close";var Ei=class{constructor(t,e){M(this,"text");M(this,"closeCurrentLabel");M(this,"type",Mi);M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{closeCurrentLabel:r=false,oneTime:s=false,onlyHaveNoChoice:o=false,autoSelect:n=false,...a}=e||{};this.text=t,this.closeCurrentLabel=r,this.oneTime=s,this.onlyHaveNoChoice=o,this.autoSelect=n,this.devProps=a;}};function ub(i,t){return {...t,type:Mi,text:i}}var O=class O{constructor(){}static get allOpenedLabels(){return H.getVariable(Q.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(t){H.setVariable(Q.OPENED_LABELS_COUNTER_KEY,t);}static getCurrentStepTimesCounterData(t=""){let e=O.currentLabelStepIndex;if(e===null)return k.error("currentLabelStepIndex is null"),null;let r=`${e}${t}`,s=O.currentLabelId,o=O._currentLabel;if(!s||e===null||!o)return k.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let n=o.getStepSha(e)||"error",a=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return a[s]||(a[s]={}),(!a[s][r]||a[s][r].stepSha1!=n)&&(a[s][r]={stepSha1:n}),a[s][r]}static setCurrentStepTimesCounterData(t="",e){let r=O.currentLabelStepIndex,s=r+t,o=O.currentLabelId;if(!o||r===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let n=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};n[o]||(n[o]={}),n[o][s]=e,H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,n);}static getCurrentStepTimesCounter(t=""){let e=O._stepCounter,r=O.getCurrentStepTimesCounterData(t);if(!r)return k.error("getCurrentStepTimesCounter obj is null"),0;let s=r.stepCounters||r.lastStepIndexs||[];return s.find(n=>n===e)||(s.push(e),delete r.lastStepIndexs,r.stepCounters=s,O.setCurrentStepTimesCounterData(t,r)),s.length}static getRandomNumber(t,e,r={}){let s=r.nestedId||"";if(r.onceOnly||false){let n=O.getCurrentStepTimesCounterData(s);if(!n)return;let a=n.usedRandomNumbers||{},l=Array.from({length:e-t+1},(c,f)=>f+t).filter(c=>!a[`${t}-${e}`]?.includes(c));if(l.length===0)return;let h=Math.floor(Math.random()*l.length),u=l[h];return a[`${t}-${e}`]||(a[`${t}-${e}`]=[]),a[`${t}-${e}`].push(u),n.usedRandomNumbers=a,O.setCurrentStepTimesCounterData(s,n),u}return Math.floor(Math.random()*(e-t+1))+t}static resetCurrentStepTimesCounter(t=""){let e=O.currentLabelStepIndex,r=e+t,s=O.currentLabelId;if(!s||e===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let o=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][r]={stepCounters:[],stepSha1:""},H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return H.getVariable(Q.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(t){H.setVariable(Q.ALL_CHOICES_MADE_KEY,t);}static increaseStepCounter(){O._stepCounter++;}static get openedLabels(){return ke(O._openedLabels)}static set openedLabels(t){O._openedLabels=ke(t);}static get originalOpenedLabels(){return ke(O._originalOpenedLabels)}static set originalOpenedLabels(t){O._originalOpenedLabels=ke(t);}static get _currentLabel(){if(O.currentLabelId)return se.get(O.currentLabelId)}static get currentLabelId(){if(O._openedLabels.length>0)return O._openedLabels[O._openedLabels.length-1].label}static get currentLabelStepIndex(){return O._openedLabels.length>0?O._openedLabels[O._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(t,e){let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;(!s||s<e)&&(r[t]={biggestStep:e,openCount:o},O.allOpenedLabels=r);}static addChoicesMade(t,e,r,s){let o=O.allChoicesMade,n=o.findIndex(a=>a.labelId===t&&a.stepIndex===e&&a.choiceIndex===s&&a.stepSha1===r);n<0?o.push({labelId:t,stepIndex:e,choiceIndex:s,stepSha1:r,madeTimes:1}):o[n].madeTimes++,O.allChoicesMade=o;}static pushNewLabel(t){if(!se.get(t))throw new Error(`[Pixi\u2019VN] Label ${t} not found`);O._openedLabels.push({label:t,currentStepIndex:0});let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;r[t]={biggestStep:s,openCount:o+1},O.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(O._openedLabels.length>0){let t=O._openedLabels[O._openedLabels.length-1];O._openedLabels[O._openedLabels.length-1]={...t,currentStepIndex:t.currentStepIndex+1};}}static set onStepStart(t){O._onStepStart=t;}static get onStepStart(){return async(t,e)=>{let r=[];return O.onLoadingLabel&&t===0&&r.push(O.onLoadingLabel(t,e)),O._onStepStart&&r.push(O._onStepStart(t,e)),await Promise.all(r)}}};M(O,"stepsRunning",0),M(O,"goNextRequests",0),M(O,"choiceMadeTemp"),M(O,"lastHistoryStep",null),M(O,"_stepCounter",0),M(O,"_openedLabels",[]),M(O,"_originalOpenedLabels",[]),M(O,"_onStepStart"),M(O,"onLoadingLabel"),M(O,"onStepEnd");var I=O;var zs=class{get currentStepTimesCounter(){return I.getCurrentStepTimesCounter()}set currentStepTimesCounter(t){I.resetCurrentStepTimesCounter();}getRandomNumber(t,e,r={}){return I.getRandomNumber(t,e,r)}get stepCounter(){return I._stepCounter}get openedLabels(){return I.openedLabels}get currentLabel(){return I._currentLabel}addStepHistory(t,e={}){let{choiceMade:r,ignoreSameStep:s}=e,o,n,a,l=H.getVariable(Q.LAST_STEP_GLUED)===this.stepCounter;H.getVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY)),H.getVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(n=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY)),H.getVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY));let h=I.openedLabels,u={currentLabel:I.currentLabelId,dialogue:o,choices:n,stepSha1:t,index:this.stepCounter,labelStepIndex:I.currentLabelStepIndex,choiceIndexMade:r,inputValue:a,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:l,openedLabels:h};I.originalOpenedLabels=h,H.addHistoryItem(u,{ignoreSameStep:s}),I.lastHistoryStep=u,I.increaseStepCounter();}closeCurrentLabel(){if(!I.currentLabelId){k.warn("No label to close");return}if(!this.currentLabel){k.error("currentLabel not found");return}let t=I.openedLabels;t.pop(),I.openedLabels=t,H.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;I.openedLabels.length>0;)this.closeCurrentLabel(),H.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(t){let e;typeof t=="string"?e=t:e=t.id;let s=I.allOpenedLabels[e]?.biggestStep||0;if(s){let o=se.get(e);if(o)return o.stepCount<=s}return false}get alreadyCurrentStepMadeChoicesObj(){let t=I.currentLabelStepIndex,e=this.currentLabel;if(t===null||!e)return;let r=e.getStepSha(t);return r||(k.warn("stepSha not found, setting to ERROR"),r="error"),I.allChoicesMade.filter(s=>s.labelId===e?.id&&s.stepIndex===t&&s.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(t=>t.choiceIndex)}get isCurrentStepAlreadyOpened(){let t=I.currentLabelId;if(t){let e=I.allOpenedLabels[t]?.openCount||0;if(I.currentLabelStepIndex&&e>=I.currentLabelStepIndex)return true}return false}getTimesLabelOpened(t){return I.allOpenedLabels[t]?.openCount||0}getTimesChoiceMade(t){return this.alreadyCurrentStepMadeChoicesObj?.find(e=>e.choiceIndex===t)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanGoNext(t){let e=t?.showWarn||false,r=this.choiceMenuOptions;return r&&r.length>0?(e&&k.warn("The player must make a choice"),false):this.isRequiredInput?(e&&k.warn("The player must enter a value"),false):true}get canGoNext(){return I.stepsRunning!==0?false:this.getCanGoNext()}async onStepRun(t,e){let r=[];return t.onStepStart&&r.push(t.onStepStart(e,t)),I.onStepStart&&r.push(I.onStepStart(e,t)),await Promise.all(r)}async onStepEnd(t,e){let r=[];return t.onStepEnd&&r.push(t.onStepEnd(e,t)),I.onStepEnd&&r.push(I.onStepEnd(e,t)),await Promise.all(r)}async goNext(t,e={}){let{runNow:r=false}=e;if(!(!r&&!this.getCanGoNext({showWarn:true}))){if(!r&&I.stepsRunning!==0){I.goNextRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(s){k.error("Error running onStepEnd",s);}return I.stepsRunning===0&&await H.onGoNextEnd(),I.increaseCurrentStepIndex(),await this.runCurrentStep(t,e)}}async runCurrentStep(t,e={}){let{choiceMade:r}=e;if(I.currentLabelId){let s=I.currentLabelStepIndex;if(s===null){k.error("currentLabelStepIndex is null");return}let o=I._currentLabel;if(!o){k.error("currentLabel not found");return}if(o.stepCount>s){try{await this.onStepRun(o,s);}catch(l){k.error("Error running onStepStart",l),this.onStepError&&this.onStepError(l,t);return}let n=o.getStepById(s);if(!n){k.error("step not found");return}let a=o.getStepSha(s);a||(k.warn("stepSha not found, setting to ERROR"),a="error");try{I.stepsRunning++;let l=await n(t,{labelId:o.id}),h=this.choiceMenuOptions;if(h?.length===1&&h[0].autoSelect){let c=h[0];l=await this.selectChoice(c,t);}let u=I.lastHistoryStep;if(r!==void 0&&u){let c=u.stepSha1;c||(k.warn("stepSha not found, setting to ERROR"),c="error"),I.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",r),I.choiceMadeTemp=r;}return I.stepsRunning--,I.stepsRunning===0&&(I.addLabelHistory(o.id,s),this.addStepHistory(a,{...e,choiceMade:I.choiceMadeTemp}),I.choiceMadeTemp=void 0,I.goNextRequests>0)?(I.goNextRequests--,await this.goNext(t)):l}catch(l){I.stepsRunning>0&&I.stepsRunning--,k.error("Error running step",l),this.onStepError&&this.onStepError(l,t);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.goNext(t,e);if(this.openedLabels.length===1)return I.openedLabels=[],this.onGameEnd?await this.onGameEnd(t,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(I.openedLabels=I.originalOpenedLabels,this.onGameEnd)return await this.onGameEnd(t,{labelId:"end"});k.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else k.error("currentLabelId not found");}async callLabel(t,e,r){let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error calling label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async jumpLabel(t,e,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error jumping label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async selectChoice(t,e){this.choiceMenuOptions=void 0;let r=t.type;switch(r){case "call":return await this.callLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "jump":return await this.jumpLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "close":return await this.closeChoiceMenu(t,{...t.props,...e});default:throw k.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(t,e){if(t.type!=="close")throw k.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof t.choiceIndex=="number"&&(r=t.choiceIndex),t.closeCurrentLabel&&this.closeCurrentLabel(),this.goNext(e,{choiceMade:r})}get onGameEnd(){return H.onEnd}set onGameEnd(t){H.onEnd=t;}get onStepError(){let t=H.onError;return t?(e,r)=>t("step",e,r):void 0}set onStepError(t){H.onError=(e,r,s)=>t(r,s);}get dialogue(){let t=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(t)return {...t,character:t.character?H.getCharacter(t.character)||t.character:void 0}}set dialogue(t){if(!t){H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof t=="string"||Array.isArray(t))&&(t={text:t}),this.dialogGlue){let e=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(e){let r=[];Array.isArray(e.text)?r=[...e.text]:r=[e.text],Array.isArray(t.text)?r=[...r,...t.text]:r=[...r,t.text],t.text=r,t.character=t.character||e.character;}H.setVariable(Q.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,ke({...t,character:typeof t.character=="string"?t.character:t.character?.id})),H.setVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(e){throw k.error("DialogueInterface cannot contain functions or classes"),e}}get choiceMenuOptions(){let t=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(t){let e=[],r=t.map((o,n)=>({...o,choiceIndex:n})),s=this.alreadyCurrentStepMadeChoices;if(r=r.filter((o,n)=>o.oneTime&&s&&s.includes(n)?false:o.onlyHaveNoChoice?(e.push(o),false):true),r.length>0)return r;if(e.length>0)return [e[0]]}}set choiceMenuOptions(t){if(!t||t.length===0){H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}let e=t.map(r=>r instanceof Ei?{...r.devProps,text:r.text,type:Mi,closeCurrentLabel:r.closeCurrentLabel,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,autoSelect:r.autoSelect,props:r.props}:r instanceof Pi?{...r.devProps,type:r.type,text:r.text,label:r.label.id,autoSelect:r.autoSelect,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,props:r.props}:r);try{H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,ke(e)),H.setVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(r){throw k.error("ChoiceInterface cannot contain functions or classes"),r}}get dialogGlue(){return H.getFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(t){H.setFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,t);}get inputValue(){return H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(t){this.removeInputRequest(),H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,t),H.setVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(t,e){t.isRequired=true,H.setVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY,t),e!==void 0?H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,e):H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){H.removeVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY),H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){I.openedLabels=[],I._stepCounter=0;}export(){return {openedLabels:ke(I.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(t){let e=this.openedLabels.map(async r=>{let s=[],o=se.get(r.label);return o&&(o.onLoadingLabel&&s.push(o.onLoadingLabel(t,o)),I.onLoadingLabel&&s.push(I.onLoadingLabel(t,o))),await Promise.all(s)});return await Promise.all(e)}async restore(t,e){this.clear();try{I.lastHistoryStep=e,t.hasOwnProperty("openedLabels")?(I.openedLabels=t.openedLabels,I.originalOpenedLabels=I.openedLabels):k.warn("Could not import openedLabels data, so will be ignored"),t.hasOwnProperty("stepCounter")?I._stepCounter=t.stepCounter:t.hasOwnProperty("lastStepIndex")?I._stepCounter=t.lastStepIndex:k.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(I.currentLabelStepIndex||0);}catch(r){k.error("Error running onLoadingLabel",r);}}catch(r){k.error("Error importing data",r);}}};function Ix(i,t,e){let r=new lr(i,t,e);return se.add(r),r}var MO=new zs;
571
+ `}};});var Th,wh,Rn,Vg=g(()=>{ut();Vo();Dg();Xo();as();Qe();Ft();zg();Rn=class extends Le{constructor(){Th??(Th=Qr({name:"tiling-sprite-shader",bits:[Es,Ug,ti]})),wh??(wh=Jr({name:"tiling-sprite-shader",bits:[Og,Ng,ei]}));let t=new Vt({uMapCoord:{value:new F,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new F,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:wh,gpuProgram:Th,resources:{localUniforms:new Vt({uTransformMatrix:{value:new F,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:U.EMPTY.source,uSampler:U.EMPTY.source.style}});}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,l=n.width,h=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*l/t,r.b*l/e,r.c*h/t,r.d*h/e,r.tx/t,r.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var Fn,Wg=g(()=>{Ln();Fn=class extends pi{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function Hg(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height;}var Yg=g(()=>{});function $g(i,t,e,r){let s=0,o=i.length/(t),n=r.a,a=r.b,l=r.c,h=r.d,u=r.tx,c=r.ty;for(e*=t;s<o;){let f=i[e],d=i[e+1];i[e]=n*f+l*d+u,i[e+1]=a*f+h*d+c,e+=t,s++;}}var Xg=g(()=>{});function jg(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=F.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),$g(t,2,0,a);}var Kg=g(()=>{ut();Xg();});var Bn,Ch,As,qg=g(()=>{N();is();rn();ns();ds();sn();Ln();Vg();Wg();Yg();Kg();Bn=new Fn,Ch=class{constructor(){this.canBatch=true,this.geometry=new pi({indices:Bn.indices.slice(),positions:Bn.positions.slice(),uvs:Bn.uvs.slice()});}destroy(){this.geometry.destroy(),this.shader?.destroy();}},As=class{constructor(t){this._state=Cr.default2d,this._renderer=t;}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new tr);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e);}else r.break(e),s.shader||(s.shader=new Rn),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Je(t.groupColorAlpha,r.uColor,0),this._state.blendMode=ze(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Bn,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ch;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),jg(t,r.uvs),Hg(t,r.positions);}destroy(){this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=true;return this._renderer.type===Ie.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};As.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"tilingSprite"};});var Ph=g(()=>{N();qg();W.add(As);});var Zg,Jg,tx=g(()=>{_t();Ln();Zg=class Qg extends pi{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(D(Z,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e);}build(t){t={...Qg.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,h=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;r.push(f*l,d*h),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,x=d*this.verticesX+f,b=d*this.verticesX+f+1,m=(d+1)*this.verticesX+f,p=(d+1)*this.verticesX+f+1;o.push(x,b,m,b,p,m);}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};Zg.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};Jg=Zg;});var ex,ix,sx=g(()=>{tx();ex=class rx extends Jg{constructor(t={}){t={...rx.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:h}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=r>f?1:r/f,x=Math.min(c,d),b=l*e,m=h*r;t[0]=t[8]=t[16]=t[24]=-b,t[2]=t[10]=t[18]=t[26]=s*x-b,t[4]=t[12]=t[20]=t[28]=e-o*x-b,t[6]=t[14]=t[22]=t[30]=e-b,t[1]=t[3]=t[5]=t[7]=-m,t[9]=t[11]=t[13]=t[15]=n*x-m,t[17]=t[19]=t[21]=t[23]=r-a*x-m,t[25]=t[27]=t[29]=t[31]=r-m,this.getBuffer("aPosition").update();}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update();}};ex.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};ix=ex;});var Mh,Is,ox=g(()=>{N();sn();sx();Mh=class extends tr{constructor(){super(),this.geometry=new ix;}destroy(){this.geometry.destroy();}},Is=class{constructor(t){this._renderer=t;}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e);}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=t._gpuData[this._renderer.uid]=new Mh,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._renderer=null;}};Is.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"nineSliceSprite"};});var Eh=g(()=>{N();ox();W.add(Is);});var Ls,nx=g(()=>{N();Ls=class{constructor(t){this._renderer=t;}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Ls.extension={type:[C.WebGLPipes,C.WebGPUPipes,C.CanvasPipes],name:"filter"};});function ax(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var lx=g(()=>{});var Qy,Ah,Rs,hx=g(()=>{N();ut();rs();os();Qe();Ft();Nr();ns();ce();lx();Gt();Qy=new Ae({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ah=class{constructor(){this.skip=false,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new mt,this.container=null,this.blendRequired=false,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0};}},Rs=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Vt({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new le({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,s=this._pushFilterData();s.skip=false,s.filters=r,s.container=t.container,s.outputRenderSurface=e.renderTarget.renderSurface;let o=e.renderTarget.renderTarget.colorTexture.source,n=o.resolution,a=o.antialias;if(r.length===0){s.skip=true;return}let l=s.bounds;if(this._calculateFilterArea(t,l),this._calculateFilterBounds(s,e.renderTarget.rootViewPort,a,n,1),s.skip)return;let h=this._getPreviousFilterData(),u=this._findFilterResolution(n),c=0,f=0;h&&(c=h.bounds.minX,f=h.bounds.minY),this._calculateGlobalFrame(s,c,f,u,o.width,o.height),this._setupFilterTextures(s,l,e,h);}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=false,r.filters=e;let s=t.source,o=s.resolution,n=s.antialias;if(e.length===0)return r.skip=true,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,n,o,0),r.skip)return t;let l=o;this._calculateGlobalFrame(r,0,0,l,s.width,s.height),r.outputRenderSurface=Ot.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=U.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,true);let f=r.outputRenderSurface;return f.source.alphaMode="premultiplied-alpha",f}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,false),e.blendRequired&&Ot.returnTexture(e.backTexture),Ot.returnTexture(e.inputTexture));}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Ot.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let l=Math.ceil(e.width*s),h=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:l,height:h},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._activeFilterData,l=n.outputRenderSurface===r,h=o.renderTarget.rootRenderTarget.colorTexture.source._resolution,u=this._findFilterResolution(h),c=0,f=0;if(l){let d=this._findPreviousFilterOffset();c=d.x,f=d.y;}this._updateFilterUniforms(e,r,n,c,f,u,l,s),this._setupBindGroupsAndRender(t,e,o);}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(F.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}destroy(){}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let s=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(s,0);}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:Qy,shader:t,state:t._state,topology:"triangle-list"}),r.type===Ie.WEBGL&&r.renderTarget.finishRenderPass();}_setupFilterTextures(t,e,r,s){if(t.backTexture=U.EMPTY,t.blendRequired){r.renderTarget.finishRenderPass();let o=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(o,e,s?.bounds);}t.inputTexture=Ot.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),r.renderTarget.bind(t.inputTexture,true),r.globalUniforms.push({offset:e});}_calculateGlobalFrame(t,e,r,s,o,n){let a=t.globalFrame;a.x=e*s,a.y=r*s,a.width=o*s,a.height=n*s;}_updateFilterUniforms(t,e,r,s,o,n,a,l){let h=this._filterGlobalUniforms.uniforms,u=h.uOutputFrame,c=h.uInputSize,f=h.uInputPixel,d=h.uInputClamp,x=h.uGlobalFrame,b=h.uOutputTexture;a?(u[0]=r.bounds.minX-s,u[1]=r.bounds.minY-o):(u[0]=0,u[1]=0),u[2]=t.frame.width,u[3]=t.frame.height,c[0]=t.source.width,c[1]=t.source.height,c[2]=1/c[0],c[3]=1/c[1],f[0]=t.source.pixelWidth,f[1]=t.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],d[0]=.5*f[2],d[1]=.5*f[3],d[2]=t.frame.width*c[2]-.5*f[2],d[3]=t.frame.height*c[3]-.5*f[3];let m=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=s*n,x[1]=o*n,x[2]=m.source.width*n,x[3]=m.source.height*n,e instanceof U&&(e.source.resource=null);let p=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!l),e instanceof U?(b[0]=e.frame.width,b[1]=e.frame.height):(b[0]=p.width,b[1]=p.height),b[2]=p.isRoot?-1:1,this._filterGlobalUniforms.update();}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let s=this._filterStack[r];if(!s.skip){t=s.bounds.minX,e=s.bounds.minY;break}}return {x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?ax(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,e),t.container){let s=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;s&&e.applyMatrix(s);}}_applyFiltersToTexture(t,e){let r=t.inputTexture,s=t.bounds,o=t.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),o.length===1)o[0].apply(this,r,t.outputRenderSurface,e);else {let n=t.inputTexture,a=Ot.getOptimalTexture(s.width,s.height,n.source._resolution,false),l=a,h=0;for(h=0;h<o.length-1;++h){o[h].apply(this,n,l,true);let c=n;n=l,l=c;}o[h].apply(this,n,t.outputRenderSurface,e),Ot.returnTexture(a);}}_calculateFilterBounds(t,e,r,s,o){let n=this.renderer,a=t.bounds,l=t.filters,h=1/0,u=0,c=true,f=false,d=false,x=true;for(let b=0;b<l.length;b++){let m=l[b];if(h=Math.min(h,m.resolution==="inherit"?s:m.resolution),u+=m.padding,m.antialias==="off"?c=false:m.antialias==="inherit"&&c&&(c=r),m.clipToViewport||(x=false),!!!(m.compatibleRenderers&n.type)){d=false;break}if(m.blendRequired&&!(n.backBuffer?.useBackBuffer??true)){K("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),d=false;break}d=m.enabled||d,f||(f=m.blendRequired);}if(!d){t.skip=true;return}if(x&&a.fitBounds(0,e.width/s,0,e.height/s),a.scale(h).ceil().scale(1/h).pad((u|0)*o),!a.isPositive){t.skip=true;return}t.antialias=c,t.resolution=h,t.blendRequired=f;}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>1&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new Ah),this._filterStackIndex++,t}};Rs.extension={type:[C.WebGLSystem,C.WebGPUSystem],name:"filter"};});var Ih=g(()=>{N();nx();hx();W.add(Rs);W.add(Ls);});var Jy={};var ux=g(()=>{Lc();Ea();Uc();zc();Co();Lo();Ol();Dl();Vl();dh();yh();Sh();Ph();Eh();Ih();});var tb={};var dx=g(()=>{Ea();Co();Lo();Ol();Dl();Vl();dh();yh();Sh();Ph();Eh();Ih();});var Px=$s((Vn,Cx)=>{(function(i,t){typeof Vn=="object"?Cx.exports=Vn=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(Vn,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof Yn=="function")try{r=Yn("crypto");}catch{}var s=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(y){var v;return p.prototype=y,v=new p,p.prototype=null,v}}(),n={},a=n.lib={},l=a.Base=function(){return {extend:function(p){var y=o(this);return p&&y.mixIn(p),(!y.hasOwnProperty("init")||this.init===y.init)&&(y.init=function(){y.$super.init.apply(this,arguments);}),y.init.prototype=y,y.$super=this,y},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var y in p)p.hasOwnProperty(y)&&(this[y]=p[y]);p.hasOwnProperty("toString")&&(this.toString=p.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),h=a.WordArray=l.extend({init:function(p,y){p=this.words=p||[],y!=e?this.sigBytes=y:this.sigBytes=p.length*4;},toString:function(p){return (p||c).stringify(this)},concat:function(p){var y=this.words,v=p.words,S=this.sigBytes,P=p.sigBytes;if(this.clamp(),S%4)for(var T=0;T<P;T++){var w=v[T>>>2]>>>24-T%4*8&255;y[S+T>>>2]|=w<<24-(S+T)%4*8;}else for(var G=0;G<P;G+=4)y[S+G>>>2]=v[G>>>2];return this.sigBytes+=P,this},clamp:function(){var p=this.words,y=this.sigBytes;p[y>>>2]&=4294967295<<32-y%4*8,p.length=t.ceil(y/4);},clone:function(){var p=l.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var y=[],v=0;v<p;v+=4)y.push(s());return new h.init(y,p)}}),u=n.enc={},c=u.Hex={stringify:function(p){for(var y=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=y[P>>>2]>>>24-P%4*8&255;S.push((T>>>4).toString(16)),S.push((T&15).toString(16));}return S.join("")},parse:function(p){for(var y=p.length,v=[],S=0;S<y;S+=2)v[S>>>3]|=parseInt(p.substr(S,2),16)<<24-S%8*4;return new h.init(v,y/2)}},f=u.Latin1={stringify:function(p){for(var y=p.words,v=p.sigBytes,S=[],P=0;P<v;P++){var T=y[P>>>2]>>>24-P%4*8&255;S.push(String.fromCharCode(T));}return S.join("")},parse:function(p){for(var y=p.length,v=[],S=0;S<y;S++)v[S>>>2]|=(p.charCodeAt(S)&255)<<24-S%4*8;return new h.init(v,y)}},d=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(f.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return f.parse(unescape(encodeURIComponent(p)))}},x=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(p){typeof p=="string"&&(p=d.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes;},_process:function(p){var y,v=this._data,S=v.words,P=v.sigBytes,T=this.blockSize,w=T*4,G=P/w;p?G=t.ceil(G):G=t.max((G|0)-this._minBufferSize,0);var E=G*T,L=t.min(E*4,P);if(E){for(var R=0;R<E;R+=T)this._doProcessBlock(S,R);y=S.splice(0,E),v.sigBytes-=L;}return new h.init(y,L)},clone:function(){var p=l.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});a.Hasher=x.extend({cfg:l.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var y=this._doFinalize();return y},blockSize:512/32,_createHelper:function(p){return function(y,v){return new p.init(v).finalize(y)}},_createHmacHelper:function(p){return function(y,v){return new m.HMAC.init(p,v).finalize(y)}}});var m=n.algo={};return n}(Math);return i});});var Ex=$s((Wn,Mx)=>{(function(i,t){typeof Wn=="object"?Mx.exports=Wn=t(Px()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(Wn,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,s=e.Hasher,o=t.algo,n=[],a=o.SHA1=s.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,h){for(var u=this._hash.words,c=u[0],f=u[1],d=u[2],x=u[3],b=u[4],m=0;m<80;m++){if(m<16)n[m]=l[h+m]|0;else {var p=n[m-3]^n[m-8]^n[m-14]^n[m-16];n[m]=p<<1|p>>>31;}var y=(c<<5|c>>>27)+b+n[m];m<20?y+=(f&d|~f&x)+1518500249:m<40?y+=(f^d^x)+1859775393:m<60?y+=(f&d|f&x|d&x)-1894007588:y+=(f^d^x)-899497514,b=x,x=d,d=f<<30|f>>>2,f=c,c=y;}u[0]=u[0]+c|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+x|0,u[4]=u[4]+b|0;},_doFinalize:function(){var l=this._data,h=l.words,u=this._nDataBytes*8,c=l.sigBytes*8;return h[c>>>5]|=128<<24-c%32,h[(c+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(c+64>>>9<<4)+15]=u,l.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var l=s.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=s._createHelper(a),t.HmacSHA1=s._createHmacHelper(a);}(),i.SHA1});});var Te={};Nx(Te,{DistortionFilter:()=>js,EqualizerFilter:()=>oe,Filter:()=>Tt,MonoFilter:()=>Ks,ReverbFilter:()=>qs,StereoFilter:()=>Zs,StreamFilter:()=>Qs,TelephoneFilter:()=>Js});var Xh;function jh(i){return Xh=i,i}function nt(){return Xh}var Tt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var js=class extends Tt{constructor(t=0){let e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,nt().useLegacy)return;let e=t*1e3,r=44100,s=new Float32Array(r),o=Math.PI/180,n=0,a;for(;n<r;++n)a=n*2/r-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var yt=class{static setParamValue(t,e){if(t.setValueAtTime){let r=nt().context;t.setValueAtTime(e,r.audioContext.currentTime);}else t.value=e;return e}};var at=class extends Tt{constructor(i=0,t=0,e=0,r=0,s=0,o=0,n=0,a=0,l=0,h=0){let u=[],c=[{f:at.F32,type:"lowshelf",gain:i},{f:at.F64,type:"peaking",gain:t},{f:at.F125,type:"peaking",gain:e},{f:at.F250,type:"peaking",gain:r},{f:at.F500,type:"peaking",gain:s},{f:at.F1K,type:"peaking",gain:o},{f:at.F2K,type:"peaking",gain:n},{f:at.F4K,type:"peaking",gain:a},{f:at.F8K,type:"peaking",gain:l},{f:at.F16K,type:"highshelf",gain:h}];nt().useLegacy||(u=c.map(f=>{let d=nt().context.audioContext.createBiquadFilter();return d.type=f.type,yt.setParamValue(d.Q,1),d.frequency.value=f.f,yt.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(i,t=0){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);yt.setParamValue(this.bandsMap[i].gain,t);}getGain(i){if(!this.bandsMap[i])throw new Error(`No band found for frequency ${i}`);return this.bandsMap[i].gain.value}set f32(i){this.setGain(at.F32,i);}get f32(){return this.getGain(at.F32)}set f64(i){this.setGain(at.F64,i);}get f64(){return this.getGain(at.F64)}set f125(i){this.setGain(at.F125,i);}get f125(){return this.getGain(at.F125)}set f250(i){this.setGain(at.F250,i);}get f250(){return this.getGain(at.F250)}set f500(i){this.setGain(at.F500,i);}get f500(){return this.getGain(at.F500)}set f1k(i){this.setGain(at.F1K,i);}get f1k(){return this.getGain(at.F1K)}set f2k(i){this.setGain(at.F2K,i);}get f2k(){return this.getGain(at.F2K)}set f4k(i){this.setGain(at.F4K,i);}get f4k(){return this.getGain(at.F4K)}set f8k(i){this.setGain(at.F8K,i);}get f8k(){return this.getGain(at.F8K)}set f16k(i){this.setGain(at.F16K,i);}get f16k(){return this.getGain(at.F16K)}reset(){this.bands.forEach(i=>{yt.setParamValue(i.gain,0);});}destroy(){this.bands.forEach(i=>{i.disconnect();}),this.bands=null,this.bandsMap=null;}},oe=at;oe.F32=32;oe.F64=64;oe.F125=125;oe.F250=250;oe.F500=500;oe.F1K=1e3;oe.F2K=2e3;oe.F4K=4e3;oe.F8K=8e3;oe.F16K=16e3;var Ks=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;e=r.createChannelSplitter(),t=r.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var qs=class extends Tt{constructor(t=3,e=2,r=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=r,this._rebuild();}_clamp(t,e,r){return Math.min(r,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(nt().useLegacy)return;let{audioContext:t}=nt().context,e=t.sampleRate,r=e*this._seconds,s=t.createBuffer(2,r,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let h=0;h<r;h++)a=this._reverse?r-h:h,o[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay),n[h]=(Math.random()*2-1)*Math.pow(1-a/r,this._decay);let l=t.createConvolver();l.buffer=s,this.init(l);}};var Zs=class extends Tt{constructor(t=0){let e,r,s;if(!nt().useLegacy){let{audioContext:o}=nt().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(r=o.createPanner(),r.panningModel="equalpower",s=r);}super(s),this._stereo=e,this._panner=r,this.pan=t;}set pan(t){this._pan=t,this._stereo?yt.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Qs=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context;t=r.createMediaStreamDestination(),e=r.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Js=class extends Tt{constructor(){let t,e;if(!nt().useLegacy){let{audioContext:r}=nt().context,s=r.createBiquadFilter(),o=r.createBiquadFilter(),n=r.createBiquadFilter(),a=r.createBiquadFilter();s.type="lowpass",yt.setParamValue(s.frequency,2e3),o.type="lowpass",yt.setParamValue(o.frequency,2e3),n.type="highpass",yt.setParamValue(n.frequency,500),a.type="highpass",yt.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};N();var cx={extension:{type:C.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(ux(),Jy));}};N();var fx={extension:{type:C.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(dx(),tb));}};N();N();Lo();Co();Oa();fe();ja();Hi();Yt();wo();W.add(cx,fx);var Fs=class extends et{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var eb=0,Lh=class extends et{constructor(i){super(),this.id=eb++,this.init(i);}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(i){this._playing=false,this._duration=i.source.duration;let t=this._source=i.source.cloneNode(false);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters");}refresh(){let i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=i.volume*(i.muted?0:1),r=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*r,this._source.playbackRate=this._speed*i.speed*t.speed;}refreshPaused(){let i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(i){let{start:t,end:e,speed:r,loop:s,volume:o,muted:n}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=r,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Lh.PADDING),this._end=Math.min(this._end+Lh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),Pt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){Pt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){Pt.shared.remove(this._onUpdate,this),this.removeAllListeners();let i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},kn=Lh;kn.PADDING=.1;var Bs=class extends et{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new kn(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,r=this.parent;if(e.readyState===4){r.isLoaded=true;let l=r.autoPlayStart();t&&setTimeout(()=>{t(null,r,l);},0);return}if(!r.url){t(new Error("sound.url or sound.source must be set"));return}e.src=r.url;let s=()=>{a(),r.isLoaded=true;let l=r.autoPlayStart();t&&t(null,r,l);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let l=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(l)):console.error(l);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var ks=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var Ar=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Rh=["audio/mpeg","audio/ogg"],Ir={};function px(i){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),r={},s=/^no$/;Ar.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";r[o]=!!n||!!a;}),Object.assign(Ir,r);}px();var ib=0,Gs=class extends et{constructor(t){super(),this.id=ib++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let r=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);yt.setParamValue(this._gain.gain,o*s*r),yt.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,r=this._paused||e.paused||t.paused;r!==this._pausedReal&&(this._pausedReal=r,r?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",r));}play(t){let{start:e,end:r,speed:s,loop:o,volume:n,muted:a,filters:l}=t;r&&console.assert(r>e,"End time is before start time"),this._paused=false;let{source:h,gain:u}=this._media.nodes.cloneBufferSource();this._source=h,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=l,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=r,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=r,this._source.loopStart=e,this._source.start(0,e)):r?this._source.start(0,e,r-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){Pt.shared.remove(this._updateListener,this),t&&Pt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),r=e-this._lastUpdate;if(r>0||t){let s=this._source.playbackRate.value;this._elapsed+=r*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Lr=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(r=>{e===null?this._input.connect(r.destination):e.connect(r.destination),e=r;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var mx=class extends Lr{constructor(i){let t=i.audioContext,e=t.createBufferSource(),r=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(r),r.connect(i.destination),super(s,r),this.context=i,this.bufferSource=e,this.gain=r,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(mx.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,yt.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Gn=mx;Gn.BUFFER_SIZE=0;var Rr=class{init(t){this.parent=t,this._nodes=new Gn(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Gs(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,r=await gt.get().fetch(e);this._decode(await r.arrayBuffer(),t);}_decode(t,e){let r=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?r(null,t):this.parent.context.decode(t,r);}};var mi=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=nt().useLegacy?new Bs:new Rr;return new mi(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(i){let[t]=i.map(e=>({url:e,ext:jt.extname(e).slice(1)})).filter(({ext:e})=>Ir[e]).sort((e,r)=>Ar.indexOf(e.ext)-Ar.indexOf(r.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return nt().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused();}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh();}get filters(){return this.media.filters}set filters(i){this.media.filters=i;}addSprites(i,t){if(typeof i=="object"){let r={};for(let s in i)r[s]=this.addSprites(s,i[s]);return r}console.assert(!this._sprites[i],`Alias ${i} is already taken`);let e=new ks(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(i){if(i){let t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,l)=>{this._preloadQueue.forEach(h=>h()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,l),s(l));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let r=this._createInstance();return this._instances.push(r),this.isPlaying=true,r.once("end",()=>{e.complete&&e.complete(this),this._onComplete(r);}),r.once("stop",()=>{this._onComplete(r);}),r.play(e),r}refresh(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh();}refreshPaused(){let i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh();}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh();}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh();}_preload(i){this.media.load(i);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0;}_onComplete(i){if(this._instances){let t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(i);}_createInstance(){if(mi._pool.length>0){let i=mi._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),mi._pool.indexOf(i)<0&&mi._pool.push(i);}},rr=mi;rr._pool=[];var gi=class i extends Lr{constructor(){let t=window,e=new i.AudioContext,r=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(r),r.connect(e.destination),super(s,r),this.autoPause=true,this._ctx=e,this._offlineCtx=new i.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=r,this.analyser=s,this.events=new et,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let r=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},r);s&&s.catch(r);}};var On=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new gi),this._htmlAudioContext=new Fs,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return gi.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof rr)return this._sounds[t]=e,e;let r=this._getOptions(e),s=rr.from(r);return this._sounds[t]=s,s}_getOptions(t,e){let r;return typeof t=="string"?r={url:t}:Array.isArray(t)?r={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?r={source:t}:r=t,r={...r,...e||{}},r}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let r=!!this._sounds[t];return e&&console.assert(r,`No sound matching alias '${t}'.`),r}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let r=this.find(t);return e!==void 0&&(r.volume=e),r.volume}speed(t,e){let r=this.find(t);return e!==void 0&&(r.speed=e),r.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var gx=i=>{let t=i.src,e=i?.alias?.[0];return (!e||i.src===e)&&(e=jt.basename(t,jt.extname(t))),e},xx={extension:C.Asset,detection:{test:async()=>true,add:async i=>[...i,...Ar.filter(t=>Ir[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{name:"sound",extension:{type:[C.LoadParser],priority:Hr.High},test(i){let t=jt.extname(i).slice(1);return !!Ir[t]||Rh.some(e=>i.startsWith(`data:${e}`))},async load(i,t){let e=await new Promise((r,s)=>rr.from({...t.data,url:i,preload:true,loaded(o,n){o?s(o):r(n),t.data?.loaded?.(o,n);}}));return nt().add(gx(t),e),e},async unload(i,t){nt().remove(gx(t));}}};W.add(xx);jh(new On);({DistortionFilter:Te.DistortionFilter,EqualizerFilter:Te.EqualizerFilter,MonoFilter:Te.MonoFilter,ReverbFilter:Te.ReverbFilter,StereoFilter:Te.StereoFilter,StreamFilter:Te.StreamFilter,TelephoneFilter:Te.TelephoneFilter});var Q={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var k;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(k||(k={}));var Y=class Y{static init(t){Y._getStepCounter=t.getStepCounter,Y._setStepCounter=t.setStepCounter,Y._getCurrentGameStepState=t.getCurrentGameStepState,Y._restoreGameStepState=t.restoreGameStepState,Y._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(Y._onGoNextEnd=t.onGoNextEnd),Y._getVariable=t.getVariable,Y._setVariable=t.setVariable,Y._removeVariable=t.removeVariable,Y._getFlag=t.getFlag,Y._setFlag=t.setFlag,t.onLabelClosing&&(Y._onLabelClosing=t.onLabelClosing),Y._addHistoryItem=t.addHistoryItem,Y._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,Y._getCharacter=t.getCharacter;}static get stepCounter(){return Y._getStepCounter()}static set stepCounter(t){Y._setStepCounter(t);}static get currentGameStepState(){return Y._getCurrentGameStepState()}static get restoreGameStepState(){return Y._restoreGameStepState}static get openedLabels(){return Y._getOpenedLabels()}static get onGoNextEnd(){return Y._onGoNextEnd}static get getVariable(){return Y._getVariable}static get setVariable(){return Y._setVariable}static get removeVariable(){return Y._removeVariable}static get getFlag(){return Y._getFlag}static get setFlag(){return Y._setFlag}static get onLabelClosing(){return Y._onLabelClosing}static get addHistoryItem(){return Y._addHistoryItem}static get currentStepsRunningNumber(){return Y._getCurrentStepsRunningNumber()}static get getCharacter(){return Y._getCharacter}};M(Y,"_getStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setStepCounter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_restoreGameStepState",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getOpenedLabels",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onGoNextEnd",async()=>{}),M(Y,"_getVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_removeVariable",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_setFlag",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_onLabelClosing",()=>{}),M(Y,"_addHistoryItem",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCurrentStepsRunningNumber",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),M(Y,"_getCharacter",()=>{throw k.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),M(Y,"onEnd"),M(Y,"onError");var H=Y;function ke(i){try{if(typeof i>"u")return i;let t=JSON.stringify(i);return JSON.parse(t)}catch(t){throw k.error("Error creating exportable element",i,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var xi=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,vx=new Set,Fh=typeof process=="object"&&process?process:{},Sx=(i,t,e,r)=>{typeof Fh.emitWarning=="function"?Fh.emitWarning(i,t,e,r):console.error(`[${e}] ${t}: ${i}`);},Nn=globalThis.AbortController,_x=globalThis.AbortSignal;if(typeof Nn>"u"){_x=class{constructor(){M(this,"onabort");M(this,"_onabort",[]);M(this,"reason");M(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},Nn=class{constructor(){M(this,"signal",new _x);t();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let i=Fh.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=false,Sx("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var nb=i=>!vx.has(i),ir=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Tx=i=>ir(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?_i:null:null,_i=class extends Array{constructor(t){super(t),this.fill(0);}},yi,Fr=class Fr{constructor(t,e){M(this,"heap");M(this,"length");if(!_(Fr,yi))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Tx(t);if(!e)return [];V(Fr,yi,true);let r=new Fr(t,e);return V(Fr,yi,false),r}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};yi=new WeakMap,tt(Fr,yi,false);var Bh=Fr,yx,bx,me,te,ge,Br,xe,bi,vi,Mt,_e,St,dt,X,Wt,ee,Dt,It,ye,Lt,be,ve,re,Se,ar,Ht,Si,A,kh,kr,Ye,Ds,ie,wx,Gr,Ti,Us,sr,or,Gh,Dn,Un,ct,Oh,Os,nr,Dh,Uh=class Uh{constructor(t){tt(this,A);tt(this,me);tt(this,te);tt(this,ge);tt(this,Br);tt(this,xe);tt(this,bi);tt(this,vi);M(this,"ttl");M(this,"ttlResolution");M(this,"ttlAutopurge");M(this,"updateAgeOnGet");M(this,"updateAgeOnHas");M(this,"allowStale");M(this,"noDisposeOnSet");M(this,"noUpdateTTL");M(this,"maxEntrySize");M(this,"sizeCalculation");M(this,"noDeleteOnFetchRejection");M(this,"noDeleteOnStaleGet");M(this,"allowStaleOnFetchAbort");M(this,"allowStaleOnFetchRejection");M(this,"ignoreFetchAbort");tt(this,Mt);tt(this,_e);tt(this,St);tt(this,dt);tt(this,X);tt(this,Wt);tt(this,ee);tt(this,Dt);tt(this,It);tt(this,ye);tt(this,Lt);tt(this,be);tt(this,ve);tt(this,re);tt(this,Se);tt(this,ar);tt(this,Ht);tt(this,Si);tt(this,kr,()=>{});tt(this,Ye,()=>{});tt(this,Ds,()=>{});tt(this,ie,()=>false);tt(this,Gr,t=>{});tt(this,Ti,(t,e,r)=>{});tt(this,Us,(t,e,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});M(this,yx,"LRUCache");let{max:e=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:l,dispose:h,onInsert:u,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:x=0,maxEntrySize:b=0,sizeCalculation:m,fetchMethod:p,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:T,ignoreFetchAbort:w}=t;if(e!==0&&!ir(e))throw new TypeError("max option must be a nonnegative integer");let G=e?Tx(e):Array;if(!G)throw new Error("invalid max value: "+e);if(V(this,me,e),V(this,te,x),this.maxEntrySize=b||_(this,te),this.sizeCalculation=m,this.sizeCalculation){if(!_(this,te)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(V(this,vi,y),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(V(this,bi,p),V(this,ar,!!p),V(this,St,new Map),V(this,dt,new Array(e).fill(void 0)),V(this,X,new Array(e).fill(void 0)),V(this,Wt,new G(e)),V(this,ee,new G(e)),V(this,Dt,0),V(this,It,0),V(this,ye,Bh.create(e)),V(this,Mt,0),V(this,_e,0),typeof h=="function"&&V(this,ge,h),typeof u=="function"&&V(this,Br,u),typeof c=="function"?(V(this,xe,c),V(this,Lt,[])):(V(this,xe,void 0),V(this,Lt,void 0)),V(this,Se,!!_(this,ge)),V(this,Si,!!_(this,Br)),V(this,Ht,!!_(this,xe)),this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(_(this,te)!==0&&!ir(_(this,te)))throw new TypeError("maxSize must be a positive integer if specified");if(!ir(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");B(this,A,wx).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=ir(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!ir(this.ttl))throw new TypeError("ttl must be a positive integer if specified");B(this,A,kh).call(this);}if(_(this,me)===0&&this.ttl===0&&_(this,te)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!_(this,me)&&!_(this,te)){let E="LRU_CACHE_UNBOUNDED";nb(E)&&(vx.add(E),Sx("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,Uh));}}static unsafeExposeInternals(t){return {starts:_(t,ve),ttls:_(t,re),sizes:_(t,be),keyMap:_(t,St),keyList:_(t,dt),valList:_(t,X),next:_(t,Wt),prev:_(t,ee),get head(){return _(t,Dt)},get tail(){return _(t,It)},free:_(t,ye),isBackgroundFetch:e=>{var r;return B(r=t,A,ct).call(r,e)},backgroundFetch:(e,r,s,o)=>{var n;return B(n=t,A,Un).call(n,e,r,s,o)},moveToTail:e=>{var r;return B(r=t,A,Os).call(r,e)},indexes:e=>{var r;return B(r=t,A,sr).call(r,e)},rindexes:e=>{var r;return B(r=t,A,or).call(r,e)},isStale:e=>{var r;return _(r=t,ie).call(r,e)}}}get max(){return _(this,me)}get maxSize(){return _(this,te)}get calculatedSize(){return _(this,_e)}get size(){return _(this,Mt)}get fetchMethod(){return _(this,bi)}get memoMethod(){return _(this,vi)}get dispose(){return _(this,ge)}get onInsert(){return _(this,Br)}get disposeAfter(){return _(this,xe)}getRemainingTTL(t){return _(this,St).has(t)?1/0:0}*entries(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*rentries(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&_(this,dt)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield [_(this,dt)[t],_(this,X)[t]]);}*keys(){for(let t of B(this,A,sr).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*rkeys(){for(let t of B(this,A,or).call(this)){let e=_(this,dt)[t];e!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield e);}}*values(){for(let t of B(this,A,sr).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}*rvalues(){for(let t of B(this,A,or).call(this))_(this,X)[t]!==void 0&&!B(this,A,ct).call(this,_(this,X)[t])&&(yield _(this,X)[t]);}[(bx=Symbol.iterator,yx=Symbol.toStringTag,bx)](){return this.entries()}find(t,e={}){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,_(this,dt)[r],this))return this.get(_(this,dt)[r],e)}}forEach(t,e=this){for(let r of B(this,A,sr).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}rforEach(t,e=this){for(let r of B(this,A,or).call(this)){let s=_(this,X)[r],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,_(this,dt)[r],this);}}purgeStale(){let t=false;for(let e of B(this,A,or).call(this,{allowStale:true}))_(this,ie).call(this,e)&&(B(this,A,nr).call(this,_(this,dt)[e],"expire"),t=true);return t}info(t){let e=_(this,St).get(t);if(e===void 0)return;let r=_(this,X)[e],s=B(this,A,ct).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(_(this,re)&&_(this,ve)){let n=_(this,re)[e],a=_(this,ve)[e];if(n&&a){let l=n-(xi.now()-a);o.ttl=l,o.start=Date.now();}}return _(this,be)&&(o.size=_(this,be)[e]),o}dump(){let t=[];for(let e of B(this,A,sr).call(this,{allowStale:true})){let r=_(this,dt)[e],s=_(this,X)[e],o=B(this,A,ct).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let n={value:o};if(_(this,re)&&_(this,ve)){n.ttl=_(this,re)[e];let a=xi.now()-_(this,ve)[e];n.start=Math.floor(Date.now()-a);}_(this,be)&&(n.size=_(this,be)[e]),t.unshift([r,n]);}return t}load(t){this.clear();for(let[e,r]of t){if(r.start){let s=Date.now()-r.start;r.start=xi.now()-s;}this.set(e,r.value,r);}}set(t,e,r={}){var f,d,x,b;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=r,{noUpdateTTL:h=this.noUpdateTTL}=r,u=_(this,Us).call(this,t,e,r.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),B(this,A,nr).call(this,t,"set"),this;let c=_(this,Mt)===0?void 0:_(this,St).get(t);if(c===void 0)c=_(this,Mt)===0?_(this,It):_(this,ye).length!==0?_(this,ye).pop():_(this,Mt)===_(this,me)?B(this,A,Dn).call(this,false):_(this,Mt),_(this,dt)[c]=t,_(this,X)[c]=e,_(this,St).set(t,c),_(this,Wt)[_(this,It)]=c,_(this,ee)[c]=_(this,It),V(this,It,c),Xs(this,Mt)._++,_(this,Ti).call(this,c,u,l),l&&(l.set="add"),h=false,_(this,Si)&&((f=_(this,Br))==null||f.call(this,e,t,"add"));else {B(this,A,Os).call(this,c);let m=_(this,X)[c];if(e!==m){if(_(this,ar)&&B(this,A,ct).call(this,m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=m;p!==void 0&&!n&&(_(this,Se)&&((d=_(this,ge))==null||d.call(this,p,t,"set")),_(this,Ht)&&_(this,Lt)?.push([p,t,"set"]));}else n||(_(this,Se)&&((x=_(this,ge))==null||x.call(this,m,t,"set")),_(this,Ht)&&_(this,Lt)?.push([m,t,"set"]));if(_(this,Gr).call(this,c),_(this,Ti).call(this,c,u,l),_(this,X)[c]=e,l){l.set="replace";let p=m&&B(this,A,ct).call(this,m)?m.__staleWhileFetching:m;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");_(this,Si)&&this.onInsert?.(e,t,e===m?"update":"replace");}if(s!==0&&!_(this,re)&&B(this,A,kh).call(this),_(this,re)&&(h||_(this,Ds).call(this,c,s,o),l&&_(this,Ye).call(this,l,c)),!n&&_(this,Ht)&&_(this,Lt)){let m=_(this,Lt),p;for(;p=m?.shift();)(b=_(this,xe))==null||b.call(this,...p);}return this}pop(){var t;try{for(;_(this,Mt);){let e=_(this,X)[_(this,Dt)];if(B(this,A,Dn).call(this,!0),B(this,A,ct).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(_(this,Ht)&&_(this,Lt)){let e=_(this,Lt),r;for(;r=e?.shift();)(t=_(this,xe))==null||t.call(this,...r);}}}has(t,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=e,o=_(this,St).get(t);if(o!==void 0){let n=_(this,X)[o];if(B(this,A,ct).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(_(this,ie).call(this,o))s&&(s.has="stale",_(this,Ye).call(this,s,o));else return r&&_(this,kr).call(this,o),s&&(s.has="hit",_(this,Ye).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:r=this.allowStale}=e,s=_(this,St).get(t);if(s===void 0||!r&&_(this,ie).call(this,s))return;let o=_(this,X)[s];return B(this,A,ct).call(this,o)?o.__staleWhileFetching:o}async fetch(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:b,forceRefresh:m=false,status:p,signal:y}=e;if(!_(this,ar))return p&&(p.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let v={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:x,ignoreFetchAbort:d,status:p,signal:y},S=_(this,St).get(t);if(S===void 0){p&&(p.fetch="miss");let P=B(this,A,Un).call(this,t,S,v,b);return P.__returned=P}else {let P=_(this,X)[S];if(B(this,A,ct).call(this,P)){let L=r&&P.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",L&&(p.returnedStale=true)),L?P.__staleWhileFetching:P.__returned=P}let T=_(this,ie).call(this,S);if(!m&&!T)return p&&(p.fetch="hit"),B(this,A,Os).call(this,S),s&&_(this,kr).call(this,S),p&&_(this,Ye).call(this,p,S),P;let w=B(this,A,Un).call(this,t,S,v,b),E=w.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=T?"stale":"refresh",E&&T&&(p.returnedStale=true)),E?w.__staleWhileFetching:w.__returned=w}}async forceFetch(t,e={}){let r=await this.fetch(t,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,e={}){let r=_(this,vi);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let l=r(t,a,{options:n,context:s});return this.set(t,l,n),l}get(t,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=_(this,St).get(t);if(a!==void 0){let l=_(this,X)[a],h=B(this,A,ct).call(this,l);return n&&_(this,Ye).call(this,n,a),_(this,ie).call(this,a)?(n&&(n.get="stale"),h?(n&&r&&l.__staleWhileFetching!==void 0&&(n.returnedStale=true),r?l.__staleWhileFetching:void 0):(o||B(this,A,nr).call(this,t,"expire"),n&&r&&(n.returnedStale=true),r?l:void 0)):(n&&(n.get="hit"),h?l.__staleWhileFetching:(B(this,A,Os).call(this,a),s&&_(this,kr).call(this,a),l))}else n&&(n.get="miss");}delete(t){return B(this,A,nr).call(this,t,"delete")}clear(){return B(this,A,Dh).call(this,"delete")}};me=new WeakMap,te=new WeakMap,ge=new WeakMap,Br=new WeakMap,xe=new WeakMap,bi=new WeakMap,vi=new WeakMap,Mt=new WeakMap,_e=new WeakMap,St=new WeakMap,dt=new WeakMap,X=new WeakMap,Wt=new WeakMap,ee=new WeakMap,Dt=new WeakMap,It=new WeakMap,ye=new WeakMap,Lt=new WeakMap,be=new WeakMap,ve=new WeakMap,re=new WeakMap,Se=new WeakMap,ar=new WeakMap,Ht=new WeakMap,Si=new WeakMap,A=new WeakSet,kh=function(){let t=new _i(_(this,me)),e=new _i(_(this,me));V(this,re,t),V(this,ve,e),V(this,Ds,(o,n,a=xi.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let l=setTimeout(()=>{_(this,ie).call(this,o)&&B(this,A,nr).call(this,_(this,dt)[o],"expire");},n+1);l.unref&&l.unref();}}),V(this,kr,o=>{e[o]=t[o]!==0?xi.now():0;}),V(this,Ye,(o,n)=>{if(t[n]){let a=t[n],l=e[n];if(!a||!l)return;o.ttl=a,o.start=l,o.now=r||s();let h=o.now-l;o.remainingTTL=a-h;}});let r=0,s=()=>{let o=xi.now();if(this.ttlResolution>0){r=o;let n=setTimeout(()=>r=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=_(this,St).get(o);if(n===void 0)return 0;let a=t[n],l=e[n];if(!a||!l)return 1/0;let h=(r||s())-l;return a-h},V(this,ie,o=>{let n=e[o],a=t[o];return !!a&&!!n&&(r||s())-n>a});},kr=new WeakMap,Ye=new WeakMap,Ds=new WeakMap,ie=new WeakMap,wx=function(){let t=new _i(_(this,me));V(this,_e,0),V(this,be,t),V(this,Gr,e=>{V(this,_e,_(this,_e)-t[e]),t[e]=0;}),V(this,Us,(e,r,s,o)=>{if(B(this,A,ct).call(this,r))return 0;if(!ir(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,e),!ir(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),V(this,Ti,(e,r,s)=>{if(t[e]=r,_(this,te)){let o=_(this,te)-t[e];for(;_(this,_e)>o;)B(this,A,Dn).call(this,true);}V(this,_e,_(this,_e)+t[e]),s&&(s.entrySize=r,s.totalCalculatedSize=_(this,_e));});},Gr=new WeakMap,Ti=new WeakMap,Us=new WeakMap,sr=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,It);!(!B(this,A,Gh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,Dt)));)e=_(this,ee)[e];},or=function*({allowStale:t=this.allowStale}={}){if(_(this,Mt))for(let e=_(this,Dt);!(!B(this,A,Gh).call(this,e)||((t||!_(this,ie).call(this,e))&&(yield e),e===_(this,It)));)e=_(this,Wt)[e];},Gh=function(t){return t!==void 0&&_(this,St).get(_(this,dt)[t])===t},Dn=function(t){var o;let e=_(this,Dt),r=_(this,dt)[e],s=_(this,X)[e];return _(this,ar)&&B(this,A,ct).call(this,s)?s.__abortController.abort(new Error("evicted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((o=_(this,ge))==null||o.call(this,s,r,"evict")),_(this,Ht)&&_(this,Lt)?.push([s,r,"evict"])),_(this,Gr).call(this,e),t&&(_(this,dt)[e]=void 0,_(this,X)[e]=void 0,_(this,ye).push(e)),_(this,Mt)===1?(V(this,Dt,V(this,It,0)),_(this,ye).length=0):V(this,Dt,_(this,Wt)[e]),_(this,St).delete(r),Xs(this,Mt)._--,e},Un=function(t,e,r,s){let o=e===void 0?void 0:_(this,X)[e];if(B(this,A,ct).call(this,o))return o;let n=new Nn,{signal:a}=r;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let l={signal:n.signal,options:r,context:s},h=(b,m=false)=>{let{aborted:p}=n.signal,y=r.ignoreFetchAbort&&b!==void 0;if(r.status&&(p&&!m?(r.status.fetchAborted=true,r.status.fetchError=n.signal.reason,y&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!y&&!m)return c(n.signal.reason);let v=d;return _(this,X)[e]===d&&(b===void 0?v.__staleWhileFetching?_(this,X)[e]=v.__staleWhileFetching:B(this,A,nr).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,b,l.options))),b},u=b=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=b),c(b)),c=b=>{let{aborted:m}=n.signal,p=m&&r.allowStaleOnFetchAbort,y=p||r.allowStaleOnFetchRejection,v=y||r.noDeleteOnFetchRejection,S=d;if(_(this,X)[e]===d&&(!v||S.__staleWhileFetching===void 0?B(this,A,nr).call(this,t,"fetch"):p||(_(this,X)[e]=S.__staleWhileFetching)),y)return r.status&&S.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),S.__staleWhileFetching;if(S.__returned===S)throw b},f=(b,m)=>{var y;let p=(y=_(this,bi))==null?void 0:y.call(this,t,o,l);p&&p instanceof Promise&&p.then(v=>b(v===void 0?void 0:v),m),n.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=v=>h(v,true)));});};r.status&&(r.status.fetchDispatched=true);let d=new Promise(f).then(h,u),x=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,x,{...l.options,status:void 0}),e=_(this,St).get(t)):_(this,X)[e]=x,x},ct=function(t){if(!_(this,ar))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Nn},Oh=function(t,e){_(this,ee)[e]=t,_(this,Wt)[t]=e;},Os=function(t){t!==_(this,It)&&(t===_(this,Dt)?V(this,Dt,_(this,Wt)[t]):B(this,A,Oh).call(this,_(this,ee)[t],_(this,Wt)[t]),B(this,A,Oh).call(this,_(this,It),t),V(this,It,t));},nr=function(t,e){var s,o;let r=false;if(_(this,Mt)!==0){let n=_(this,St).get(t);if(n!==void 0)if(r=true,_(this,Mt)===1)B(this,A,Dh).call(this,e);else {_(this,Gr).call(this,n);let a=_(this,X)[n];if(B(this,A,ct).call(this,a)?a.__abortController.abort(new Error("deleted")):(_(this,Se)||_(this,Ht))&&(_(this,Se)&&((s=_(this,ge))==null||s.call(this,a,t,e)),_(this,Ht)&&_(this,Lt)?.push([a,t,e])),_(this,St).delete(t),_(this,dt)[n]=void 0,_(this,X)[n]=void 0,n===_(this,It))V(this,It,_(this,ee)[n]);else if(n===_(this,Dt))V(this,Dt,_(this,Wt)[n]);else {let l=_(this,ee)[n];_(this,Wt)[l]=_(this,Wt)[n];let h=_(this,Wt)[n];_(this,ee)[h]=_(this,ee)[n];}Xs(this,Mt)._--,_(this,ye).push(n);}}if(_(this,Ht)&&_(this,Lt)?.length){let n=_(this,Lt),a;for(;a=n?.shift();)(o=_(this,xe))==null||o.call(this,...a);}return r},Dh=function(t){var e,r;for(let s of B(this,A,or).call(this,{allowStale:true})){let o=_(this,X)[s];if(B(this,A,ct).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=_(this,dt)[s];_(this,Se)&&((e=_(this,ge))==null||e.call(this,o,n,t)),_(this,Ht)&&_(this,Lt)?.push([o,n,t]);}}if(_(this,St).clear(),_(this,X).fill(void 0),_(this,dt).fill(void 0),_(this,re)&&_(this,ve)&&(_(this,re).fill(0),_(this,ve).fill(0)),_(this,be)&&_(this,be).fill(0),V(this,Dt,0),V(this,It,0),_(this,ye).length=0,V(this,_e,0),V(this,Mt,0),_(this,Ht)&&_(this,Lt)){let s=_(this,Lt),o;for(;o=s?.shift();)(r=_(this,xe))==null||r.call(this,...o);}};var zn=Uh;var wi=class{constructor(t){M(this,"cache");M(this,"map",new Map);this.cache=new zn({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ns=new wi({cacheSize:10}),Nh;(s=>{function i(o){let n=Ns.get(o);if(!n){k.error(`Label "${o}" not found`);return}return n}s.get=i;function t(o){if(Array.isArray(o)){o.forEach(n=>t(n));return}Ns.has(o.id)&&k.info(`Label "${o.id}" already exists, it will be overwritten`),Ns.set(o.id,o);}s.add=t;function e(){return Array.from(Ns.values())}s.values=e;function r(o){return Ns.has(o)}s.has=r;})(Nh||(Nh={}));var se=Nh;var Ax=$n(Ex());var Ci=class{constructor(t,e){M(this,"_id");M(this,"_onStepStart");M(this,"_onLoadingLabel");M(this,"_onStepEnd");this._id=t,this._onStepStart=e?.onStepStart,this._onLoadingLabel=e?.onLoadingLabel,this._onStepEnd=e?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(t,e)=>{if(this._onLoadingLabel&&t===0&&await this._onLoadingLabel(t,e),this._onStepStart)return await this._onStepStart(t,e)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var lr=class extends Ci{constructor(e,r,s){super(e,s);M(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e){if(e<0||e>=this.steps.length)return k.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[e];return (0,Ax.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return k.warn("stepSha not found, setting to ERROR",r),"error"}}};var lb="__close-label-id__";function zh(){return new lr(lb,[],{})}var Pi=class{constructor(t,e,r,s){M(this,"text");M(this,"_label");M(this,"type");M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{type:o="call",oneTime:n=false,onlyHaveNoChoice:a=false,autoSelect:l=false,...h}=s||{};this.text=t,this._label=e,this.type=o,this.oneTime=n,this.onlyHaveNoChoice=a,this.autoSelect=l,this.devProps=h,this.props=r;}get label(){let t=this._label;if(typeof t=="string"){let e=se.get(t);e?t=e:(k.error(`Label ${t} not found, so it will be closed`),t=zh());}return t}};function hb(i,t,e,r){let s=typeof t=="string"?t:t.id;return {...r,label:s,props:e,text:i,type:r?.type||"call"}}var Mi="close";var Ei=class{constructor(t,e){M(this,"text");M(this,"closeCurrentLabel");M(this,"type",Mi);M(this,"oneTime");M(this,"onlyHaveNoChoice");M(this,"autoSelect");M(this,"props",{});M(this,"devProps",{});let{closeCurrentLabel:r=false,oneTime:s=false,onlyHaveNoChoice:o=false,autoSelect:n=false,...a}=e||{};this.text=t,this.closeCurrentLabel=r,this.oneTime=s,this.onlyHaveNoChoice=o,this.autoSelect=n,this.devProps=a;}};function ub(i,t){return {...t,type:Mi,text:i}}var O=class O{constructor(){}static get allOpenedLabels(){return H.getVariable(Q.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(t){H.setVariable(Q.OPENED_LABELS_COUNTER_KEY,t);}static getCurrentStepTimesCounterData(t=""){let e=O.currentLabelStepIndex;if(e===null)return k.error("currentLabelStepIndex is null"),null;let r=`${e}${t}`,s=O.currentLabelId,o=O._currentLabel;if(!s||e===null||!o)return k.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let n=o.getStepSha(e)||"error",a=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return a[s]||(a[s]={}),(!a[s][r]||a[s][r].stepSha1!=n)&&(a[s][r]={stepSha1:n}),a[s][r]}static setCurrentStepTimesCounterData(t="",e){let r=O.currentLabelStepIndex,s=r+t,o=O.currentLabelId;if(!o||r===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let n=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};n[o]||(n[o]={}),n[o][s]=e,H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,n);}static getCurrentStepTimesCounter(t=""){let e=O._stepCounter,r=O.getCurrentStepTimesCounterData(t);if(!r)return k.error("getCurrentStepTimesCounter obj is null"),0;let s=r.stepCounters||r.lastStepIndexs||[];return s.find(n=>n===e)||(s.push(e),delete r.lastStepIndexs,r.stepCounters=s,O.setCurrentStepTimesCounterData(t,r)),s.length}static getRandomNumber(t,e,r={}){let s=r.nestedId||"";if(r.onceOnly||false){let n=O.getCurrentStepTimesCounterData(s);if(!n)return;let a=n.usedRandomNumbers||{},l=Array.from({length:e-t+1},(c,f)=>f+t).filter(c=>!a[`${t}-${e}`]?.includes(c));if(l.length===0)return;let h=Math.floor(Math.random()*l.length),u=l[h];return a[`${t}-${e}`]||(a[`${t}-${e}`]=[]),a[`${t}-${e}`].push(u),n.usedRandomNumbers=a,O.setCurrentStepTimesCounterData(s,n),u}return Math.floor(Math.random()*(e-t+1))+t}static resetCurrentStepTimesCounter(t=""){let e=O.currentLabelStepIndex,r=e+t,s=O.currentLabelId;if(!s||e===null){k.error("currentLabelId or currentLabelStepIndex is null");return}let o=H.getVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][r]={stepCounters:[],stepSha1:""},H.setVariable(Q.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return H.getVariable(Q.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(t){H.setVariable(Q.ALL_CHOICES_MADE_KEY,t);}static increaseStepCounter(){O._stepCounter++;}static get openedLabels(){return ke(O._openedLabels)}static set openedLabels(t){O._openedLabels=ke(t);}static get originalOpenedLabels(){return ke(O._originalOpenedLabels)}static set originalOpenedLabels(t){O._originalOpenedLabels=ke(t);}static get _currentLabel(){if(O.currentLabelId)return se.get(O.currentLabelId)}static get currentLabelId(){if(O._openedLabels.length>0)return O._openedLabels[O._openedLabels.length-1].label}static get currentLabelStepIndex(){return O._openedLabels.length>0?O._openedLabels[O._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(t,e){let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;(!s||s<e)&&(r[t]={biggestStep:e,openCount:o},O.allOpenedLabels=r);}static addChoicesMade(t,e,r,s){let o=O.allChoicesMade,n=o.findIndex(a=>a.labelId===t&&a.stepIndex===e&&a.choiceIndex===s&&a.stepSha1===r);n<0?o.push({labelId:t,stepIndex:e,choiceIndex:s,stepSha1:r,madeTimes:1}):o[n].madeTimes++,O.allChoicesMade=o;}static pushNewLabel(t){if(!se.get(t))throw new Error(`[Pixi\u2019VN] Label ${t} not found`);O._openedLabels.push({label:t,currentStepIndex:0});let r=O.allOpenedLabels,s=O.allOpenedLabels[t]?.biggestStep||0,o=O.allOpenedLabels[t]?.openCount||0;r[t]={biggestStep:s,openCount:o+1},O.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(O._openedLabels.length>0){let t=O._openedLabels[O._openedLabels.length-1];O._openedLabels[O._openedLabels.length-1]={...t,currentStepIndex:t.currentStepIndex+1};}}static set onStepStart(t){O._onStepStart=t;}static get onStepStart(){return async(t,e)=>{let r=[];return O.onLoadingLabel&&t===0&&r.push(O.onLoadingLabel(t,e)),O._onStepStart&&r.push(O._onStepStart(t,e)),await Promise.all(r)}}};M(O,"stepsRunning",0),M(O,"goNextRequests",0),M(O,"choiceMadeTemp"),M(O,"lastHistoryStep",null),M(O,"_stepCounter",0),M(O,"_openedLabels",[]),M(O,"_originalOpenedLabels",[]),M(O,"_onStepStart"),M(O,"onLoadingLabel"),M(O,"onStepEnd");var I=O;var zs=class{get currentStepTimesCounter(){return I.getCurrentStepTimesCounter()}set currentStepTimesCounter(t){I.resetCurrentStepTimesCounter();}getRandomNumber(t,e,r={}){return I.getRandomNumber(t,e,r)}get stepCounter(){return I._stepCounter}get openedLabels(){return I.openedLabels}get currentLabel(){return I._currentLabel}addStepHistory(t,e={}){let{choiceMade:r,ignoreSameStep:s}=e,o,n,a,l=H.getVariable(Q.LAST_STEP_GLUED)===this.stepCounter;H.getVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY)),H.getVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(n=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY)),H.getVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY));let h=I.openedLabels,u={currentLabel:I.currentLabelId,dialogue:o,choices:n,stepSha1:t,index:this.stepCounter,labelStepIndex:I.currentLabelStepIndex,choiceIndexMade:r,inputValue:a,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:l,openedLabels:h};I.originalOpenedLabels=h,H.addHistoryItem(u,{ignoreSameStep:s}),I.lastHistoryStep=u,I.increaseStepCounter();}closeCurrentLabel(){if(!I.currentLabelId){k.warn("No label to close");return}if(!this.currentLabel){k.error("currentLabel not found");return}let t=I.openedLabels;t.pop(),I.openedLabels=t,H.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;I.openedLabels.length>0;)this.closeCurrentLabel(),H.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(t){let e;typeof t=="string"?e=t:e=t.id;let s=I.allOpenedLabels[e]?.biggestStep||0;if(s){let o=se.get(e);if(o)return o.stepCount<=s}return false}get alreadyCurrentStepMadeChoicesObj(){let t=I.currentLabelStepIndex,e=this.currentLabel;if(t===null||!e)return;let r=e.getStepSha(t);return r||(k.warn("stepSha not found, setting to ERROR"),r="error"),I.allChoicesMade.filter(s=>s.labelId===e?.id&&s.stepIndex===t&&s.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(t=>t.choiceIndex)}get isCurrentStepAlreadyOpened(){let t=I.currentLabelId;if(t){let e=I.allOpenedLabels[t]?.openCount||0;if(I.currentLabelStepIndex&&e>=I.currentLabelStepIndex)return true}return false}getTimesLabelOpened(t){return I.allOpenedLabels[t]?.openCount||0}getTimesChoiceMade(t){return this.alreadyCurrentStepMadeChoicesObj?.find(e=>e.choiceIndex===t)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanGoNext(t){let e=t?.showWarn||false,r=this.choiceMenuOptions;return r&&r.length>0?(e&&k.warn("The player must make a choice"),false):this.isRequiredInput?(e&&k.warn("The player must enter a value"),false):true}get canGoNext(){return I.stepsRunning!==0?false:this.getCanGoNext()}async onStepRun(t,e){let r=[];return t.onStepStart&&r.push(t.onStepStart(e,t)),I.onStepStart&&r.push(I.onStepStart(e,t)),await Promise.all(r)}async onStepEnd(t,e){let r=[];return t.onStepEnd&&r.push(t.onStepEnd(e,t)),I.onStepEnd&&r.push(I.onStepEnd(e,t)),await Promise.all(r)}async goNext(t,e={}){let{runNow:r=false}=e;if(!(!r&&!this.getCanGoNext({showWarn:true}))){if(!r&&I.stepsRunning!==0){I.goNextRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(s){k.error("Error running onStepEnd",s);}return I.stepsRunning===0&&await H.onGoNextEnd(),I.increaseCurrentStepIndex(),await this.runCurrentStep(t,e)}}async runCurrentStep(t,e={}){let{choiceMade:r}=e;if(I.currentLabelId){let s=I.currentLabelStepIndex;if(s===null){k.error("currentLabelStepIndex is null");return}let o=I._currentLabel;if(!o){k.error("currentLabel not found");return}if(o.stepCount>s){try{await this.onStepRun(o,s);}catch(l){k.error("Error running onStepStart",l),this.onStepError&&this.onStepError(l,t);return}let n=o.getStepById(s);if(!n){k.error("step not found");return}let a=o.getStepSha(s);a||(k.warn("stepSha not found, setting to ERROR"),a="error");try{I.stepsRunning++;let l=await n(t,{labelId:o.id}),h=this.choiceMenuOptions;if(h?.length===1&&h[0].autoSelect){let c=h[0];l=await this.selectChoice(c,t);}let u=I.lastHistoryStep;if(r!==void 0&&u){let c=u.stepSha1;c||(k.warn("stepSha not found, setting to ERROR"),c="error"),I.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",r),I.choiceMadeTemp=r;}return I.stepsRunning--,I.stepsRunning===0&&(I.addLabelHistory(o.id,s),this.addStepHistory(a,{...e,choiceMade:I.choiceMadeTemp}),I.choiceMadeTemp=void 0,I.goNextRequests>0)?(I.goNextRequests--,await this.goNext(t)):l}catch(l){I.stepsRunning>0&&I.stepsRunning--,k.error("Error running step",l),this.onStepError&&this.onStepError(l,t);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.goNext(t,e);if(this.openedLabels.length===1)return I.openedLabels=[],this.onGameEnd?await this.onGameEnd(t,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(I.openedLabels=I.originalOpenedLabels,this.onGameEnd)return await this.onGameEnd(t,{labelId:"end"});k.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else k.error("currentLabelId not found");}async callLabel(t,e,r){let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error calling label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async jumpLabel(t,e,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:s}=r||{},o;typeof t=="string"?o=t:o=t.id;try{let n=se.get(o);if(!n)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,I.currentLabelStepIndex||0);}catch(a){k.error("Error running onStepEnd",a);}I.pushNewLabel(n.id);}catch(n){k.error("Error jumping label",n);return}return await this.runCurrentStep(e,{choiceMade:s})}async selectChoice(t,e){this.choiceMenuOptions=void 0;let r=t.type;switch(r){case "call":return await this.callLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "jump":return await this.jumpLabel(t.label,{...t.props,...e},{choiceMade:t.choiceIndex});case "close":return await this.closeChoiceMenu(t,{...t.props,...e});default:throw k.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(t,e){if(t.type!=="close")throw k.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof t.choiceIndex=="number"&&(r=t.choiceIndex),t.closeCurrentLabel&&this.closeCurrentLabel(),this.goNext(e,{choiceMade:r})}get onGameEnd(){return H.onEnd}set onGameEnd(t){H.onEnd=t;}get onStepError(){let t=H.onError;return t?(e,r)=>t("step",e,r):void 0}set onStepError(t){H.onError=(e,r,s)=>t(r,s);}get dialogue(){let t=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(t)return {...t,character:t.character?H.getCharacter(t.character)||t.character:void 0}}set dialogue(t){if(!t){H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof t=="string"||Array.isArray(t))&&(t={text:t}),this.dialogGlue){let e=H.getVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY);if(e){let r=[];Array.isArray(e.text)?r=[...e.text]:r=[e.text],Array.isArray(t.text)?r=[...r,...t.text]:r=[...r,t.text],t.text=r,t.character=t.character||e.character;}H.setVariable(Q.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{H.setVariable(Q.CURRENT_DIALOGUE_MEMORY_KEY,ke({...t,character:typeof t.character=="string"?t.character:t.character?.id})),H.setVariable(Q.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(e){throw k.error("DialogueInterface cannot contain functions or classes"),e}}get choiceMenuOptions(){let t=H.getVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(t){let e=[],r=t.map((o,n)=>({...o,choiceIndex:n})),s=this.alreadyCurrentStepMadeChoices;if(r=r.filter((o,n)=>o.oneTime&&s&&s.includes(n)?false:o.onlyHaveNoChoice?(e.push(o),false):true),r.length>0)return r;if(e.length>0)return [e[0]]}}set choiceMenuOptions(t){if(!t||t.length===0){H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}let e=t.map(r=>r instanceof Ei?{...r.devProps,text:r.text,type:Mi,closeCurrentLabel:r.closeCurrentLabel,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,autoSelect:r.autoSelect,props:r.props}:r instanceof Pi?{...r.devProps,type:r.type,text:r.text,label:r.label.id,autoSelect:r.autoSelect,oneTime:r.oneTime,onlyHaveNoChoice:r.onlyHaveNoChoice,props:r.props}:r);try{H.setVariable(Q.CURRENT_MENU_OPTIONS_MEMORY_KEY,ke(e)),H.setVariable(Q.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(r){throw k.error("ChoiceInterface cannot contain functions or classes"),r}}get dialogGlue(){return H.getFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(t){H.setFlag(Q.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,t);}get inputValue(){return H.getVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(t){this.removeInputRequest(),H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,t),H.setVariable(Q.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return H.getVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(t,e){t.isRequired=true,H.setVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY,t),e!==void 0?H.setVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY,e):H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){H.removeVariable(Q.CURRENT_INPUT_INFO_MEMORY_KEY),H.removeVariable(Q.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){I.openedLabels=[],I._stepCounter=0;}export(){return {openedLabels:ke(I.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(t){let e=this.openedLabels.map(async r=>{let s=[],o=se.get(r.label);return o&&(o.onLoadingLabel&&s.push(o.onLoadingLabel(t,o)),I.onLoadingLabel&&s.push(I.onLoadingLabel(t,o))),await Promise.all(s)});return await Promise.all(e)}async restore(t,e){this.clear();try{I.lastHistoryStep=e,t.hasOwnProperty("openedLabels")?(I.openedLabels=t.openedLabels,I.originalOpenedLabels=I.openedLabels):k.warn("Could not import openedLabels data, so will be ignored"),t.hasOwnProperty("stepCounter")?I._stepCounter=t.stepCounter:t.hasOwnProperty("lastStepIndex")?I._stepCounter=t.lastStepIndex:k.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(I.currentLabelStepIndex||0);}catch(r){k.error("Error running onLoadingLabel",r);}}catch(r){k.error("Error importing data",r);}}};function Ix(i,t,e){let r=new lr(i,t,e);return se.add(r),r}var MO=new zs;
572
572
  exports.ChoiceMenuOption=Pi;exports.ChoiceMenuOptionClose=Ei;exports.Close=Mi;exports.Label=lr;exports.LabelAbstract=Ci;exports.NarrationManagerStatic=I;exports.RegisteredLabels=se;exports.narration=MO;exports.newChoiceOption=hb;exports.newCloseChoiceOption=ub;exports.newLabel=Ix;