e.right?e.right:this.right)<=J)return!1;let $=this.ye.bottom?e.bottom:this.bottom)>$}let r=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=r||a<=s)return!1;let o=tr[0].set(e.left,e.top),l=tr[1].set(e.left,e.bottom),h=tr[2].set(e.right,e.top),u=tr[3].set(e.right,e.bottom);if(h.x<=o.x||l.y<=o.y)return!1;let d=Math.sign(i.a*i.d-i.b*i.c);if(d===0||(i.apply(o,o),i.apply(l,l),i.apply(h,h),i.apply(u,u),Math.max(o.x,l.x,h.x,u.x)<=r||Math.min(o.x,l.x,h.x,u.x)>=n||Math.max(o.y,l.y,h.y,u.y)<=s||Math.min(o.y,l.y,h.y,u.y)>=a))return!1;let p=d*(l.y-o.y),g=d*(o.x-l.x),b=p*r+g*s,x=p*n+g*s,_=p*r+g*a,T=p*n+g*a;if(Math.max(b,x,_,T)<=p*o.x+g*o.y||Math.min(b,x,_,T)>=p*u.x+g*u.y)return!1;let C=d*(o.y-h.y),F=d*(h.x-o.x),k=C*r+F*s,N=C*n+F*s,re=C*r+F*a,ne=C*n+F*a;return!(Math.max(k,N,re,ne)<=C*o.x+F*o.y||Math.min(k,N,re,ne)>=C*u.x+F*u.y)}pad(e=0,i=e){return this.x-=e,this.y-=i,this.width+=e*2,this.height+=i*2,this}fit(e){let i=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=i,this.width=Math.max(r-i,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(e=1,i=.001){let r=Math.ceil((this.x+this.width-i)*e)/e,n=Math.ceil((this.y+this.height-i)*e)/e;return this.x=Math.floor((this.x+i)*e)/e,this.y=Math.floor((this.y+i)*e)/e,this.width=r-this.x,this.height=n-this.y,this}enlarge(e){let i=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=i,this.width=r-i,this.y=n,this.height=s-n,this}getBounds(e){return e=e||new Bo,e.copyFrom(this),e}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}}),f,m,y=v(()=>{Xe(),c(),f=new Ae,m=class tv{constructor(e=1/0,i=1/0,r=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=f,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new at);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=f,this}set(e,i,r,n){this.minX=e,this.minY=i,this.maxX=r,this.maxY=n}addFrame(e,i,r,n,s){s||(s=this.matrix);let a=s.a,o=s.b,l=s.c,h=s.d,u=s.tx,d=s.ty,p=this.minX,g=this.minY,b=this.maxX,x=this.maxY,_=a*e+l*i+u,T=o*e+h*i+d;_b&&(b=_),T>x&&(x=T),_=a*r+l*i+u,T=o*r+h*i+d,_
b&&(b=_),T>x&&(x=T),_=a*e+l*n+u,T=o*e+h*n+d,_
b&&(b=_),T>x&&(x=T),_=a*r+l*n+u,T=o*r+h*n+d,_
b&&(b=_),T>x&&(x=T),this.minX=p,this.minY=g,this.maxX=b,this.maxY=x}addRect(e,i){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,i)}addBounds(e,i){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,i)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxXthis.maxX?p:this.maxX,this.maxY=g>this.maxY?g:this.maxY,p=a*i+l*s+u,g=o*i+h*s+d,this.minX=pthis.maxX?p:this.maxX,this.maxY=g>this.maxY?g:this.maxY,p=a*n+l*s+u,g=o*n+h*s+d,this.minX=pthis.maxX?p:this.maxX,this.maxY=g>this.maxY?g:this.maxY}fit(e){return this.minXe.right&&(this.maxX=e.right),this.minYe.bottom&&(this.maxY=e.bottom),this}fitBounds(e,i,r,n){return this.minXi&&(this.maxX=i),this.minYn&&(this.maxY=n),this}pad(e,i=e){return this.minX-=e,this.maxX+=e,this.minY-=i,this.maxY+=i,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new tv(this.minX,this.minY,this.maxX,this.maxY)}scale(e,i=e){return this.minX*=e,this.minY*=i,this.maxX*=e,this.maxY*=i,this}get x(){return this.minX}set x(e){let i=this.maxX-this.minX;this.minX=e,this.maxX=e+i}get y(){return this.minY}set y(e){let i=this.maxY-this.minY;this.minY=e,this.maxY=e+i}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,i,r,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);let h=n.a,u=n.b,d=n.c,p=n.d,g=n.tx,b=n.ty;for(let x=i;xo?C:o,l=F>l?F:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(e,i){return this.minX<=e&&this.minY<=i&&this.maxX>=e&&this.maxY>=i}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}}),w,S,P=v(()=>{Xe(),Yr(),y(),w=new gr(Ae),S=new gr(m)});function R(t,e,i){i.clear();let r,n;return t.parent?e?r=t.parent.worldTransform:(n=w.get().identity(),r=H(t,n)):r=Ae.IDENTITY,U(t,i,r,e),n&&w.return(n),i.isValid||i.set(0,0,0,0),i}function U(t,e,i,r){if(!t.visible||!t.measurable)return;let n;r?n=t.worldTransform:(t.updateLocalTransform(),n=w.get(),n.appendFrom(t.localTransform,i));let s=e,a=!!t.effects.length;if(a&&(e=S.get().clear()),t.boundsArea)e.addRect(t.boundsArea,n);else{t.addBounds&&(e.matrix=n,t.addBounds(e));for(let o=0;o{Xe(),P()});function G(...t){j!==I&&(j++,j===I?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}var j,I,B=v(()=>{"use strict";j=0,I=500});function X(t,e,i){return e.clear(),i||(i=Ae.IDENTITY),V(t,e,i,t,!0),e.isValid||e.set(0,0,0,0),e}function V(t,e,i,r,n){let s;if(n)s=w.get(),s=i.copyTo(s);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();let l=t.localTransform;s=w.get(),s.appendFrom(l,i)}let a=e,o=!!t.effects.length;if(o&&(e=S.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{t.renderPipeId&&(e.matrix=s,t.addBounds(e));let l=t.children;for(let h=0;h{Xe(),P()});function Me(t,e){let i=t.children;for(let r=0;r{"use strict"}),Ke,St,ai=v(()=>{Xe(),y(),Q(),ue(),Ee(),Ke=new Ae,St={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){let i=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*i:this.scale.x=i},_setHeight(t,e){let i=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*i:this.scale.y=i},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new m});let t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),Me(this,t),t.didChange&&X(this,t.localBounds,Ke),t.localBounds},getBounds(t,e){return R(this,t,e||new m)}}}),$t,qt=v(()=>{"use strict";$t={_onRender:null,set onRender(t){let e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}}});function ir(t,e){return t._zIndex-e._zIndex}var xe,Ge=v(()=>{"use strict";xe={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(ir))}}}),Oe,xt=v(()=>{Xe(),jt(),Q(),Oe={getGlobalPosition(t=new De,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,i=!1){if(!i){this.updateLocalTransform();let r=H(this,new Ae);return r.append(this.localTransform),r.apply(t,e)}return this.worldTransform.apply(t,e)},toLocal(t,e,i,r){if(e&&(t=e.toGlobal(t,i,r)),!r){this.updateLocalTransform();let n=H(this,new Ae);return n.append(this.localTransform),n.applyInverse(t,i)}return this.worldTransform.applyInverse(t,i)}}}),ot,tt,Rt=v(()=>{yt(),ot=0,tt=class{constructor(){this.uid=ht("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=ot++}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}}),Kt,Nt=v(()=>{Xe(),Rt(),Kt=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new Ae,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new tt,this._onRenderContainers=[]}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let i=0;i-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let i=0;i0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;t{"use strict"}),Ms,Ps,Rs,Cn,ks,Jr,bt,Ni=v(()=>{gt(),Ie(),ye(),Xe(),ei(),Cr(),yt(),_t(),Lt(),Vt(),Cs(),Qr(),ai(),qt(),Ge(),xt(),Nt(),Iv(),Ms=new Tt(null),Ps=new Tt(null),Rs=new Tt(null,1,1),Cn=1,ks=2,Jr=4,bt=class iv extends qe{constructor(e={}){super(),this.uid=ht("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new Ae,this.relativeGroupTransform=new Ae,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Tt(this,0,0),this._scale=Rs,this._pivot=Ps,this._skew=Ms,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Go(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(i=>this.addChild(i)),e.parent?.addChild(this)}static mixin(e){Object.defineProperties(iv.prototype,Object.getOwnPropertyDescriptors(e))}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||We(je,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let n=0;n1){for(let n=0;n-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(i):this.parentRenderGroup&&this.parentRenderGroup.removeChild(i),i.parent=null,this.emit("childRemoved",i,this,r),i.emit("removed",this)),i}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=Ue.get(Kt,this),this.groupTransform=Ae.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),Ue.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new Ae),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*Be}set angle(e){this.rotation=e*st}get pivot(){return this._pivot===Ps&&(this._pivot=new Tt(this,0,0)),this._pivot}set pivot(e){this._pivot===Ps&&(this._pivot=new Tt(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Ms&&(this._skew=new Tt(this,0,0)),this._skew}set skew(e){this._skew===Ms&&(this._skew=new Tt(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Rs&&(this._scale=new Tt(this,1,1)),this._scale}set scale(e){this._scale===Rs&&(this._scale=new Tt(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let i=this.getLocalBounds().width;this._setWidth(e,i)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let i=this.getLocalBounds().height;this._setHeight(e,i)}getSize(e){e||(e={});let i=this.getLocalBounds();return e.width=Math.abs(this.scale.x*i.width),e.height=Math.abs(this.scale.y*i.height),e}setSize(e,i){let r=this.getLocalBounds();typeof e=="object"?(i=e.height??e.width,e=e.width):i??(i=e),e!==void 0&&this._setWidth(e,r.width),i!==void 0&&this._setHeight(i,r.height)}_updateSkew(){let e=this._rotation,i=this._skew;this._cx=Math.cos(e+i._y),this._sx=Math.sin(e+i._y),this._cy=-Math.sin(e-i._x),this._sy=Math.cos(e-i._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let i=this.localTransform,r=this._scale,n=this._pivot,s=this._position,a=r._x,o=r._y,l=n._x,h=n._y;i.a=this._cx*a,i.b=this._sx*a,i.c=this._cy*o,i.d=this._sy*o,i.tx=s._x-(l*i.a+h*i.c),i.ty=s._y-(l*i.b+h*i.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Cn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=pe.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Cn,this._onUpdate())}get tint(){let e=this.localColor;return((e&255)<<16)+(e&65280)+(e>>16&255)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ks,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let i=e?2:0;(this.localDisplayStatus&2)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Jr,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let i=e?0:4;(this.localDisplayStatus&4)!==i&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Jr,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let i=e?1:0;(this.localDisplayStatus&1)!==i&&(this._updateFlags|=Jr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let i=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof e=="boolean"?e:e?.children)for(let r=0;r{jt(),Bs=class rv{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=rv.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new De,this.page=new De,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,i,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,i,r,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function Gv(t){return function(e){return e.test(t)}}function Bc(t){var e={userAgent:"",platform:"",maxTouchPoints:0};!t&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof t=="string"?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0});var i=e.userAgent,r=i.split("[FBAN");typeof r[1]<"u"&&(i=r[0]),r=i.split("Twitter"),typeof r[1]<"u"&&(i=r[0]);var n=Gv(i),s={apple:{phone:n(Is)&&!n(Hi),ipod:n(Fo),tablet:!n(Is)&&(n(Do)||$o(e))&&!n(Hi),universal:n(Uo),device:(n(Is)||n(Fo)||n(Do)||n(Uo)||$o(e))&&!n(Hi)},amazon:{phone:n(Br),tablet:!n(Br)&&n(Mn),device:n(Br)||n(Mn)},android:{phone:!n(Hi)&&n(Br)||!n(Hi)&&n(Gs),tablet:!n(Hi)&&!n(Br)&&!n(Gs)&&(n(Mn)||n(Lo)),device:!n(Hi)&&(n(Br)||n(Mn)||n(Gs)||n(Lo))||n(/\bokhttp\b/i)},windows:{phone:n(Hi),tablet:n(No),device:n(Hi)||n(No)},other:{blackberry:n(Ho),blackberry10:n(zo),opera:n(Wo),firefox:n(Vo),chrome:n(jo),device:n(Ho)||n(zo)||n(Wo)||n(Vo)||n(jo)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var Is,Fo,Do,Uo,Gs,Lo,Br,Mn,Hi,No,Ho,zo,Wo,jo,Vo,$o,Ic=v(()=>{Is=/iPhone/i,Fo=/iPod/i,Do=/iPad/i,Uo=/\biOS-universal(?:.+)Mac\b/i,Gs=/\bAndroid(?:.+)Mobile\b/i,Lo=/Android/i,Br=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Mn=/Silk/i,Hi=/Windows Phone/i,No=/\bWindows(?:.+)ARM\b/i,Ho=/BlackBerry/i,zo=/BB10/i,Wo=/Opera Mini/i,jo=/\b(CriOS|Chrome)(?:.+)Mobile/i,Vo=/Mobile(?:.+)Firefox\b/i,$o=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"}}),Ov=v(()=>{Ic(),Ic()}),Gc,Oc,Fv=v(()=>{Ov(),Gc=Bc.default??Bc,Oc=Gc(globalThis.navigator)}),Fc,Pn,Dc,Uc,Xo,Yo,Lc,Nc,Hc,qo,Dv=v(()=>{Oo(),te(),Fv(),Kr(),Fc=9,Pn=100,Dc=0,Uc=0,Xo=2,Yo=1,Lc=-1e3,Nc=-1e3,Hc=2,qo=class{constructor(t,e=Oc){this._mobileInfo=e,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook();let i=document.createElement("div");i.style.width=`${Pn}px`,i.style.height=`${Pn}px`,i.style.position="absolute",i.style.top=`${Dc}px`,i.style.left=`${Uc}px`,i.style.zIndex=Xo.toString(),this._div=i,this._renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${Yo}px`,t.style.height=`${Yo}px`,t.style.position="absolute",t.style.top=`${Lc}px`,t.style.left=`${Nc}px`,t.style.zIndex=Hc.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),this._renderer.view.canvas.parentNode?.appendChild(this._div))}_deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),this._div.parentNode?.removeChild(this._div))}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let i=0;i title : ${t.title} tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(e=document.createElement("button"),e.style.width=`${Pn}px`,e.style.height=`${Pn}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Xo.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=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){let{container:i}=t.target,r=this._renderer.events.rootBoundary,n=Object.assign(new Bs(r),{target:i});r.rootTarget=this._renderer.lastObjectRendered,e.forEach(s=>r.dispatchEvent(n,s))}_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===Fc&&this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._destroyTouchHook(),this._div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this._pool=null,this._children=null,this._renderer=null}},qo.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"accessibility"}}),zc,Uv=v(()=>{"use strict";zc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}}),Lv=v(()=>{te(),Ni(),Dv(),Uv(),ge.add(qo),bt.mixin(zc)}),Ko,Nv=v(()=>{te(),Ko=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,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{let{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,i=n}this.renderer.resize(e,i),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}},Ko.extension=O.Application}),en,Zo=v(()=>{"use strict";en=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(en||{})}),Os,Hv=v(()=>{"use strict";Os=class{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}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(!0),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=!1){this._destroyed=!0,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}}}),Qo,Ci,Fs=v(()=>{Zo(),Hv(),Qo=class _i{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Os(null,null,1/0),this.deltaMS=1/_i.targetFPMS,this.elapsedMS=1/_i.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,i,r=en.NORMAL){return this._addListener(new Os(e,i,r))}addOnce(e,i,r=en.NORMAL){return this._addListener(new Os(e,i,r,!0))}_addListener(e){let i=this._head.next,r=this._head;if(!i)e.connect(r);else{for(;i;){if(e.priority>i.priority){e.connect(r);break}r=i,i=i.next}e.previous||e.connect(r)}return this._startIfPossible(),this}remove(e,i){let r=this._head.next;for(;r;)r.match(e,i)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,i=this._head;for(;i=i.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let i;if(e>this.lastTime){if(i=this.elapsedMS=e-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){let s=e-this._lastFrame|0;if(s{te(),Zo(),Fs(),Jo=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,en.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ci.shared:new Ci,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}},Jo.extension=O.Application}),Wc=v(()=>{te(),Nv(),zv(),ge.add(Ko),ge.add(Jo)}),jc,rr,Vc=v(()=>{Zo(),Fs(),jc=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Ci.system.add(this._tickerUpdate,this,en.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Ci.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime{jt(),Oo(),Rn=class extends Bs{constructor(){super(...arguments),this.client=new De,this.movement=new De,this.offset=new De,this.global=new De,this.screen=new De}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,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,n,s,a,o,l,h,u,d,p,g,b){throw new Error("Method not implemented.")}}}),xi,$c=v(()=>{el(),xi=class extends Rn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}}),Ir,Xc=v(()=>{el(),Ir=class extends Rn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Ir.DOM_DELTA_PIXEL=0,Ir.DOM_DELTA_LINE=1,Ir.DOM_DELTA_PAGE=2}),Yc,qc,tn,Kc,Wv=v(()=>{gt(),jt(),B(),Vc(),el(),$c(),Xc(),Yc=2048,qc=new De,tn=new De,Kc=class{constructor(t){this.dispatch=new qe,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,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((i,r)=>i.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,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 i=0,r=e.length;i=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let r=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)r.forEach(s=>{t.currentTarget=i[n],this.notifyTarget(t,s)})}propagationPath(t){let e=[t];for(let i=0;i=0;u--){let d=h[u],p=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,r,n,s||n(t,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;let g=t.isInteractive();(p.length>0||g)&&(g&&this._allInteractiveElements.push(t),p.push(t)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}let o=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(t,i)&&r(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,r,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(rr.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children,l=i;for(let h=o.length-1;h>=0;h--){let u=o[h],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,r,n);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let p=t.isInteractive();return(d.length>0||p)&&d.push(t),d}}}let s=this._isInteractive(e),a=t.isInteractive();return s&&r(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.includeInBuild||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,tn),!t.hitArea.contains(tn.x,tn.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i0&&n!==e.target){let o=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,o,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(n)){let h=this.createPointerEvent(t,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),i&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(n!==e.target){let o=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,o);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(e,"pointerenter");for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==n&&u.target!==this.rootTarget.parent;)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseenter"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(l)}let s=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?s.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&s.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&s.push("globaltouchmove")),i&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&s.push("globalmousemove"),this.cursor=e.target?.cursor),s.length>0&&this.all(e,s),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);let n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(t,"pointerleave",r);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}let r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]),s=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){let o=i.button===2;this.notifyTarget(i,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete r.pressTargetsByButton[t.button],s=a}if(s){let a=this.clonePointerEvent(i,"click");a.target=s,a.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let o=r.clicksByButton[t.button];if(o.target===a.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=e,a.detail=o.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof xi)){G("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let n=i;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof Ir)){G("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 i=1;i{te(),Wv(),Vc(),$c(),Xc(),Zc=1,Qc={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ds=class Tc{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Kc(null),rr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new xi(null),this._rootWheelEvent=new Ir(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Tc.defaultEventFeatures},{set:(i,r,n)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),i[r]=n,!0)}),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(e){let{canvas:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,Tc._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e=e||"default";let i=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(i=!1),this._currentCursor===e)return;this._currentCursor=e;let r=this.cursorStyles[e];if(r)switch(typeof r){case"string":i&&(this.domElement.style.cursor=r);break;case"function":r(e);break;case"object":i&&Object.assign(this.domElement.style,r);break}else i&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let i=this._normalizeToPointerData(e);this.autoPreventDefault&&i[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let r=0,n=i.length;r0&&(i=e.composedPath()[0]);let r=i!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,a=n.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=e.type,i.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let r=e;typeof r.isPrimary>"u"&&(r.isPrimary=!0),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=Zc),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,i.push(r)}else i.push(e);return i}normalizeWheelEvent(e){let i=this._rootWheelEvent;return this._transferMouseData(i,e),i.deltaX=e.deltaX,i.deltaY=e.deltaY,i.deltaZ=e.deltaZ,i.deltaMode=e.deltaMode,this.mapPositionToPoint(i.screen,e.clientX,e.clientY),i.global.copyFrom(i.screen),i.offset.copyFrom(i.screen),i.nativeEvent=e,i.type=e.type,i}_bootstrapEvent(e,i){return e.originalEvent=null,e.nativeEvent=i,e.pointerId=i.pointerId,e.width=i.width,e.height=i.height,e.isPrimary=i.isPrimary,e.pointerType=i.pointerType,e.pressure=i.pressure,e.tangentialPressure=i.tangentialPressure,e.tiltX=i.tiltX,e.tiltY=i.tiltY,e.twist=i.twist,this._transferMouseData(e,i),this.mapPositionToPoint(e.screen,i.clientX,i.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=i.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Qc[e.type]||e.type),e}_transferMouseData(e,i){e.isTrusted=i.isTrusted,e.srcElement=i.srcElement,e.timeStamp=performance.now(),e.type=i.type,e.altKey=i.altKey,e.button=i.button,e.buttons=i.buttons,e.client.x=i.clientX,e.client.y=i.clientY,e.ctrlKey=i.ctrlKey,e.metaKey=i.metaKey,e.movement.x=i.movementX,e.movement.y=i.movementY,e.page.x=i.pageX,e.page.y=i.pageY,e.relatedTarget=null,e.shiftKey=i.shiftKey}},Ds.extension={name:"events",type:[O.WebGLSystem,O.CanvasSystem,O.WebGPUSystem],priority:-1},Ds.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},tl=Ds}),ed,jv=v(()=>{Jc(),Oo(),ed={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(t){this.eventMode=t?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??tl.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(t,e,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof i=="object"?i.signal:void 0,s=typeof i=="object"?i.once===!0:!1,a=typeof e=="function"?void 0:e;t=r?`${t}capture`:t;let o=typeof e=="function"?e:e.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(t,o,a)}),s?l.once(t,o,a):l.on(t,o,a)},removeEventListener(t,e,i){let r=typeof i=="boolean"&&i||typeof i=="object"&&i.capture,n=typeof e=="function"?void 0:e;t=r?`${t}capture`:t,e=typeof e=="function"?e:e.handleEvent,this.off(t,e,n)},dispatchEvent(t){if(!(t instanceof Bs))throw new Error("Container cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}}}),Vv=v(()=>{te(),Ni(),Jc(),jv(),ge.add(tl),bt.mixin(ed)}),il,$v=v(()=>{"use strict";il=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(il||{})}),td,Xv=v(()=>{"use strict";td={createCanvas:(t,e)=>{let i=document.createElement("canvas");return i.width=t,i.height=e,i},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")}}),rl,ft,Ot=v(()=>{Xv(),rl=td,ft={get(){return rl},set(t){rl=t}}});function Mi(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function kn(t){return t.split("?")[0].split("#")[0]}function Yv(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qv(t,e,i){return t.replace(new RegExp(Yv(e),"g"),i)}function Kv(t,e){let i="",r=0,n=-1,s=0,a=-1;for(let o=0;o<=t.length;++o){if(o2){let l=i.lastIndexOf("/");if(l!==i.length-1){l===-1?(i="",r=0):(i=i.slice(0,l),r=i.length-1-i.lastIndexOf("/")),n=o,s=0;continue}}else if(i.length===2||i.length===1){i="",r=0,n=o,s=0;continue}}e&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+=`/${t.slice(n+1,o)}`:i=t.slice(n+1,o),r=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return i}var rn,id=v(()=>{Ot(),rn={toPosix(t){return qv(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){Mi(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let i=/^[^/:]+:\/{0,2}/.exec(t);return i?i[0]:""},toAbsolute(t,e,i){if(Mi(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let r=kn(this.toPosix(e??ft.get().getBaseUrl())),n=kn(this.toPosix(i??this.rootname(r)));return t=this.toPosix(t),t.startsWith("/")?rn.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(Mi(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",i=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let r=t.endsWith("/");return t=Kv(t,!1),t.length>0&&r&&(t+="/"),i?`/${t}`:e+t},isAbsolute(t){return Mi(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let i=0;i0)if(e===void 0)e=r;else{let n=t[i-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(Mi(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0),i=e===47,r=-1,n=!0,s=this.getProtocol(t),a=t;t=t.slice(s.length);for(let o=t.length-1;o>=1;--o)if(e=t.charCodeAt(o),e===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":this.isUrl(a)?s+t:s:i&&r===1?"//":s+t.slice(0,r)},rootname(t){Mi(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){let i=t.indexOf("/",e.length);i!==-1?e=t.slice(0,i):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){Mi(t),e&&Mi(e),t=kn(this.toPosix(t));let i=0,r=-1,n=!0,s;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(s=t.length-1;s>=0;--s){let l=t.charCodeAt(s);if(l===47){if(!n){i=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===e.charCodeAt(a)?--a===-1&&(r=s):(a=-1,r=o))}return i===r?r=o:r===-1&&(r=t.length),t.slice(i,r)}for(s=t.length-1;s>=0;--s)if(t.charCodeAt(s)===47){if(!n){i=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":t.slice(i,r)},extname(t){Mi(t),t=kn(this.toPosix(t));let e=-1,i=0,r=-1,n=!0,s=0;for(let a=t.length-1;a>=0;--a){let o=t.charCodeAt(a);if(o===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),o===46?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||r===-1||s===0||s===1&&e===r-1&&e===i+1?"":t.slice(e,r)},parse(t){Mi(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=kn(this.toPosix(t));let i=t.charCodeAt(0),r=this.isAbsolute(t),n,s="";e.root=this.rootname(t),r||this.hasProtocol(t)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=t.length-1,d=0;for(;u>=n;--u){if(i=t.charCodeAt(u),i===47){if(!h){o=u+1;break}continue}l===-1&&(h=!1,l=u+1),i===46?a===-1?a=u:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||l===-1||d===0||d===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&r?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(o,l)):(o===0&&r?(e.name=t.slice(1,a),e.base=t.slice(1,l)):(e.name=t.slice(o,a),e.base=t.slice(o,l)),e.ext=t.slice(a,l)),e.dir=this.dirname(t),s&&(e.dir=s+e.dir),e},sep:"/",delimiter:":",joinExtensions:[".html"]}}),Gr,rd=v(()=>{"use strict";Gr=(t,e,i=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(r=>typeof r=="string"||i?e(r):r):t)});function nd(t,e,i,r,n){let s=e[i];for(let a=0;a{let a=s.substring(1,s.length-1).split(",");n.push(a)}),nd(t,n,0,i,r)}else r.push(t);return r}var Qv=v(()=>{"use strict"}),nl,Jv=v(()=>{"use strict";nl=t=>!Array.isArray(t)});function ey(t){return t.split(".").pop().split("?").shift().split("#").shift()}var sl,ty=v(()=>{B(),id(),rd(),Qv(),Jv(),sl=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(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){let{alias:e,src:i}=t;return Gr(e||i,r=>typeof r=="string"?r:Array.isArray(r)?r.map(n=>n?.src??n):r?.src?r.src:r,!0)}addManifest(t){this._manifest&&G("[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 i=[],r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,s])=>typeof s=="string"||Array.isArray(s)?{alias:n,src:s}:{alias:n,...s})),r.forEach(n=>{let s=n.src,a=n.alias,o;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);i.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));i.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[t]=i}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=r=>{this.hasKey(r)&&G(`[Resolver] already has key: ${r} overwriting`)},Gr(e).forEach(r=>{let{src:n}=r,{data:s,format:a,loadParser:o}=r,l=Gr(n).map(d=>typeof d=="string"?Zv(d):Array.isArray(d)?d:[d]),h=this.getAlias(r);Array.isArray(h)?h.forEach(i):i(h);let u=[];l.forEach(d=>{d.forEach(p=>{let g={};if(typeof p!="object"){g.src=p;for(let b=0;b{this._assetMap[d]=u})})}resolveBundle(t){let e=nl(t);t=Gr(t);let i={};return t.forEach(r=>{let n=this._bundles[r];if(n){let s=this.resolve(n),a={};for(let o in s){let l=s[o];a[this._extractAssetIdFromBundle(r,o)]=l}i[r]=a}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let i={};for(let r in e)i[r]=e[r].src;return i}return e.src}resolve(t){let e=nl(t);t=Gr(t);let i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r],s=this._getPreferredOrder(n);s?.priority.forEach(a=>{s.params[a].forEach(o=>{let l=n.filter(h=>h[a]?h[a]===o:!1);l.length&&(n=l)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(i.format));if(r)return r}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:i,data:r,loadParser:n,format:s}=e;return(this._basePath||this._rootPath)&&(t.src=rn.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=s??t.format??ey(t.src),t}},sl.RETINA_PREFIX=/@([0-9\.]+)x/}),al,iy=v(()=>{"use strict";al=(t,e)=>{let i=e.split("?")[1];return i&&(t+=`?${i}`),t}});function ry(){for(let t=0;t<16;t++){let e=[];Us.push(e);for(let i=0;i<16;i++){let r=Bn(_r[t]*_r[i]+yr[t]*vr[i]),n=Bn(vr[t]*_r[i]+xr[t]*vr[i]),s=Bn(_r[t]*yr[i]+yr[t]*xr[i]),a=Bn(vr[t]*yr[i]+xr[t]*xr[i]);for(let o=0;o<16;o++)if(_r[o]===r&&vr[o]===n&&yr[o]===s&&xr[o]===a){e.push(o);break}}}for(let t=0;t<16;t++){let e=new Ae;e.set(_r[t],vr[t],yr[t],xr[t],0,0),ol.push(e)}}var _r,vr,yr,xr,Us,ol,Bn,vt,ny=v(()=>{Xe(),_r=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],vr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],yr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],xr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Us=[],ol=[],Bn=Math.sign,ry(),vt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>_r[t],uY:t=>vr[t],vX:t=>yr[t],vY:t=>xr[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Us[t][e],sub:(t,e)=>Us[t][vt.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?vt.S:vt.N:Math.abs(e)*2<=Math.abs(t)?t>0?vt.E:vt.W:e>0?t>0?vt.SE:vt.SW:t>0?vt.NE:vt.NW,matrixAppendRotationInv:(t,e,i=0,r=0)=>{let n=ol[vt.inv(e)];n.tx=i,n.ty=r,t.append(n)}}}),ll,sy=v(()=>{"use strict";ll=()=>{}});function nn(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function sd(t){return!(t&t-1)&&!!t}var Ls=v(()=>{"use strict"});function ay(t){let e={};for(let i in t)t[i]!==void 0&&(e[i]=t[i]);return e}var oy=v(()=>{"use strict"});function ly(t){let e=hl[t];return e===void 0&&(hl[t]=ht("resource")),e}var hl,ul,ad,hy=v(()=>{gt(),yt(),_t(),hl=Object.create(null),ul=class nv extends qe{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...nv.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){We(je,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=ly(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},ul.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},ad=ul}),cl,Ft,di=v(()=>{gt(),Ls(),oy(),yt(),hy(),cl=class sv extends qe{constructor(e={}){super(),this.options=e,this.uid=ht("textureSource"),this._resourceType="textureSource",this._resourceId=ht("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...sv.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new ad(ay(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=ht("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,i,r){r=r||this._resolution,e=e||this.width,i=i||this.height;let n=Math.round(e*r),s=Math.round(i*r);return this.width=n/r,this.height=s/r,this._resolution=r,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=ht("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=sd(this.pixelWidth)&&sd(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}},cl.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Ft=cl}),Ns,od=v(()=>{te(),di(),Ns=class extends Ft{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}},Ns.extension=O.TextureSource}),dl,fl,ld=v(()=>{Xe(),dl=new Ae,fl=class{constructor(t,e){this.mapCoord=new Ae,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let i=this.mapCoord;for(let r=0;r{gt(),ny(),c(),yt(),_t(),sy(),od(),di(),ld(),ke=class extends qe{constructor({source:t,label:e,frame:i,orig:r,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=ht("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new at,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Ft,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=r||this.frame,this.trim=n,this.rotate=o??0,this.defaultAnchor=s,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new fl(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:i,height:r}=this._source,n=e.x/i,s=e.y/r,a=e.width/i,o=e.height/r,l=this.rotate;if(l){let h=a/2,u=o/2,d=n+h,p=s+u;l=vt.add(l,vt.NW),t.x0=d+h*vt.uX(l),t.y0=p+u*vt.uY(l),l=vt.add(l,2),t.x1=d+h*vt.uX(l),t.y1=p+u*vt.uY(l),l=vt.add(l,2),t.x2=d+h*vt.uX(l),t.y2=p+u*vt.uY(l),l=vt.add(l,2),t.x3=d+h*vt.uX(l),t.y3=p+u*vt.uY(l)}else t.x0=n,t.y0=s,t.x1=n+a,t.y1=s,t.x2=n+a,t.y2=s+o,t.x3=n,t.y3=s+o}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return We(je,"Texture.baseTexture is now Texture.source"),this._source}},ke.EMPTY=new ke({label:"EMPTY",source:new Ft({label:"EMPTY"})}),ke.EMPTY.destroy=ll,ke.WHITE=new ke({source:new Ns({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),ke.WHITE.destroy=ll}),pl,gl,uy=v(()=>{c(),pt(),pl=class As{constructor(e,i){this.linkedSheets=[],this._texture=e instanceof ke?e:null,this.textureSource=e.source,this.textures={},this.animations={},this.data=i;let r=parseFloat(i.meta.scale);r?(this.resolution=r,e.source.resolution=this.resolution):this.resolution=e.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=As.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let i=e,r=As.BATCH_SIZE;for(;i-e{this._batchIndex*As.BATCH_SIZE{r[n]=e}),Object.keys(e.textures).forEach(n=>{r[n]=e.textures[n]}),!i){let n=rn.dirname(t[0]);e.linkedSheets.forEach((s,a)=>{let o=hd([`${n}/${e.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(r,o)})}return r}var ud,cd,cy=v(()=>{$v(),ty(),iy(),te(),pt(),id(),uy(),ud=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],cd={extension:O.Asset,cache:{test:t=>t instanceof gl,getCacheableAssets:(t,e)=>hd(t,e,!1)},resolver:{extension:{type:O.ResolveParser,name:"resolveSpritesheet"},test:t=>{let e=t.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&ud.includes(r)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(sl.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:O.LoadParser,priority:il.Normal,name:"spritesheetLoader"},async testParse(t,e){return rn.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,i){let{texture:r,imageFilename:n}=e?.data??{},s=rn.dirname(e.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");let a;if(r instanceof ke)a=r;else{let h=al(s+(n??t.meta.image),e.src);a=(await i.load([h]))[h]}let o=new gl(a.source,t);await o.parse();let l=t?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let p=s+d;e.data?.ignoreMultiPack||(p=al(p,e.src),h.push(i.load({src:p,data:{ignoreMultiPack:!0}})))}let u=await Promise.all(h);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},async unload(t,e,i){await i.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}}}),ml=v(()=>{te(),cy(),ge.add(cd)});function Hs(t,e,i,r){let{width:n,height:s}=i.orig,a=i.trim;if(a){let o=a.width,l=a.height;t.minX=a.x-e._x*n-r,t.maxX=t.minX+o,t.minY=a.y-e._y*s-r,t.maxY=t.minY+l}else t.minX=-e._x*n-r,t.maxX=t.minX+n,t.minY=-e._y*s-r,t.maxY=t.minY+s}var _l=v(()=>{"use strict"}),zs,vl=v(()=>{y(),Ni(),zs=class extends bt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new m(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:i,y:r}=t;return i>=e.minX&&i<=e.maxX&&r>=e.minY&&r<=e.maxY}destroy(t){super.destroy(t),this._bounds=null}}}),Ws,dd=v(()=>{Cr(),pt(),_l(),vl(),Ws=class Sc extends zs{constructor(e=ke.EMPTY){e instanceof ke&&(e={texture:e});let{texture:i=ke.EMPTY,anchor:r,roundPixels:n,width:s,height:a,...o}=e;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new Tt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=n??!1,s!==void 0&&(this.width=s),a!==void 0&&(this.height=a)}static from(e,i=!1){return e instanceof ke?new Sc(e):new Sc(ke.from(e,i))}set texture(e){e||(e=ke.EMPTY);let i=this._texture;i!==e&&(i&&i.dynamic&&i.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,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 bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(e){let i=this.sourceBounds;return e.x>=i.maxX&&e.x<=i.minX&&e.y>=i.maxY&&e.y<=i.minY}addBounds(e){let i=this._texture.trim?this.sourceBounds:this.bounds;e.addFrame(i.minX,i.minY,i.maxX,i.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}_updateBounds(){Hs(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){let e=this._anchor,i=this._texture,r=this._sourceBounds,{width:n,height:s}=i.orig;r.maxX=-e._x*n,r.minX=r.maxX+n,r.maxY=-e._y*s,r.minY=r.maxY+s}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(i)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,i){typeof e=="object"?(i=e.height??e.width,e=e.width):i??(i=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),i!==void 0&&this._setHeight(i,this._texture.orig.height)}}});function fd(t,e,i){let r=pd;t.measurable=!0,R(t,i,r),e.addBoundsMask(r),t.measurable=!1}var pd,gd=v(()=>{y(),Q(),pd=new m});function md(t,e,i){let r=S.get();t.measurable=!0;let n=w.get().identity(),s=_d(t,i,n);X(t,r,s),t.measurable=!1,e.addBoundsMask(r),w.return(n),S.return(r)}function _d(t,e,i){return t?(t!==e&&(_d(t.parent,e,i),t.updateLocalTransform(),i.append(t.localTransform)),i):(G("Mask bounds, renderable is not inside the root container"),i)}var vd=v(()=>{ue(),P(),B()}),yl,dy=v(()=>{te(),dd(),gd(),vd(),yl=class{constructor(t){this.priority=0,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Ws),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){fd(this.mask,t,e)}addLocalBounds(t,e){md(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Ws}},yl.extension=O.MaskEffect}),xl,fy=v(()=>{te(),xl=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"}},xl.extension=O.MaskEffect}),bl,py=v(()=>{te(),Ni(),gd(),vd(),bl=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){fd(this.mask,t,e)}addLocalBounds(t,e){md(this.mask,t,e)}containsPoint(t,e){let i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof bt}},bl.extension=O.MaskEffect}),nr,In=v(()=>{Ot(),te(),di(),nr=class extends Ft{constructor(t){t.resource||(t.resource=ft.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;let e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(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,i=this._resolution){let r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}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"))}},nr.extension=O.TextureSource}),Gn,wl=v(()=>{Ot(),te(),B(),di(),Gn=class extends Ft{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=ft.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,G("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}},Gn.extension=O.TextureSource});async function gy(){return Tl??(Tl=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(s=>{let a=document.createElement("video");a.onloadeddata=()=>s(a),a.onerror=()=>s(null),a.autoplay=!1,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 i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);let r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Tl}var Tl,my=v(()=>{"use strict"}),On,yd,_y=v(()=>{te(),Fs(),my(),di(),On=class av extends Ft{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...av.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.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),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=Ci.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!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 e=this.resource,i=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(i.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await gy(),this._load=new Promise((r,n)=>{this.isValid?r(this):(this._resolve=r,this._reject=n,i.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${i.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.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 e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.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 e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ci.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,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||(Ci.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ci.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}},On.extension=O.TextureSource,On.defaultOptions={...Ft.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},On.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},yd=On}),xd,Ht,js=v(()=>{B(),rd(),xd=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||G(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i=Gr(t),r;for(let o=0;o{n.set(o,e)});let s=[...n.keys()],a={cacheKeys:s,keys:i};i.forEach(o=>{this._cacheMap.set(o,a)}),s.forEach(o=>{let l=r?r[o]:e;this._cache.has(o)&&this._cache.get(o)!==l&&G("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(t){if(!this._cacheMap.has(t)){G(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}},Ht=new xd});function bd(t={}){let e=t&&t.resource,i=e?t.resource:t,r=e?t:{resource:t};for(let n=0;n{Ht.has(r)&&Ht.remove(r)}),e||Ht.set(r,s),s}function yy(t,e=!1){return typeof t=="string"?Ht.get(t):t instanceof Ft?new ke({source:t}):vy(t,e)}var Vs,wd=v(()=>{js(),te(),di(),pt(),Vs=[],ge.handleByList(O.TextureSource,Vs),ke.from=yy,Ft.from=bd}),Sl=v(()=>{te(),dy(),fy(),py(),od(),In(),wl(),_y(),wd(),ge.add(yl,xl,bl,yd,Gn,nr,Ns)}),zi,Or=v(()=>{"use strict";zi=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let i in t){let r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){let i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let i in e)e[i]._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=!0,t.destroyed){let e=this.resources;for(let i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}});function Td(){return(!$s||$s?.isContextLost())&&($s=ft.get().createCanvas().getContext("webgl",{})),$s}var $s,Sd=v(()=>{Ot()});function xy(t){let e="";for(let i=0;i0&&(e+=`
else `),i{"use strict";Ed=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
`)});function sn(){if(Fr)return Fr;let t=Td();return Fr=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Fr=by(Fr,t),t.getExtension("WEBGL_lose_context")?.loseContext(),Fr}var Fr,an=v(()=>{Sd(),wy(),Fr=null});function El(t,e){let i=2166136261;for(let r=0;r>>=0;return Al[i]||Ty(t,e,i)}function Ty(t,e,i){let r={},n=0;Xs||(Xs=sn());for(let a=0;a{Or(),pt(),an(),Al={},Xs=0}),Ml,Sy=v(()=>{"use strict";Ml=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 Pl(t,e){let i=t.byteLength/8|0,r=new Float64Array(t,0,i);new Float64Array(e,0,i).set(r);let n=t.byteLength-i*8;if(n>0){let s=new Uint8Array(t,i*8,n);new Uint8Array(e,i*8,n).set(s)}}var Ad=v(()=>{"use strict"}),Cd,Dt,on=v(()=>{"use strict";Cd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Dt=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",t[t.NONE=4]="NONE",t))(Dt||{})});function Ys(t,e){return e.alphaMode==="no-premultiply-alpha"&&Cd[t]||t}var Rl=v(()=>{on()}),Md,Ey=v(()=>{"use strict";Md=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t0?kl[--qs]:new kd}function Rd(t){kl[qs++]=t}var kd,kl,qs,ln,Bl,Bd,Ay=v(()=>{yt(),Sy(),Ad(),Rl(),an(),Ey(),kd=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Md,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},kl=[],qs=0,ln=0,Bl=class Io{constructor(e={}){this.uid=ht("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Io.defaultOptions.maxTextures=Io.defaultOptions.maxTextures??sn(),e={...Io.defaultOptions,...e};let{maxTextures:i,attributesInitialSize:r,indicesInitialSize:n}=e;this.attributeBuffer=new Ml(r*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=i}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;ethis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let o=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,p="startBatch",g=this.maxTextures;for(let b=this.elementStart;b=g||C)&&(this._finishBatch(r,d,u-d,n,a,e,p),p="renderBatch",d=u,a=T,r=Pd(),n=r.textures,n.clear(),++ln),x._textureId=_._textureBindLocation=n.count,n.ids[_.uid]=n.count,n.textures[n.count++]=_,x._batch=r,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,o,l,x._attributeStart,x._textureId),this.packQuadIndex(h,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,o,l,x._attributeStart,x._textureId),this.packIndex(x,h,x._indexStart,x._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(r,d,u-d,n,a,e,p),d=u,++ln),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(e,i,r,n,s,a,o){e.gpuBindGroup=null,e.bindGroup=null,e.action=o,e.batcher=this,e.textures=n,e.blendMode=s,e.start=i,e.size=r,++ln,this.batches[this.batchIndex++]=e,a.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let i=Math.max(e,this.attributeBuffer.size*2),r=new Ml(i);Pl(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){let i=this.indexBuffer,r=Math.max(e,i.length*1.5);r+=r%2;let n=r>65535?new Uint32Array(r):new Uint16Array(r);if(n.BYTES_PER_ELEMENT!==i.BYTES_PER_ELEMENT)for(let s=0;s{"use strict";et=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(et||{})}),bi,hn=v(()=>{gt(),yt(),Dr(),bi=class extends qe{constructor(t){let{data:e,size:i}=t,{usage:r,label:n,shrinkToFit:s}=t;super(),this.uid=ht("buffer"),this._resourceType="buffer",this._resourceId=ht("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i=i??e?.byteLength;let a=!!e;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&et.STATIC)}set static(t){t?this.descriptor.usage|=et.STATIC:this.descriptor.usage&=~et.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}let r=this._data;if(this._data=t,r.length!==t.length){!this.shrinkToFit&&t.byteLength{hn(),Dr()});function My(t,e,i){let r=t.getAttribute(e);if(!r)return i.minX=0,i.minY=0,i.maxX=0,i.maxY=0,i;let n=r.buffer.data,s=1/0,a=1/0,o=-1/0,l=-1/0,h=n.BYTES_PER_ELEMENT,u=(r.offset||0)/h,d=(r.stride||2*4)/h;for(let p=u;po&&(o=g),b>l&&(l=b),g{"use strict"});function Ry(t){return(t instanceof bi||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Id(t.buffer,!1),t}var Fn,Ks=v(()=>{gt(),y(),yt(),hn(),Cy(),Py(),Fn=class extends qe{constructor(t){let{attributes:e,indexBuffer:i,topology:r}=t;super(),this.uid=ht("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new m,this._boundsDirty=!0,this.attributes=e,this.buffers=[],this.instanceCount=t.instanceCount||1;for(let n in e){let s=e[n]=Ry(e[n]);this.buffers.indexOf(s.buffer)===-1&&(this.buffers.push(s.buffer),s.buffer.on("update",this.onBufferUpdate,this),s.buffer.on("change",this.onBufferUpdate,this))}i&&(this.indexBuffer=Id(i,!0),this.buffers.push(this.indexBuffer)),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,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}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,My(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){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}}}),Gd,Od,Fd,ky=v(()=>{hn(),Dr(),Ks(),Gd=new Float32Array(1),Od=new Uint32Array(1),Fd=class extends Fn{constructor(){let t=new bi({data:Gd,label:"attribute-batch-buffer",usage:et.VERTEX|et.COPY_DST,shrinkToFit:!1}),e=new bi({data:Od,label:"index-batch-buffer",usage:et.INDEX|et.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:4*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:5*4}},indexBuffer:e})}}});function Dn(t,e){let i=Il[t];return i===void 0&&(Zs[e]===void 0&&(Zs[e]=1),Il[t]=i=Zs[e]++),i}var Zs,Il,Qs=v(()=>{"use strict";Zs=Object.create(null),Il=Object.create(null)});function By(){if(!Js){Js="mediump";let t=Td();t&&t.getShaderPrecisionFormat&&(Js=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return Js}var Js,Iy=v(()=>{Sd()});function Gy(t,e,i){return e?t:i?(t=t.replace("out vec4 finalColor;",""),`
#ifdef GL_ES // This checks if it is WebGL1
#define in varying
#define finalColor gl_FragColor
#define texture texture2D
#endif
${t}
`):`
#ifdef GL_ES // This checks if it is WebGL1
#define in attribute
#define out varying
#endif
${t}
`}var Oy=v(()=>{"use strict"});function Fy(t,e,i){let r=i?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let n=i?e.requestedFragmentPrecision:e.requestedVertexPrecision;return n==="highp"&&r!=="highp"&&(n="mediump"),`precision ${n} float;
${t}`}else if(r!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var Dy=v(()=>{"use strict"});function Uy(t,e){return e?`#version 300 es
${t}`:t}var Ly=v(()=>{"use strict"});function Ny(t,{name:e="pixi-program"},i=!0){e=e.replace(/\s+/g,"-"),e+=i?"-fragment":"-vertex";let r=i?Dd:Ud;return r[e]?(r[e]++,e+=`-${r[e]}`):r[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`}
${t}`}var Dd,Ud,Hy=v(()=>{"use strict";Dd={},Ud={}});function zy(t,e){return e?t.replace("#version 300 es",""):t}var Wy=v(()=>{"use strict"}),ea,ta,Gl,un,Un=v(()=>{Qs(),Iy(),Oy(),Dy(),Ly(),Hy(),Wy(),ea={stripVersion:zy,ensurePrecision:Fy,addProgramDefines:Gy,setProgramName:Ny,insertVersion:Uy},ta=Object.create(null),Gl=class Ec{constructor(e){e={...Ec.defaultOptions,...e};let i=e.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:i,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:By()},setProgramName:{name:e.name},addProgramDefines:i,insertVersion:i},n=e.fragment,s=e.vertex;Object.keys(ea).forEach(a=>{let o=r[a];n=ea[a](n,o,!0),s=ea[a](s,o,!1)}),this.fragment=n,this.vertex=s,this._key=Dn(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(e){let i=`${e.vertex}:${e.fragment}`;return ta[i]||(ta[i]=new Ec(e)),ta[i]}},Gl.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},un=Gl});function Ln(t){return Ol[t]??Ol.float32}var Ol,ia=v(()=>{"use strict";Ol={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function jy({source:t,entryPoint:e}){let i={},r=t.indexOf(`fn ${e}`);if(r!==-1){let n=t.indexOf("->",r);if(n!==-1){let s=t.substring(r,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,o;for(;(o=a.exec(s))!==null;){let l=Ld[o[3]]??"float32";i[o[2]]={location:parseInt(o[1],10),format:l,stride:Ln(l).stride,offset:0,instance:!1,start:0}}}}return i}var Ld,Vy=v(()=>{ia(),Ld={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"}});function Fl(t){let e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,i=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=t.match(e)?.map(d=>({group:parseInt(d.match(i)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(n)[2],isUniform:d.match(n)[1]==="",type:d.match(s)[1]}));if(!h)return{groups:[],structs:[]};let u=t.match(a)?.map(d=>{let p=d.match(l)[1],g=d.match(o).reduce((b,x)=>{let[_,T]=x.split(":");return b[_.trim()]=T.trim(),b},{});return g?{name:p,members:g}:null}).filter(({name:d})=>h.some(p=>p.type===d))??[];return{groups:h,structs:u}}var $y=v(()=>{"use strict"}),cn,Xy=v(()=>{"use strict";cn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(cn||{})});function Yy({groups:t}){let e=[];for(let i=0;i{Xy()});function Ky({groups:t}){let e=[];for(let i=0;i{"use strict"});function Qy(t,e){let i=new Set,r=new Set,n=[...t.structs,...e.structs].filter(a=>i.has(a.name)?!1:(i.add(a.name),!0)),s=[...t.groups,...e.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:n,groups:s}}var Jy=v(()=>{"use strict"}),ra,Nn,na=v(()=>{Qs(),Vy(),$y(),qy(),Zy(),Jy(),ra=Object.create(null),Nn=class ov{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:i,vertex:r,layout:n,gpuLayout:s,name:a}=e;if(this.name=a,this.fragment=i,this.vertex=r,i.source===r.source){let o=Fl(i.source);this.structsAndGroups=o}else{let o=Fl(r.source),l=Fl(i.source);this.structsAndGroups=Qy(o,l)}this.layout=n??Ky(this.structsAndGroups),this.gpuLayout=s??Yy(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:e,fragment:i}=this,r=e.source+i.source+e.entryPoint+i.entryPoint;this._layoutKey=Dn(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=jy(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(e){let i=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return ra[i]||(ra[i]=new ov(e)),ra[i]}}});function Nd(t,e,i){if(t)for(let r in t){let n=r.toLocaleLowerCase(),s=e[n];if(s){let a=t[r];r==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),i&&s.push(`//----${i}----//`),s.push(a)}else G(`${r} placement hook does not exist in shader`)}}var ex=v(()=>{B()});function Hd(t){let e={};return(t.match(zd)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{e[i]=[]}),e}var zd,tx=v(()=>{"use strict";zd=/\{\{(.*?)\}\}/g});function Wd(t,e){let i,r=/@in\s+([^;]+);/g;for(;(i=r.exec(t))!==null;)e.push(i[1])}function jd(t,e,i=!1){let r=[];Wd(e,r),t.forEach(o=>{o.header&&Wd(o.header,r)});let n=r;i&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(`
`),a=e.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
${s}
`),a}var ix=v(()=>{"use strict"});function Vd(t,e){let i,r=/@out\s+([^;]+);/g;for(;(i=r.exec(t))!==null;)e.push(i[1])}function rx(t){let e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}function nx(t){let e=/@.*?\s+/g;return t.replace(e,"")}function sx(t,e){let i=[];Vd(e,i),t.forEach(l=>{l.header&&Vd(l.header,i)});let r=0,n=i.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
`),s=i.sort().map(l=>` var ${nx(l)};`).join(`
`),a=`return VSOutput(
${i.sort().map(l=>` ${rx(l)}`).join(`,
`)});`,o=e.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
${n}
`),o=o.replace("{{start}}",`
${s}
`),o=o.replace("{{return}}",`
${a}
`),o}var ax=v(()=>{"use strict"});function $d(t,e){let i=t;for(let r in e){let n=e[r];n.join(`
`).length?i=i.replace(`{{${r}}}`,`//-----${r} START-----//
${n.join(`
`)}
//----${r} FINISH----//`):i=i.replace(`{{${r}}}`,"")}return i}var ox=v(()=>{"use strict"});function lx({template:t,bits:e}){let i=Xd(t,e);if(br[i])return br[i];let{vertex:r,fragment:n}=ux(t,e);return br[i]=Yd(r,n,e),br[i]}function hx({template:t,bits:e}){let i=Xd(t,e);return br[i]||(br[i]=Yd(t.vertex,t.fragment,e)),br[i]}function ux(t,e){let i=e.map(a=>a.vertex).filter(a=>!!a),r=e.map(a=>a.fragment).filter(a=>!!a),n=jd(i,t.vertex,!0);n=sx(i,n);let s=jd(r,t.fragment,!0);return{vertex:n,fragment:s}}function Xd(t,e){return e.map(i=>(sa.has(i)||sa.set(i,qd++),sa.get(i))).sort((i,r)=>i-r).join("-")+t.vertex+t.fragment}function Yd(t,e,i){let r=Hd(t),n=Hd(e);return i.forEach(s=>{Nd(s.vertex,r,s.name),Nd(s.fragment,n,s.name)}),{vertex:$d(t,r),fragment:$d(e,n)}}var br,sa,qd,cx=v(()=>{ex(),tx(),ix(),ax(),ox(),br=Object.create(null),sa=new Map,qd=0}),Kd,Zd,Qd,Jd,dx=v(()=>{"use strict";Kd=`
@in aPosition: vec2;
@in aUV: vec2;
@out @builtin(position) vPosition: vec4;
@out vUV : vec2;
@out vColor : vec4;
{{header}}
struct VSOutput {
{{struct}}
};
@vertex
fn main( {{in}} ) -> VSOutput {
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
var modelMatrix = mat3x3(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
var position = aPosition;
var uv = aUV;
{{start}}
vColor = vec4(1., 1., 1., 1.);
{{main}}
vUV = uv;
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
vColor *= globalUniforms.uWorldColorAlpha;
{{end}}
{{return}}
};
`,Zd=`
@in vUV : vec2;
@in vColor : vec4;
{{header}}
@fragment
fn main(
{{in}}
) -> @location(0) vec4 {
{{start}}
var outColor:vec4;
{{main}}
var finalColor:vec4 = outColor * vColor;
{{end}}
return finalColor;
};
`,Qd=`
in vec2 aPosition;
in vec2 aUV;
out vec4 vColor;
out vec2 vUV;
{{header}}
void main(void){
mat3 worldTransformMatrix = uWorldTransformMatrix;
mat3 modelMatrix = mat3(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
vec2 position = aPosition;
vec2 uv = aUV;
{{start}}
vColor = vec4(1.);
{{main}}
vUV = uv;
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
vColor *= uWorldColorAlpha;
{{end}}
}
`,Jd=`
in vec4 vColor;
in vec2 vUV;
out vec4 finalColor;
{{header}}
void main(void) {
{{start}}
vec4 outColor;
{{main}}
finalColor = outColor * vColor;
{{end}}
}
`}),ef,tf,fx=v(()=>{"use strict";ef={name:"global-uniforms-bit",vertex:{header:`
struct GlobalUniforms {
uProjectionMatrix:mat3x3,
uWorldTransformMatrix:mat3x3,
uWorldColorAlpha: vec4,
uResolution: vec2,
}
@group(0) @binding(0) var globalUniforms : GlobalUniforms;
`}},tf={name:"global-uniforms-bit",vertex:{header:`
uniform mat3 uProjectionMatrix;
uniform mat3 uWorldTransformMatrix;
uniform vec4 uWorldColorAlpha;
uniform vec2 uResolution;
`}}});function Hn({bits:t,name:e}){let i=lx({template:{fragment:Zd,vertex:Kd},bits:[ef,...t]});return Nn.from({name:e,vertex:{source:i.vertex,entryPoint:"main"},fragment:{source:i.fragment,entryPoint:"main"}})}function zn({bits:t,name:e}){return new un({name:e,...hx({template:{vertex:Qd,fragment:Jd},bits:[tf,...t]})})}var Ur=v(()=>{Un(),na(),cx(),dx(),fx()}),aa,oa,la=v(()=>{"use strict";aa={name:"color-bit",vertex:{header:`
@in aColor: vec4;
`,main:`
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
`}},oa={name:"color-bit",vertex:{header:`
in vec4 aColor;
`,main:`
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
`}}});function px(t){let e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let i=0;for(let r=0;r;`),e.push(`@group(1) @binding(${i++}) var textureSampler${r+1}: sampler;`)}return e.join(`
`)}function gx(t){let e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let i=0;i;
@out @interpolate(flat) vTextureId : u32;
`,main:`
vTextureId = aTextureIdAndRound.y;
`,end:`
if(aTextureIdAndRound.x == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
@in @interpolate(flat) vTextureId: u32;
${px(t)}
`,main:`
var uvDx = dpdx(vUV);
var uvDy = dpdy(vUV);
${gx(t)}
`}}),ha[t]}function mx(t){let e=[];for(let i=0;i0&&e.push("else"),i{"use strict";ha={},ua={}}),dn,fn,Lr=v(()=>{"use strict";dn={name:"round-pixels-bit",vertex:{header:`
fn roundPixels(position: vec2, targetSize: vec2) -> vec2
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}},fn={name:"round-pixels-bit",vertex:{header:`
vec2 roundPixels(vec2 position, vec2 targetSize)
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}}}),Ll,rf,_x=v(()=>{"use strict";Ll=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],rf=Ll.reduce((t,e)=>(t[e]=!0,t),{})});function vx(t,e){switch(t){case"f32":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var yx=v(()=>{"use strict"}),Nl,ti,fi=v(()=>{yt(),Qs(),_x(),yx(),Nl=class lv{constructor(e,i){this._touched=0,this.uid=ht("uniform"),this._resourceType="uniformGroup",this._resourceId=ht("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,i={...lv.defaultOptions,...i},this.uniformStructures=e;let r={};for(let n in e){let s=e[n];if(s.name=n,s.size=s.size??1,!rf[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Ll.join(", ")}`);s.value??(s.value=vx(s.type,s.size)),r[n]=s.value}this.uniforms=r,this._dirtyId=1,this.ubo=i.ubo,this.isStatic=i.isStatic,this._signature=Dn(Object.keys(r).map(n=>`${n}-${e[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},Nl.defaultOptions={ubo:!1,isStatic:!1},ti=Nl});function Hl(t){let e=zl[t];if(e)return e;let i=new Int32Array(t);for(let r=0;r{fi(),zl={}}),wi,sr=v(()=>{"use strict";wi=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(wi||{})}),Wi,ar=v(()=>{gt(),Un(),Or(),na(),sr(),fi(),Wi=class hv extends qe{constructor(e){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:i,glProgram:r,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=e;this.gpuProgram=i,this.glProgram=r,a===void 0&&(a=0,i&&(a|=wi.WEBGPU),r&&(a|=wi.WEBGL)),this.compatibleRenderers=a;let l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!i&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!i&&n&&o)for(let h in o)for(let u in o[h]){let d=o[h][u];l[d]={group:h,binding:u,name:d}}else if(i&&n&&!o){let h=i.structsAndGroups.groups;o={},h.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u})}else if(s){n={},o={},i&&i.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let u in s)l[u]||(n[99]||(n[99]=new zi,this._ownedBindGroups.push(n[99])),l[u]={group:99,binding:h,name:u},o[99]=o[99]||{},o[99][h]=u,h++);for(let u in s){let d=u,p=s[u];!p.source&&!p._resourceType&&(p=new ti(p));let g=l[d];g&&(n[g.group]||(n[g.group]=new zi,this._ownedBindGroups.push(n[g.group])),n[g.group].setResource(p,g.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(e,i,r){var n,s;(n=this._uniformBindMap)[i]||(n[i]={}),(s=this._uniformBindMap[i])[r]||(s[r]=e),this.groups[i]||(this.groups[i]=new zi,this._ownedBindGroups.push(this.groups[i]))}_buildResourceAccessor(e,i){let r={};for(let n in i){let s=i[n];Object.defineProperty(r,s.name,{get(){return e[s.group].getResource(s.binding)},set(a){e[s.group].setResource(a,s.binding)}})}return r}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:i,gl:r,...n}=e,s,a;return i&&(s=Nn.from(i)),r&&(a=un.from(r)),new hv({gpuProgram:s,glProgram:a,...n})}}}),nf,xx=v(()=>{Ur(),la(),ca(),Lr(),Wl(),ar(),nf=class extends Wi{constructor(t){let e=zn({name:"batch",bits:[oa,Ul(t),fn]}),i=Hn({name:"batch",bits:[aa,Dl(t),dn]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Hl(t)}})}}}),jl,Vl,da,sf=v(()=>{te(),Ay(),ky(),xx(),jl=null,Vl=class uv extends Bd{constructor(){super(...arguments),this.geometry=new Fd,this.shader=jl||(jl=new nf(this.maxTextures)),this.name=uv.extension.name,this.vertexSize=6}packAttributes(e,i,r,n,s){let a=s<<16|e.roundPixels&65535,o=e.transform,l=o.a,h=o.b,u=o.c,d=o.d,p=o.tx,g=o.ty,{positions:b,uvs:x}=e,_=e.color,T=e.attributeOffset,C=T+e.attributeSize;for(let F=T;F{"use strict"});function af(t,e,i,r,n){let s=e.a,a=e.b,o=e.c,l=e.d,h=e.tx,u=e.ty;i=i||0,r=r||2,n=n||t.length/r-i;let d=i*r;for(let p=0;p{"use strict"});function Ex(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;let i=t>>16&255,r=t>>8&255,n=t&255,s=e>>16&255,a=e>>8&255,o=e&255,l=i*s/255,h=r*a/255,u=n*o/255;return(l<<16)+(h<<8)+u}var Ax=v(()=>{"use strict"}),of,fa,lf=v(()=>{Xe(),Ax(),of=new Ae,fa=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,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.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Ex(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||of}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}reset(){this.applyTransform=!0,this.renderable=null}}}),pn,hf,uf,Cx=v(()=>{te(),pn={extension:{type:O.ShapeBuilder,name:"circle"},build(t,e){let i,r,n,s,a,o;if(t.type==="circle"){let k=t;i=k.x,r=k.y,a=o=k.radius,n=s=0}else if(t.type==="ellipse"){let k=t;i=k.x,r=k.y,a=k.halfWidth,o=k.halfHeight,n=s=0}else{let k=t,N=k.width/2,re=k.height/2;i=k.x+N,r=k.y+re,a=o=Math.max(0,Math.min(k.radius,Math.min(N,re))),n=N-a,s=re-o}if(!(a>=0&&o>=0&&n>=0&&s>=0))return e;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return e;if(l===0)return e[0]=e[6]=i+n,e[1]=e[3]=r+s,e[2]=e[4]=i-n,e[5]=e[7]=r-s,e;let u=0,d=l*4+(n?2:0)+2,p=d,g=h,b=n+a,x=s,_=i+b,T=i-b,C=r+x;if(e[u++]=_,e[u++]=C,e[--d]=C,e[--d]=T,s){let k=r-x;e[p++]=T,e[p++]=k,e[--g]=k,e[--g]=_}for(let k=1;k0&&(n[s++]=l,n[s++]=h,n[s++]=l-1),l++;n[s++]=h+1,n[s++]=h,n[s++]=l-1}},hf={...pn,extension:{...pn.extension,name:"ellipse"}},uf={...pn,extension:{...pn.extension,name:"roundedRectangle"}}});function Mx(t){let e=t.length;if(e<6)return 1;let i=0;for(let r=0,n=t[e-2],s=t[e-1];r{"use strict"});function cf(t,e,i,r,n,s,a,o){let l=t-i*n,h=e-r*n,u=t+i*s,d=e+r*s,p,g;a?(p=r,g=-i):(p=-r,g=i);let b=l+p,x=h+g,_=u+p,T=d+g;return o.push(b,x),o.push(_,T),2}function Nr(t,e,i,r,n,s,a,o){let l=i-t,h=r-e,u=Math.atan2(l,h),d=Math.atan2(n-t,s-e);o&&ud&&(d+=Math.PI*2);let p=u,g=d-u,b=Math.abs(g),x=Math.sqrt(l*l+h*h),_=(15*b*Math.sqrt(x)/Math.PI>>0)+1,T=g/_;if(p+=T,o){a.push(t,e),a.push(i,r);for(let C=1,F=p;C<_;C++,F+=T)a.push(t,e),a.push(t+Math.sin(F)*x,e+Math.cos(F)*x);a.push(t,e),a.push(n,s)}else{a.push(i,r),a.push(t,e);for(let C=1,F=p;C<_;C++,F+=T)a.push(t+Math.sin(F)*x,e+Math.cos(F)*x),a.push(t,e);a.push(n,s),a.push(t,e)}return _*2}function Rx(t,e,i,r,n,s,a,o,l){let h=1e-4;if(t.length===0)return;let u=e,d=u.alignment;if(e.alignment!==.5){let L=Mx(t);i&&(L*=-1),d=(d-.5)*L+.5}let p=new De(t[0],t[1]),g=new De(t[t.length-2],t[t.length-1]),b=r,x=Math.abs(p.x-g.x)=0&&(u.join==="round"?C+=Nr($,ie,$-ce*M,ie-D*M,$-se*M,ie-q*M,_,!1)+4:C+=2,_.push($-se*E,ie-q*E),_.push($+se*M,ie+q*M));continue}let $e=(-ce+ne)*(-D+ie)-(-ce+$)*(-D+J),wt=(-se+Se)*(-q+ie)-(-se+$)*(-q+Pe),Ye=(Z*wt-ae*$e)/Fe,mi=(be*$e-K*wt)/Fe,Ii=(Ye-$)*(Ye-$)+(mi-ie)*(mi-ie),Y=$+(Ye-$)*M,oe=ie+(mi-ie)*M,he=$-(Ye-$)*E,me=ie-(mi-ie)*E,Et=Math.min(Z*Z+K*K,ae*ae+be*be),Ss=Le?M:E,wc=Et+Ss*Ss*N;Ii<=wc?u.join==="bevel"||Ii/N>re?(Le?(_.push(Y,oe),_.push($+ce*E,ie+D*E),_.push(Y,oe),_.push($+se*E,ie+q*E)):(_.push($-ce*M,ie-D*M),_.push(he,me),_.push($-se*M,ie-q*M),_.push(he,me)),C+=2):u.join==="round"?Le?(_.push(Y,oe),_.push($+ce*E,ie+D*E),C+=Nr($,ie,$+ce*E,ie+D*E,$+se*E,ie+q*E,_,!0)+4,_.push(Y,oe),_.push($+se*E,ie+q*E)):(_.push($-ce*M,ie-D*M),_.push(he,me),C+=Nr($,ie,$-ce*M,ie-D*M,$-se*M,ie-q*M,_,!1)+4,_.push($-se*M,ie-q*M),_.push(he,me)):(_.push(Y,oe),_.push(he,me)):(_.push($-ce*M,ie-D*M),_.push($+ce*E,ie+D*E),u.join==="round"?Le?C+=Nr($,ie,$+ce*E,ie+D*E,$+se*E,ie+q*E,_,!0)+2:C+=Nr($,ie,$-ce*M,ie-D*M,$-se*M,ie-q*M,_,!1)+2:u.join==="miter"&&Ii/N<=re&&(Le?(_.push(he,me),_.push(he,me)):(_.push(Y,oe),_.push(Y,oe)),C+=2),_.push($-se*M,ie-q*M),_.push($+se*E,ie+q*E),C+=2)}ne=t[(T-2)*2],J=t[(T-2)*2+1],$=t[(T-1)*2],ie=t[(T-1)*2+1],ce=-(J-ie),D=ne-$,de=Math.sqrt(ce*ce+D*D),ce/=de,D/=de,ce*=k,D*=k,_.push($-ce*M,ie-D*M),_.push($+ce*E,ie+D*E),b||(u.cap==="round"?C+=Nr($-ce*(M-E)*.5,ie-D*(M-E)*.5,$-ce*M,ie-D*M,$+ce*E,ie+D*E,_,!1)+2:u.cap==="square"&&(C+=cf($,ie,ce,D,M,E,!1,_)));let z=1e-4*1e-4;for(let L=F;L{jt(),Px()}),df=Ne((t,e)=>{"use strict";e.exports=i,e.exports.default=i;function i(A,M,E){E=E||2;var z=M&&M.length,L=z?M[0]*E:A.length,Z=r(A,0,L,E,!0),K=[];if(!Z||Z.next===Z.prev)return K;var ae,be,_e,Fe,Le,$e,wt;if(z&&(Z=u(A,M,Z,E)),A.length>80*E){ae=_e=A[0],be=Fe=A[1];for(var Ye=E;Ye_e&&(_e=Le),$e>Fe&&(Fe=$e);wt=Math.max(_e-ae,Fe-be),wt=wt!==0?32767/wt:0}return s(Z,K,E,ae,be,wt,0),K}function r(A,M,E,z,L){var Z,K;if(L===de(A,M,E,z)>0)for(Z=M;Z=M;Z-=z)K=D(Z,A[Z],A[Z+1],K);return K&&re(K,K.next)&&(se(K),K=K.next),K}function n(A,M){if(!A)return A;M||(M=A);var E=A,z;do if(z=!1,!E.steiner&&(re(E,E.next)||N(E.prev,E,E.next)===0)){if(se(E),E=M=E.prev,E===E.next)break;z=!0}else E=E.next;while(z||E!==M);return M}function s(A,M,E,z,L,Z,K){if(A){!K&&Z&&x(A,z,L,Z);for(var ae=A,be,_e;A.prev!==A.next;){if(be=A.prev,_e=A.next,Z?o(A,z,L,Z):a(A)){M.push(be.i/E|0),M.push(A.i/E|0),M.push(_e.i/E|0),se(A),A=_e.next,ae=_e.next;continue}if(A=_e,A===ae){K?K===1?(A=l(n(A),M,E),s(A,M,E,z,L,Z,2)):K===2&&h(A,M,E,z,L,Z):s(n(A),M,E,z,L,Z,1);break}}}}function a(A){var M=A.prev,E=A,z=A.next;if(N(M,E,z)>=0)return!1;for(var L=M.x,Z=E.x,K=z.x,ae=M.y,be=E.y,_e=z.y,Fe=LZ?L>K?L:K:Z>K?Z:K,wt=ae>be?ae>_e?ae:_e:be>_e?be:_e,Ye=z.next;Ye!==M;){if(Ye.x>=Fe&&Ye.x<=$e&&Ye.y>=Le&&Ye.y<=wt&&F(L,ae,Z,be,K,_e,Ye.x,Ye.y)&&N(Ye.prev,Ye,Ye.next)>=0)return!1;Ye=Ye.next}return!0}function o(A,M,E,z){var L=A.prev,Z=A,K=A.next;if(N(L,Z,K)>=0)return!1;for(var ae=L.x,be=Z.x,_e=K.x,Fe=L.y,Le=Z.y,$e=K.y,wt=aebe?ae>_e?ae:_e:be>_e?be:_e,Ii=Fe>Le?Fe>$e?Fe:$e:Le>$e?Le:$e,Y=T(wt,Ye,M,E,z),oe=T(mi,Ii,M,E,z),he=A.prevZ,me=A.nextZ;he&&he.z>=Y&&me&&me.z<=oe;){if(he.x>=wt&&he.x<=mi&&he.y>=Ye&&he.y<=Ii&&he!==L&&he!==K&&F(ae,Fe,be,Le,_e,$e,he.x,he.y)&&N(he.prev,he,he.next)>=0||(he=he.prevZ,me.x>=wt&&me.x<=mi&&me.y>=Ye&&me.y<=Ii&&me!==L&&me!==K&&F(ae,Fe,be,Le,_e,$e,me.x,me.y)&&N(me.prev,me,me.next)>=0))return!1;me=me.nextZ}for(;he&&he.z>=Y;){if(he.x>=wt&&he.x<=mi&&he.y>=Ye&&he.y<=Ii&&he!==L&&he!==K&&F(ae,Fe,be,Le,_e,$e,he.x,he.y)&&N(he.prev,he,he.next)>=0)return!1;he=he.prevZ}for(;me&&me.z<=oe;){if(me.x>=wt&&me.x<=mi&&me.y>=Ye&&me.y<=Ii&&me!==L&&me!==K&&F(ae,Fe,be,Le,_e,$e,me.x,me.y)&&N(me.prev,me,me.next)>=0)return!1;me=me.nextZ}return!0}function l(A,M,E){var z=A;do{var L=z.prev,Z=z.next.next;!re(L,Z)&&ne(L,z,z.next,Z)&&Se(L,Z)&&Se(Z,L)&&(M.push(L.i/E|0),M.push(z.i/E|0),M.push(Z.i/E|0),se(z),se(z.next),z=A=Z),z=z.next}while(z!==A);return n(z)}function h(A,M,E,z,L,Z){var K=A;do{for(var ae=K.next.next;ae!==K.prev;){if(K.i!==ae.i&&k(K,ae)){var be=ce(K,ae);K=n(K,K.next),be=n(be,be.next),s(K,M,E,z,L,Z,0),s(be,M,E,z,L,Z,0);return}ae=ae.next}K=K.next}while(K!==A)}function u(A,M,E,z){var L=[],Z,K,ae,be,_e;for(Z=0,K=M.length;Z=E.next.y&&E.next.y!==E.y){var ae=E.x+(L-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(ae<=z&&ae>Z&&(Z=ae,K=E.x=E.x&&E.x>=_e&&z!==E.x&&F(LK.x||E.x===K.x&&b(K,E)))&&(K=E,Le=$e)),E=E.next;while(E!==be);return K}function b(A,M){return N(A.prev,A,M.prev)<0&&N(M.next,A,A.next)<0}function x(A,M,E,z){var L=A;do L.z===0&&(L.z=T(L.x,L.y,M,E,z)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==A);L.prevZ.nextZ=null,L.prevZ=null,_(L)}function _(A){var M,E,z,L,Z,K,ae,be,_e=1;do{for(E=A,A=null,Z=null,K=0;E;){for(K++,z=E,ae=0,M=0;M<_e&&(ae++,z=z.nextZ,!!z);M++);for(be=_e;ae>0||be>0&&z;)ae!==0&&(be===0||!z||E.z<=z.z)?(L=E,E=E.nextZ,ae--):(L=z,z=z.nextZ,be--),Z?Z.nextZ=L:A=L,L.prevZ=Z,Z=L;E=z}Z.nextZ=null,_e*=2}while(K>1);return A}function T(A,M,E,z,L){return A=(A-E)*L|0,M=(M-z)*L|0,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,M=(M|M<<8)&16711935,M=(M|M<<4)&252645135,M=(M|M<<2)&858993459,M=(M|M<<1)&1431655765,A|M<<1}function C(A){var M=A,E=A;do(M.x=(A-K)*(Z-ae)&&(A-K)*(z-ae)>=(E-K)*(M-ae)&&(E-K)*(Z-ae)>=(L-K)*(z-ae)}function k(A,M){return A.next.i!==M.i&&A.prev.i!==M.i&&!ie(A,M)&&(Se(A,M)&&Se(M,A)&&Pe(A,M)&&(N(A.prev,A,M.prev)||N(A,M.prev,M))||re(A,M)&&N(A.prev,A,A.next)>0&&N(M.prev,M,M.next)>0)}function N(A,M,E){return(M.y-A.y)*(E.x-M.x)-(M.x-A.x)*(E.y-M.y)}function re(A,M){return A.x===M.x&&A.y===M.y}function ne(A,M,E,z){var L=$(N(A,M,E)),Z=$(N(A,M,z)),K=$(N(E,z,A)),ae=$(N(E,z,M));return!!(L!==Z&&K!==ae||L===0&&J(A,E,M)||Z===0&&J(A,z,M)||K===0&&J(E,A,z)||ae===0&&J(E,M,z))}function J(A,M,E){return M.x<=Math.max(A.x,E.x)&&M.x>=Math.min(A.x,E.x)&&M.y<=Math.max(A.y,E.y)&&M.y>=Math.min(A.y,E.y)}function $(A){return A>0?1:A<0?-1:0}function ie(A,M){var E=A;do{if(E.i!==A.i&&E.next.i!==A.i&&E.i!==M.i&&E.next.i!==M.i&&ne(E,E.next,A,M))return!0;E=E.next}while(E!==A);return!1}function Se(A,M){return N(A.prev,A,A.next)<0?N(A,M,A.next)>=0&&N(A,A.prev,M)>=0:N(A,M,A.prev)<0||N(A,A.next,M)<0}function Pe(A,M){var E=A,z=!1,L=(A.x+M.x)/2,Z=(A.y+M.y)/2;do E.y>Z!=E.next.y>Z&&E.next.y!==E.y&&L<(E.next.x-E.x)*(Z-E.y)/(E.next.y-E.y)+E.x&&(z=!z),E=E.next;while(E!==A);return z}function ce(A,M){var E=new q(A.i,A.x,A.y),z=new q(M.i,M.x,M.y),L=A.next,Z=M.prev;return A.next=M,M.prev=A,E.next=L,L.prev=E,z.next=E,E.prev=z,Z.next=z,z.prev=Z,z}function D(A,M,E,z){var L=new q(A,M,E);return z?(L.next=z.next,L.prev=z,z.next.prev=L,z.next=L):(L.prev=L,L.next=L),L}function se(A){A.next.prev=A.prev,A.prev.next=A.next,A.prevZ&&(A.prevZ.nextZ=A.nextZ),A.nextZ&&(A.nextZ.prevZ=A.prevZ)}function q(A,M,E){this.i=A,this.x=M,this.y=E,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(A,M,E,z){var L=M&&M.length,Z=L?M[0]*E:A.length,K=Math.abs(de(A,0,Z,E));if(L)for(var ae=0,be=M.length;ae0&&(z+=A[L-1].length,E.holes.push(z))}return E}});function ff(t,e,i,r,n,s,a){let o=(0,pf.default)(t,e,2);if(!o)return;for(let h=0;h{pf=lt(df(),1)}),mf,_f,Bx=v(()=>{te(),gf(),mf=[],_f={extension:{type:O.ShapeBuilder,name:"polygon"},build(t,e){for(let i=0;i{te(),vf={extension:{type:O.ShapeBuilder,name:"rectangle"},build(t,e){let i=t,r=i.x,n=i.y,s=i.width,a=i.height;return s>=0&&a>=0&&(e[0]=r,e[1]=n,e[2]=r+s,e[3]=n,e[4]=r+s,e[5]=n+a,e[6]=r,e[7]=n+a),e},triangulate(t,e,i,r,n,s){let a=0;r*=i,e[r+a]=t[0],e[r+a+1]=t[1],a+=i,e[r+a]=t[2],e[r+a+1]=t[3],a+=i,e[r+a]=t[6],e[r+a+1]=t[7],a+=i,e[r+a]=t[4],e[r+a+1]=t[5],a+=i;let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}}}),yf,Gx=v(()=>{te(),yf={extension:{type:O.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,e},triangulate(t,e,i,r,n,s){let a=0;r*=i,e[r+a]=t[0],e[r+a+1]=t[1],a+=i,e[r+a]=t[2],e[r+a+1]=t[3],a+=i,e[r+a]=t[4],e[r+a+1]=t[5];let o=r/i;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function Ox(t,e){let{geometryData:i,batches:r}=e;r.length=0,i.indices.length=0,i.vertices.length=0,i.uvs.length=0;for(let n=0;n{let g=l.length,b=a.length/2,x=[],_=Wn[u.type];if(_.build(u,x),d&&af(x,d),r){let k=u.closePath??!0;Rx(x,e,!1,k,a,2,b,l,g)}else if(i&&h===p){h!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");let k=[],N=x.slice();Dx(i.shapePath).forEach(re=>{k.push(N.length/2),N.push(...re)}),ff(N,k,a,2,b,l,g)}else _.triangulate(x,a,2,b,l,g);let T=o.length/2,C=e.texture;if(C!==ke.WHITE){let k=e.matrix;k&&(d&&k.append(d.clone().invert()),bx(a,2,b,o,T,2,a.length/2-b,k))}else wx(o,T,2,a.length/2-b);let F=Ue.get(fa);F.indexOffset=g,F.indexSize=l.length-g,F.attributeOffset=b,F.attributeSize=a.length/2-b,F.baseColor=e.color,F.alpha=e.alpha,F.texture=C,F.geometryData=s,n.push(F)})}function Dx(t){if(!t)return[];let e=t.shapePrimitives,i=[];for(let r=0;r{te(),c(),Tx(),Sx(),pt(),Lt(),lf(),Cx(),kx(),Bx(),Ix(),Gx(),gf(),Wn={},ge.handleByMap(O.ShapeBuilder,Wn),ge.add(vf,_f,yf,pn,hf,uf),bf=new at}),wf,Tf,pa,ga,$l=v(()=>{te(),Cl(),sf(),Rt(),_t(),Lt(),Ux(),wf=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Tf=class{constructor(){this.batcher=new da,this.instructions=new tt}init(){this.instructions.reset()}get geometry(){return We(Pr,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},pa=class Ac{constructor(){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(e){Ac.defaultOptions.bezierSmoothness=e?.bezierSmoothness??Ac.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let i=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){i?this._cleanGraphicsContextData(e):i=this._initContext(e),Ox(e,i);let r=e.batchMode;e.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"&&(i.isBatchable=i.geometryData.vertices.length<400),e.dirty=!1}return i}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let i=Ue.get(Tf),{batches:r,geometryData:n}=this._gpuContextHash[e.uid],s=n.vertices.length,a=n.indices.length;for(let u=0;u{Ue.return(r)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}},pa.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"graphicsContext"},pa.defaultOptions={bezierSmoothness:.5},ga=pa}),Sf,ma,_a,va,ya,xa,ba,wa,ji,or=v(()=>{"use strict";Sf={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},ma=0,_a=1,va=2,ya=3,xa=4,ba=5,wa=class cv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;e[i++]=(t&255)/255*r,e[i++]=(t>>8&255)/255*r,e[i++]=(t>>16&255)/255*r,e[i++]=r}var Sa=v(()=>{"use strict"}),Xl,Lx=v(()=>{te(),or(),Lt(),Sa(),lf(),Xl=class{constructor(t,e){this.state=ji.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){let e=t.context,i=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(e);return!!(r.isBatchable||i!==r.isBatchable)}addRenderable(t,e){let i=this.renderer.graphicsContext.updateGpuContext(t.context);t._didGraphicsUpdate&&(t._didGraphicsUpdate=!1,this._rebuild(t)),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i{let a=Ue.get(fa);return s.copyTo(a),a.renderable=t,a.roundPixels=r,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=n,n}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{Ue.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}},Xl.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"graphics"}}),Ef=v(()=>{te(),$l(),Lx(),ge.add(Xl),ge.add(ga)}),Ea,Yl=v(()=>{"use strict";Ea=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){let t=this.geometry.getBuffer("aUV"),e=t.data,i=e,r=this.texture.textureMatrix;return r.isSimple||(i=this._transformedUvs,(this._textureMatrixUpdateId!==r._updateID||this._uvUpdateId!==t._updateID)&&((!i||i.length{te(),Xe(),Or(),fi(),Rl(),Lt(),Sa(),Yl(),ql=class{constructor(t,e){this.localUniforms=new ti({uTransformMatrix:{value:new Ae,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new zi({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){let e=this._getMeshData(t),i=e.batched,r=t.batched;if(e.batched=r,i!==r)return!0;if(r){let n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(t),a=t.texture;if(s.texture._source!==a._source&&s.texture._source!==a._source)return!s._batcher.checkAndUpdateTexture(s,a)}return!1}addRenderable(t,e){let i=this.renderer.renderPipes.batch,{batched:r}=this._getMeshData(t);if(r){let n=this._getBatchableMesh(t);n.texture=t._texture,n.geometry=t._geometry,i.addToBatch(n,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.texture=t._texture,e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(Ue.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ys(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Ta(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=Ue.get(Ea);return e.renderable=t,e.texture=t._texture,e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&Ue.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},ql.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"mesh"}}),Af=v(()=>{te(),Nx(),ge.add(ql)}),Aa,Kl=v(()=>{"use strict";Aa=class{constructor(){this.batcherName="default",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}}),Zl,Hx=v(()=>{te(),_l(),Lt(),Kl(),Zl=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();if(e.currentKey!==i){let{width:r,height:n}=this._renderer.canvasText.getTextureSize(t.text,t.resolution,t._style);return!(this._renderer.canvasText.getReferenceCount(e.currentKey)===1&&r===e.texture._source.width&&n===e.texture._source.height)}return!1}addRenderable(t,e){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),Ue.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),r=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1;let n=t._style.padding;Hs(r.bounds,t._anchor,r.texture,n)}_updateGpuText(t){let e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:Ue.get(Aa)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}},Zl.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"text"}}),Cf,Vi,Ca=v(()=>{Ot(),Ls(),Cf=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let i=ft.get().createCanvas();i.width=t,i.height=e;let r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=nn(t),e=nn(e);let r=(t<<17)+(e<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){let e=t.canvas,{width:i,height:r}=e,n=(i<<17)+(r<<1);this._canvasPool[n].push(t)}clear(){this._canvasPool={}}},Vi=new Cf}),Mf,Pf,pi,jn=v(()=>{Ls(),di(),pt(),Mf=0,Pf=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){let r=new Ft({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!0});return new ke({source:r,label:`texturePool_${Mf++}`})}getOptimalTexture(t,e,i=1,r){let n=Math.ceil(t*i-1e-6),s=Math.ceil(e*i-1e-6);n=nn(n),s=nn(s);let a=(n<<17)+(s<<1)+(r?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let o=this._texturePool[a].pop();return o||(o=this.createTexture(n,s,r)),o.source._resolution=i,o.source.width=n/i,o.source.height=s/i,o.source.pixelWidth=n,o.source.pixelHeight=s,o.frame.x=0,o.frame.y=0,o.frame.width=t,o.frame.height=e,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}getSameSizeTexture(t,e=!1){let i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let i=this._texturePool[e];if(i)for(let r=0;r{c()}),Ql,gn,Jl=v(()=>{Ie(),Ot(),Xe(),wl(),pt(),yt(),Ql=class Cc{constructor(e,i,r,n){this.uid=ht("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=e,this.y0=i,this.x1=r,this.y1=n}addColorStop(e,i){return this.gradientStops.push({offset:e,color:pe.shared.setValue(i).toHexa()}),this._styleKey=null,this}buildLinearGradient(){let e=Cc.defaultTextureSize,{gradientStops:i}=this,r=ft.get().createCanvas();r.width=e,r.height=e;let n=r.getContext("2d"),s=n.createLinearGradient(0,0,Cc.defaultTextureSize,1);for(let x=0;x`${n.offset}-${n.color}`).join("-"),i=this.texture.uid,r=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${e}-${i}-${r}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}},Ql.defaultTextureSize=256,gn=Ql}),eh,Vn,th=v(()=>{Xe(),yt(),eh={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Vn=class{constructor(t,e){this.uid=ht("fillPattern"),this.transform=new Ae,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=eh[e].addressModeU,t.source.style.addressModeV=eh[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}}),jx=Ne((t,e)=>{e.exports=n;var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(o){var l=[];return o.replace(r,function(h,u,d){var p=u.toLowerCase();for(d=a(d),p=="m"&&d.length>2&&(l.push([u].concat(d.splice(0,2))),p="l",u=u=="m"?"l":"L");;){if(d.length==i[p])return d.unshift(u),l.push(d);if(d.length0&&(n=r.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:G(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},r.push(n))}return e}var Bf,$x=v(()=>{Bf=lt(jx(),1),B()}),ih,If=v(()=>{c(),ih=class dv{constructor(e=0,i=0,r=0){this.type="circle",this.x=e,this.y=i,this.radius=r}clone(){return new dv(this.x,this.y,this.radius)}contains(e,i){if(this.radius<=0)return!1;let r=this.radius*this.radius,n=this.x-e,s=this.y-i;return n*=n,s*=s,n+s<=r}strokeContains(e,i,r){if(this.radius===0)return!1;let n=this.x-e,s=this.y-i,a=this.radius,o=r/2,l=Math.sqrt(n*n+s*s);return la-o}getBounds(e){return e=e||new at,e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),Gf,Xx=v(()=>{c(),Gf=class fv{constructor(e=0,i=0,r=0,n=0){this.type="ellipse",this.x=e,this.y=i,this.halfWidth=r,this.halfHeight=n}clone(){return new fv(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,i){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,n=(i-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(e,i,r){let{halfWidth:n,halfHeight:s}=this;if(n<=0||s<=0)return!1;let a=r/2,o=n-a,l=s-a,h=n+a,u=s+a,d=e-this.x,p=i-this.y,g=d*d/(o*o)+p*p/(l*l),b=d*d/(h*h)+p*p/(u*u);return g>1&&b<=1}getBounds(e){return e=e||new at,e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Yx(t,e,i,r,n,s){let a=t-i,o=e-r,l=n-i,h=s-r,u=a*l+o*h,d=l*l+h*h,p=-1;d!==0&&(p=u/d);let g,b;p<0?(g=i,b=r):p>1?(g=n,b=s):(g=i+p*l,b=r+p*h);let x=t-g,_=e-b;return x*x+_*_}var qx=v(()=>{"use strict"}),Ma,Kx=v(()=>{qx(),c(),Ma=class pv{constructor(...e){this.type="polygon";let i=Array.isArray(e[0])?e[0]:e;if(typeof i[0]!="number"){let r=[];for(let n=0,s=i.length;ni!=u>i&&e<(h-o)*((i-l)/(u-l))+o&&(r=!r)}return r}strokeContains(e,i,r){let n=r/2,s=n*n,{points:a}=this,o=a.length-(this.closePath?0:2);for(let l=0;ln?h:n,s=ua?u:a}return e.x=r,e.width=n-r,e.y=s,e.height=a-s,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,i)=>`${e}, ${i}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}}),$n,Of,Zx=v(()=>{c(),$n=(t,e,i,r,n,s)=>{let a=t-i,o=e-r,l=Math.sqrt(a*a+o*o);return l>=n-s&&l<=n+s},Of=class gv{constructor(e=0,i=0,r=0,n=0,s=20){this.type="roundedRectangle",this.x=e,this.y=i,this.width=r,this.height=n,this.radius=s}getBounds(e){return e=e||new at,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new gv(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,i){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+r&&i<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let n=e-(this.x+r),s=i-(this.y+r),a=r*r;if(n*n+s*s<=a||(n=e-(this.x+this.width-r),n*n+s*s<=a)||(s=i-(this.y+this.height-r),n*n+s*s<=a)||(n=e-(this.x+r),n*n+s*s<=a))return!0}return!1}strokeContains(e,i,r){let{x:n,y:s,width:a,height:o,radius:l}=this,h=r/2,u=n+l,d=s+l,p=a-l*2,g=o-l*2,b=n+a,x=s+o;return(e>=n-h&&e<=n+h||e>=b-h&&e<=b+h)&&i>=d&&i<=d+g||(i>=s-h&&i<=s+h||i>=x-h&&i<=x+h)&&e>=u&&e<=u+p?!0:eb-l&&ib-l&&i>x-l&&$n(e,i,b-l,x-l,l,h)||ex-l&&$n(e,i,u,x-l,l,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Ff(t,e,i,r,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??ga.defaultOptions.bezierSmoothness)),d=(Uf-u)/1;return d*=d,Qx(e,i,r,n,s,a,o,l,t,d),t}function Qx(t,e,i,r,n,s,a,o,l,h){rh(t,e,i,r,n,s,a,o,l,h,0),l.push(a,o)}function rh(t,e,i,r,n,s,a,o,l,h,u){if(u>Df)return;let d=Math.PI,p=(t+i)/2,g=(e+r)/2,b=(i+n)/2,x=(r+s)/2,_=(n+a)/2,T=(s+o)/2,C=(p+b)/2,F=(g+x)/2,k=(b+_)/2,N=(x+T)/2,re=(C+k)/2,ne=(F+N)/2;if(u>0){let J=a-t,$=o-e,ie=Math.abs((i-a)*$-(r-o)*J),Se=Math.abs((n-a)*$-(s-o)*J),Pe,ce;if(ie>Xn&&Se>Xn){if((ie+Se)*(ie+Se)<=h*(J*J+$*$)){if(Hr=d&&(Pe=2*d-Pe),ce>=d&&(ce=2*d-ce),Pe+ce
wr){l.push(i,r);return}if(ce>wr){l.push(n,s);return}}}}else if(ie>Xn){if(ie*ie<=h*(J*J+$*$)){if(Hr=d&&(Pe=2*d-Pe),Pe
wr){l.push(i,r);return}}}else if(Se>Xn){if(Se*Se<=h*(J*J+$*$)){if(Hr=d&&(Pe=2*d-Pe),Pe
wr){l.push(n,s);return}}}else if(J=re-(t+a)/2,$=ne-(e+o)/2,J*J+$*$<=h){l.push(re,ne);return}}rh(t,e,p,g,C,F,re,ne,l,h,u+1),rh(re,ne,k,N,_,T,a,o,l,h,u+1)}var Df,Xn,Uf,Pa,Hr,wr,Lf=v(()=>{$l(),Df=8,Xn=11920929e-14,Uf=1,Pa=.01,Hr=0,wr=0});function Jx(t,e,i,r,n,s,a,o){let l=Math.min(.99,Math.max(0,o??ga.defaultOptions.bezierSmoothness)),h=(zf-l)/1;return h*=h,eb(e,i,r,n,s,a,t,h),t}function eb(t,e,i,r,n,s,a,o){nh(a,t,e,i,r,n,s,o,0),a.push(n,s)}function nh(t,e,i,r,n,s,a,o,l){if(l>Nf)return;let h=Math.PI,u=(e+r)/2,d=(i+n)/2,p=(r+s)/2,g=(n+a)/2,b=(u+p)/2,x=(d+g)/2,_=s-e,T=a-i,C=Math.abs((r-s)*T-(n-a)*_);if(C>Hf){if(C*C<=o*(_*_+T*T)){if(sh=h&&(F=2*h-F),F{$l(),Nf=8,Hf=11920929e-14,zf=1,Wf=.01,sh=0});function jf(t,e,i,r,n,s,a,o){let l=Math.abs(n-s);(!a&&n>s||a&&s>n)&&(l=2*Math.PI-l),o=o||Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI))),o=Math.max(o,3);let h=l/o,u=n;h*=a?-1:1;for(let d=0;d{"use strict"});function ib(t,e,i,r,n,s){let a=t[t.length-2],o=t[t.length-1]-i,l=a-e,h=n-i,u=r-e,d=Math.abs(o*u-l*h);if(d<1e-8||s===0){(t[t.length-2]!==e||t[t.length-1]!==i)&&t.push(e,i);return}let p=o*o+l*l,g=h*h+u*u,b=o*h+l*u,x=s*Math.sqrt(p)/d,_=s*Math.sqrt(g)/d,T=x*b/p,C=_*b/g,F=x*u+_*l,k=x*h+_*o,N=l*(_+T),re=o*(_+T),ne=u*(x+C),J=h*(x+C),$=Math.atan2(re-k,N-F),ie=Math.atan2(J-k,ne-F);jf(t,F+e,k+i,s,$,ie,l*h>u*o)}var rb=v(()=>{Vf()});function nb(t,e){let i=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=e===1.5707963267948966?.551915024494:i,n=Math.cos(t),s=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-s*r,y:s+n*r},{x:a+o*r,y:o-a*r},{x:a,y:o}]}function sb(t,e,i,r,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*mn/360),d=Math.cos(o*mn/360),p=d*(e-r)/2+u*(i-n)/2,g=-u*(e-r)/2+d*(i-n)/2;if(p===0&&g===0)return;s=Math.abs(s),a=Math.abs(a);let b=Math.pow(p,2)/Math.pow(s,2)+Math.pow(g,2)/Math.pow(a,2);b>1&&(s*=Math.sqrt(b),a*=Math.sqrt(b)),$f(e,i,r,n,s,a,l,h,u,d,p,g,Ra);let{ang1:x,ang2:_}=Ra,{centerX:T,centerY:C}=Ra,F=Math.abs(_)/(mn/4);Math.abs(1-F)<1e-7&&(F=1);let k=Math.max(Math.ceil(F),1);_/=k;let N=t[t.length-2],re=t[t.length-1],ne={x:0,y:0};for(let J=0;J{Lf(),mn=Math.PI*2,Ra={centerX:0,centerY:0,ang1:0,ang2:0},ka=({x:t,y:e},i,r,n,s,a,o,l)=>{t*=i,e*=r;let h=n*t-s*e,u=s*t+n*e;return l.x=h+a,l.y=u+o,l},ah=(t,e,i,r)=>{let n=t*r-e*i<0?-1:1,s=t*i+e*r;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},$f=(t,e,i,r,n,s,a,o,l,h,u,d,p)=>{let g=Math.pow(n,2),b=Math.pow(s,2),x=Math.pow(u,2),_=Math.pow(d,2),T=g*b-g*_-b*x;T<0&&(T=0),T/=g*_+b*x,T=Math.sqrt(T)*(a===o?-1:1);let C=T*n/s*d,F=T*-s/n*u,k=h*C-l*F+(t+i)/2,N=l*C+h*F+(e+r)/2,re=(u-C)/n,ne=(d-F)/s,J=(-u-C)/n,$=(-d-F)/s,ie=ah(1,0,re,ne),Se=ah(re,ne,J,$);o===0&&Se>0&&(Se-=mn),o===1&&Se<0&&(Se+=mn),p.centerX=k,p.centerY=N,p.ang1=ie,p.ang2=Se}});function ob(t,e,i){let r=(a,o)=>{let l=o.x-a.x,h=o.y-a.y,u=Math.sqrt(l*l+h*h),d=l/u,p=h/u;return{len:u,nx:d,ny:p}},n=(a,o)=>{a===0?t.moveTo(o.x,o.y):t.lineTo(o.x,o.y)},s=e[e.length-1];for(let a=0;a0&&(g=-1,b=!0);let x=p/2,_,T=Math.abs(Math.cos(x)*l/Math.sin(x));T>Math.min(u.len/2,d.len/2)?(T=Math.min(u.len/2,d.len/2),_=Math.abs(T*Math.sin(x)/Math.cos(x))):_=l;let C=o.x+d.nx*T+-d.ny*_*g,F=o.y+d.ny*T+d.nx*_*g,k=Math.atan2(u.ny,u.nx)+Math.PI/2*g,N=Math.atan2(d.ny,d.nx)-Math.PI/2*g;a===0&&t.moveTo(C+Math.cos(k)*_,F+Math.sin(k)*_),t.arc(C,F,_,k,N,b),s=o}}function lb(t,e,i,r){let n=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),s=(o,l,h)=>({x:o.x+(l.x-o.x)*h,y:o.y+(l.y-o.y)*h}),a=e.length;for(let o=0;o{"use strict"}),Xf,Yf,ub=v(()=>{If(),Xx(),Kx(),c(),Zx(),y(),Lf(),tb(),Vf(),rb(),ab(),hb(),Xf=new at,Yf=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new m,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let i=this._currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this}arc(t,e,i,r,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return jf(a,t,e,i,r,n,s),this}arcTo(t,e,i,r,n){this._ensurePoly();let s=this._currentPoly.points;return ib(s,t,e,i,r,n),this}arcToSvg(t,e,i,r,n,s,a){let o=this._currentPoly.points;return sb(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,s,a){this._ensurePoly();let o=this._currentPoly;return Ff(this._currentPoly.points,o.lastX,o.lastY,t,e,i,r,n,s,a),this}quadraticCurveTo(t,e,i,r,n){this._ensurePoly();let s=this._currentPoly;return Jx(this._currentPoly.points,s.lastX,s.lastY,t,e,i,r,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));for(let i=0;i=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,s)}ellipse(t,e,i,r,n){return this.drawShape(new Gf(t,e,i,r),n),this}roundRect(t,e,i,r,n,s){return this.drawShape(new Of(t,e,i,r,n),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Ma,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Ma,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let n=e.transform,s=i;i=n.a*i+n.c*r+n.tx,r=n.b*s+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e{jt(),yt(),B(),$x(),ub(),qn=class mv{constructor(e){this.instructions=[],this.uid=ht("graphicsPath"),this._dirty=!0,typeof e=="string"?Vx(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Yf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,i){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,i]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,i,r,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(De.shared),l=0,h=0;if(!a||a.action!=="bezierCurveTo")l=o.x,h=o.y;else{l=a.data[2],h=a.data[3];let u=o.x,d=o.y;l=u+(u-l),h=d+(d-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,e,i,r,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,i,r){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(De.shared),a=0,o=0;if(!n||n.action!=="quadraticCurveTo")a=s.x,o=s.y;else{a=n.data[0],o=n.data[1];let l=s.x,h=s.y;a=l+(l-a),o=h+(h-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,e,i,r]}),this._dirty=!0,this}rect(e,i,r,n,s){return this.instructions.push({action:"rect",data:[e,i,r,n,s]}),this._dirty=!0,this}circle(e,i,r,n){return this.instructions.push({action:"circle",data:[e,i,r,n]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,i,r,n,s,a,o){s=s||n/2;let l=-1*Math.PI/2+a,h=r*2,u=Math.PI*2/h,d=[];for(let p=0;pparseInt(J,10)),e.context.poly(C,!0),i&&e.context.fill(),r&&e.context.stroke();break;case"polyline":F=t.getAttribute("points"),C=F.match(/\d+/g).map(J=>parseInt(J,10)),e.context.poly(C,!1),r&&e.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}for(let J=0;J{Ie(),qf()});function pb(t){return pe.isColorLike(t)}function Zf(t){return t instanceof Vn}function Qf(t){return t instanceof gn}function gb(t,e,i){let r=pe.shared.setValue(e??0);return t.color=r.toNumber(),t.alpha=r.alpha===1?i.alpha:r.alpha,t.texture=ke.WHITE,{...i,...t}}function Jf(t,e,i){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...i,...t}}function ep(t,e,i){return e.buildLinearGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...i,...t}}function mb(t,e){let i={...e,...t};if(i.texture){if(i.texture!==ke.WHITE){let s=i.matrix?.invert()||new Ae;s.translate(i.texture.frame.x,i.texture.frame.y),s.scale(1/i.texture.source.width,1/i.texture.source.height),i.matrix=s}let n=i.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}let r=pe.shared.setValue(i.color);return i.alpha*=r.alpha,i.color=r.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function zr(t,e){if(t==null)return null;let i={},r=t;return pb(t)?gb(i,t,e):Zf(t)?Jf(i,t,e):Qf(t)?ep(i,t,e):r.fill&&Zf(r.fill)?Jf(r,r.fill,e):r.fill&&Qf(r.fill)?ep(r,r.fill,e):mb(r,e)}function Ba(t,e){let{width:i,alignment:r,miterLimit:n,cap:s,join:a,...o}=e,l=zr(t,o);return l?{width:i,alignment:r,miterLimit:n,cap:s,join:a,...l}:null}var tp=v(()=>{Ie(),Xe(),pt(),Jl(),th()}),ip,oh,Ia,Ti,rp=v(()=>{gt(),Ie(),Xe(),jt(),pt(),yt(),_t(),y(),qf(),fb(),tp(),ip=new De,oh=new Ae,Ia=class Ki extends qe{constructor(){super(...arguments),this.uid=ht("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new qn,this._transform=new Ae,this._fillStyle={...Ki.defaultFillStyle},this._strokeStyle={...Ki.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new m,this._boundsDirty=!0}clone(){let e=new Ki;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=zr(e,Ki.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Ba(e,Ki.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=zr(e,Ki.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=zr(e,Ki.defaultStrokeStyle),this}texture(e,i,r,n,s,a){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:n||0,dw:s||e.frame.width,dh:a||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:i?pe.shared.setValue(i).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new qn,this}fill(e,i){let r,n=this.instructions[this.instructions.length-1];return this._tick===0&&n&&n.action==="stroke"?r=n.data.path:r=this._activePath.clone(),r?(e!=null&&(i!==void 0&&typeof e=="number"&&(We(je,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:i}),this._fillStyle=zr(e,Ki.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:i}=this._activePath.getLastPoint(De.shared);this._activePath.clear(),this._activePath.moveTo(e,i)}stroke(e){let i,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?i=r.data.path:i=this._activePath.clone(),i?(e!=null&&(this._strokeStyle=Ba(e,Ki.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let i=this.instructions[this.instructions.length-1-e],r=this._activePath.clone();if(i&&(i.action==="stroke"||i.action==="fill"))if(i.data.hole)i.data.hole.addPath(r);else{i.data.hole=r;break}}return this._initNextPathLocation(),this}arc(e,i,r,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*e+o.c*i+o.tx,o.b*e+o.d*i+o.ty,r,n,s,a),this}arcTo(e,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*e+a.c*i+a.tx,a.b*e+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}arcToSvg(e,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,i,r,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(e,i,r,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*i+l.tx,l.b*e+l.d*i+l.ty,l.a*r+l.c*n+l.tx,l.b*r+l.d*n+l.ty,l.a*s+l.c*a+l.tx,l.b*s+l.d*a+l.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,i,r,n){return this._tick++,this._activePath.ellipse(e,i,r,n,this._transform.clone()),this}circle(e,i,r){return this._tick++,this._activePath.circle(e,i,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,i){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*e+r.c*i+r.tx,r.b*e+r.d*i+r.ty),this}moveTo(e,i){this._tick++;let r=this._transform,n=this._activePath.instructions,s=r.a*e+r.c*i+r.tx,a=r.b*e+r.d*i+r.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=s,n[0].data[1]=a,this):(this._activePath.moveTo(s,a),this)}quadraticCurveTo(e,i,r,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*e+a.c*i+a.tx,a.b*e+a.d*i+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,s),this}rect(e,i,r,n){return this._tick++,this._activePath.rect(e,i,r,n,this._transform.clone()),this}roundRect(e,i,r,n,s){return this._tick++,this._activePath.roundRect(e,i,r,n,s,this._transform.clone()),this}poly(e,i){return this._tick++,this._activePath.poly(e,i,this._transform.clone()),this}regularPoly(e,i,r,n,s=0,a){return this._tick++,this._activePath.regularPoly(e,i,r,n,s,a),this}roundPoly(e,i,r,n,s,a){return this._tick++,this._activePath.roundPoly(e,i,r,n,s,a),this}roundShape(e,i,r,n){return this._tick++,this._activePath.roundShape(e,i,r,n),this}filletRect(e,i,r,n,s){return this._tick++,this._activePath.filletRect(e,i,r,n,s),this}chamferRect(e,i,r,n,s,a){return this._tick++,this._activePath.chamferRect(e,i,r,n,s,a),this}star(e,i,r,n,s=0,a=0){return this._tick++,this._activePath.star(e,i,r,n,s,a,this._transform.clone()),this}svg(e){return this._tick++,cb(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,i=e){return this._transform.scale(e,i),this}setTransform(e,i,r,n,s,a){return e instanceof Ae?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,i,r,n,s,a),this)}transform(e,i,r,n,s,a){return e instanceof Ae?(this._transform.append(e),this):(oh.set(e,i,r,n,s,a),this._transform.append(oh),this)}translate(e,i=e){return this._transform.translate(e,i),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let e=this._bounds;e.clear();for(let i=0;i{Ie(),lh=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function yb(t){let e=t;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let i=$i.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??i.alpha,angle:e.dropShadowAngle??i.angle,blur:e.dropShadowBlur??i.blur,color:e.dropShadowColor??i.color,distance:e.dropShadowDistance??i.distance}}if(e.strokeThickness!==void 0){We(je,"strokeThickness is now a part of stroke");let i=e.stroke,r={};if(pe.isColorLike(i))r.color=i;else if(i instanceof gn||i instanceof Vn)r.fill=i;else if(Object.hasOwnProperty.call(i,"color")||Object.hasOwnProperty.call(i,"fill"))r=i;else throw new Error("Invalid stroke value.");t.stroke={...r,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){We(je,"gradient fill is now a fill pattern: `new FillGradient(...)`");let i;t.fontSize==null?t.fontSize=$i.defaultTextStyle.fontSize:typeof t.fontSize=="string"?i=parseInt(t.fontSize,10):i=t.fontSize;let r=new gn(0,0,0,i*1.7),n=e.fillGradientStops.map(s=>pe.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);r.addColorStop(o,s)}),t.fill={fill:r}}}var Ga,$i,Kn=v(()=>{gt(),Ie(),_t(),Jl(),th(),rp(),tp(),ap(),Ga=class An extends qe{constructor(e={}){super(),yb(e);let i={...An.defaultTextStyle,...e};for(let r in i){let n=r;this[n]=i[r]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...An.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...An.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e,this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...Ti.defaultFillStyle,...e},()=>{this._fill=zr({...this._originalFill},Ti.defaultFillStyle)})),this._fill=zr(e===0?"black":e,Ti.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Ti.defaultStrokeStyle,...e},()=>{this._stroke=Ba({...this._originalStroke},Ti.defaultStrokeStyle)})),this._stroke=Ba(e,Ti.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=np(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=An.defaultTextStyle;for(let i in e)this[i]=e[i]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new An({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,i){return new Proxy(e,{set:(r,n,s)=>(r[n]=s,i?.(n,s),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(pe.isColorLike(e)||e instanceof gn||e instanceof Vn)}},Ga.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Ga.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100},$i=Ga});function op(t,e,i,r){let n=lp;n.minX=0,n.minY=0,n.maxX=t.width/r|0,n.maxY=t.height/r|0;let s=pi.getOptimalTexture(n.width,n.height,r,!1);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/r,s.frame.height=i/r,s.source.emit("update",s.source),s.updateUvs(),s}var lp,hp=v(()=>{jn(),y(),lp=new m});function Oa(t){let e=typeof t.fontSize=="number"?`${t.fontSize}px`:t.fontSize,i=t.fontFamily;Array.isArray(t.fontFamily)||(i=t.fontFamily.split(","));for(let r=i.length-1;r>=0;r--){let n=i[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!up.includes(n)&&(n=`"${n}"`),i[r]=n}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${i.join(",")}`}var up,hh=v(()=>{"use strict";up=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),Fa,Si,Pi,Da=v(()=>{Ot(),hh(),Fa={willReadFrequently:!0},Si=class Ce{static get experimentalLetterSpacingSupported(){let e=Ce._experimentalLetterSpacingSupported;if(e!==void 0){let i=ft.get().getCanvasRenderingContext2D().prototype;e=Ce._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return e}constructor(e,i,r,n,s,a,o,l,h){this.text=e,this.style=i,this.width=r,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=h}static measureText(e=" ",i,r=Ce._canvas,n=i.wordWrap){let s=`${e}:${i.styleKey}`;if(Ce._measurementCache[s])return Ce._measurementCache[s];let a=Oa(i),o=Ce.measureFont(a);o.fontSize===0&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);let l=Ce.__context;l.font=a;let h=(n?Ce._wordWrap(e,i,r):e).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let _=0;_0&&(n?s-=i:s+=(Ce.graphemeSegmenter(e).length-1)*i),s}static _wordWrap(e,i,r=Ce._canvas){let n=r.getContext("2d",Fa),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=i,d=Ce._collapseSpaces(u),p=Ce._collapseNewlines(u),g=!d,b=i.wordWrapWidth+h,x=Ce._tokenize(e);for(let _=0;_b)if(a!==""&&(o+=Ce._addLine(a),a="",s=0),Ce.canBreakWords(T,i.breakWords)){let F=Ce.wordWrapSplit(T);for(let k=0;kb&&(o+=Ce._addLine(a),g=!1,a="",s=0),a+=N,s+=J}}else{a.length>0&&(o+=Ce._addLine(a),a="",s=0);let F=_===x.length-1;o+=Ce._addLine(T,!F),g=!1,a="",s=0}else C+s>b&&(g=!1,o+=Ce._addLine(a),a="",s=0),(a.length>0||!Ce.isBreakingSpace(T)||g)&&(a+=T,s+=C)}return o+=Ce._addLine(a,!1),o}static _addLine(e,i=!0){return e=Ce._trimRight(e),e=i?`${e}
`:e,e}static _getFromCache(e,i,r,n){let s=r[e];return typeof s!="number"&&(s=Ce._measureText(e,i,n)+i,r[e]=s),s}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let i=e.length-1;i>=0;i--){let r=e[i];if(!Ce.isBreakingSpace(r))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:Ce._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,i){return typeof e!="string"?!1:Ce._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let i=[],r="";if(typeof e!="string")return i;for(let n=0;n{if(typeof Intl?.Segmenter=="function"){let t=new Intl.Segmenter;return e=>[...t.segment(e)].map(i=>i.segment)}return t=>[...t]})(),Si.experimentalLetterSpacing=!1,Si._fonts={},Si._newlines=[10,13],Si._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Si._measurementCache={},Pi=Si});function Ua(t,e){if(t.texture===ke.WHITE&&!t.fill)return pe.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(t.fill){if(t.fill instanceof Vn){let i=t.fill,r=e.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(Ae.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),r.setTransform(n),r}else if(t.fill instanceof gn){let i=t.fill;if(i.type==="linear"){let r=e.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{r.addColorStop(n.offset,pe.shared.setValue(n.color).toHex())}),r}}}else{let i=e.createPattern(t.texture.source.resource,"repeat"),r=t.matrix.copyTo(Ae.shared);return r.scale(t.texture.frame.width,t.texture.frame.height),i.setTransform(r),i}return G("FillStyle not recognised",t),"red"}var cp=v(()=>{Ie(),Xe(),pt(),B(),Jl(),th()}),uh,xb=v(()=>{Ie(),te(),Ls(),Ca(),jn(),Wx(),_t(),Kn(),hp(),Da(),hh(),cp(),uh=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){let r=Pi.measureText(t||" ",i),n=Math.ceil(Math.ceil(Math.max(1,r.width)+i.padding*2)*e),s=Math.ceil(Math.ceil(Math.max(1,r.height)+i.padding*2)*e);return n=Math.ceil(n-1e-6),s=Math.ceil(s-1e-6),n=nn(n),s=nn(s),{width:n,height:s}}getTexture(t,e,i,r){typeof t=="string"&&(We("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof $i||(t.style=new $i(t.style));let{texture:n,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(n._source),Vi.returnCanvasAndContext(s),n}createTextureAndCanvas(t){let{text:e,style:i}=t,r=t.resolution??this._renderer.resolution,n=Pi.measureText(e||" ",i),s=Math.ceil(Math.ceil(Math.max(1,n.width)+i.padding*2)*r),a=Math.ceil(Math.ceil(Math.max(1,n.height)+i.padding*2)*r),o=Vi.getOptimalCanvasAndContext(s,a),{canvas:l}=o;this.renderTextToCanvas(e,i,r,o);let h=op(l,s,a,r);if(i.trim){let u=zx(l,r);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:o}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:i,canvasAndContext:r}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:r,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];if(e.usageCount--,e.usageCount===0){Vi.returnCanvasAndContext(e.canvasAndContext),pi.returnTexture(e.texture);let i=e.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[t]=null}}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,r){let{canvas:n,context:s}=r,a=Oa(e),o=Pi.measureText(t||" ",e),l=o.lines,h=o.lineHeight,u=o.lineWidths,d=o.maxLineWidth,p=o.fontProperties,g=n.height;s.resetTransform(),s.scale(i,i);let b=e.padding*2;if(s.clearRect(0,0,o.width+4+b,o.height+4+b),e._stroke?.width){let C=e._stroke;s.lineWidth=C.width,s.miterLimit=C.miterLimit,s.lineJoin=C.join,s.lineCap=C.cap}s.font=a;let x,_,T=e.dropShadow?2:1;for(let C=0;C{te(),Hx(),xb(),ge.add(uh),ge.add(Zl)}),La,fp=v(()=>{_t(),vl(),rp(),La=class Mc extends zs{constructor(e){e instanceof Ti&&(e={context:e});let{context:i,roundPixels:r,...n}=e||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",i?this._context=i:this._context=this._ownedContext=new Ti,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(e){e.addBounds(this._context.bounds)}containsPoint(e){return this._context.containsPoint(e)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,i){return this.context[e](...i),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new Mc(this._context.clone()):(this._ownedContext=null,new Mc(this._context))}lineStyle(e,i,r){We(je,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return e&&(n.width=e),i&&(n.color=i),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(e,i){We(je,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return e&&(r.color=e),i&&(r.alpha=i),this.context.fillStyle=r,this}endFill(){We(je,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==Ti.defaultStrokeStyle.width||e.color!==Ti.defaultStrokeStyle.color||e.alpha!==Ti.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return We(je,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return We(je,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return We(je,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return We(je,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return We(je,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return We(je,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}}),pp,gp,bb=v(()=>{"use strict";pp={name:"local-uniform-msdf-bit",vertex:{header:`
struct LocalUniforms {
uColor:vec4,
uTransformMatrix:mat3x3,
uDistance: f32,
uRound:f32,
}
@group(2) @binding(0) var localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
struct LocalUniforms {
uColor:vec4,
uTransformMatrix:mat3x3,
uDistance: f32
}
@group(2) @binding(0) var localUniforms : LocalUniforms;
`,main:`
outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
`}},gp={name:"local-uniform-msdf-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix *= uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`},fragment:{header:`
uniform float uDistance;
`,main:`
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
`}}}),mp,_p,wb=v(()=>{"use strict";mp={name:"msdf-bit",fragment:{header:`
fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 {
// MSDF
var median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
var screenPxDistance = distance * (median - 0.5);
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
var luma: f32 = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}},_p={name:"msdf-bit",fragment:{header:`
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
// MSDF
float median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
float screenPxDistance = distance * (median - 0.5);
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
float gamma = mix(1.0, 1.0 / 2.2, luma);
float coverage = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}}}),ch,dh,vp,Tb=v(()=>{Xe(),an(),Ur(),la(),ca(),Lr(),Wl(),ar(),fi(),bb(),wb(),vp=class extends Wi{constructor(){let t=new ti({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new Ae,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=sn();ch??(ch=Hn({name:"sdf-shader",bits:[aa,Dl(e),pp,mp,dn]})),dh??(dh=zn({name:"sdf-shader",bits:[oa,Ul(e),gp,_p,fn]})),super({glProgram:dh,gpuProgram:ch,resources:{localUniforms:t,batchSamplers:Hl(e)}})}}}),yp,Sb=v(()=>{gt(),_t(),yp=class extends qe{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return We(je,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return We(je,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return We(je,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return We(je,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return We(je,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function xp(t){if(t==="")return[];typeof t=="string"&&(t=[t]);let e=[];for(let i=0,r=t.length;i{"use strict"}),fh,ph,Eb=v(()=>{Ie(),c(),Ca(),wl(),pt(),_t(),Da(),hh(),cp(),Kn(),Sb(),bp(),fh=class _v extends yp{constructor(e){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let i={..._v.defaultOptions,...e};this._textureSize=i.textureSize,this._mipmap=i.mipmap;let r=i.style.clone();i.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=ke.WHITE,r._fill.fill=null),this.applyFillAsTint=i.overrideFill;let n=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let s=Oa(r);i.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/n):r.fontSize=this.baseRenderedFontSize=n,this._style=r,this._skipKerning=i.skipKerning??!1,this.resolution=i.resolution??1,this._padding=i.padding??4,this.fontMetrics=Pi.measureFont(s),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(e){let i=xp(e).filter(x=>!this._currentChars.includes(x)).filter((x,_,T)=>T.indexOf(x)===_);if(!i.length)return;this._currentChars=[...this._currentChars,...i];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:n,context:s}=r.canvasAndContext,a=r.texture.source,o=this._style,l=this._currentX,h=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,d=this._padding*u,p=o.fontStyle==="italic"?2:1,g=0,b=!1;for(let x=0;xthis._textureSize&&(h+=g,g=N,l=0,h+g>this._textureSize)){a.update();let ne=this._nextPage();n=ne.canvasAndContext.canvas,s=ne.canvasAndContext.context,a=ne.texture.source,h=0}let re=C/u-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:re,kerning:{}},b){this._drawGlyph(s,T,l+d,h+d,u,o);let ne=a.width*u,J=a.height*u,$=new at(l/ne*a.width,h/J*a.height,k/ne*a.width,N/J*a.height);this.chars[_].texture=new ke({source:a,frame:$}),l+=Math.ceil(k)}}a.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(i,s)}get pageTextures(){return We(je,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,i){let r=this._measureCache;for(let n=0;n{let x=s.width;for(let _=0;_{let b=s.chars.length-1;if(r){let x=s.chars[b];for(;x===" ";)s.width-=i.chars[x].xAdvance,x=s.chars[--b]}n.width=Math.max(n.width,s.width),s={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,n.lines.push(s),n.height+=i.lineHeight},d=i.baseMeasurementFontSize/e.fontSize,p=e.letterSpacing*d,g=e.wordWrapWidth*d;for(let b=0;bg?(u(),h(l),_||s.charPositions.push(0)):(l.start=s.width,h(l),_||s.charPositions.push(0)),x==="\r"||x===`
`)s.width!==0&&u();else if(!_){let C=T.xAdvance+(T.kerning[a]||0)+p;s.width+=C,s.spaceWidth=C,s.spacesIndex.push(s.charPositions.length),s.chars.push(x)}}else{let C=T.kerning[a]||0,F=T.xAdvance+C+p;l.positions[l.index++]=l.width+C,l.chars.push(x),l.width+=F}a=x}return u(),e.align==="center"?Ab(n):e.align==="right"?Cb(n):e.align==="justify"&&Mb(n),n}function Ab(t){for(let e=0;e{"use strict"}),Zn,Sp,Ep,Pb=v(()=>{js(),_t(),B(),Kn(),Eb(),Tp(),bp(),Zn=0,Sp=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let i=`${e.fontFamily}-bitmap`,r=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,r=!1;else if(e._stroke||e.dropShadow){let s=e.styleKey;s=s.substring(0,s.lastIndexOf("-")),i=`${s}-bitmap`,r=!1}if(!Ht.has(i)){let s=new ph({style:e,overrideFill:r,overrideSize:!0,...this.defaultOptions});Zn++,Zn>50&&G("BitmapText",`You have dynamically created ${Zn} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{Zn--,Ht.remove(i)}),Ht.set(i,s)}let n=Ht.get(i);return n.ensureCharacters?.(t),n}getLayout(t,e,i=!0){let r=this.getFont(t,e);return wp([...t],e,r,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},We(je,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let r=e.style,n=r instanceof $i?r:new $i(r),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new ph({style:n,overrideFill:s,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),o=xp(e.chars);return a.ensureCharacters(o.join("")),Ht.set(`${i}-bitmap`,a),a.once("destroy",()=>Ht.remove(`${i}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,i=Ht.get(e);i&&(Ht.remove(e),i.destroy())}},Ep=new Sp});function Ap(t,e){e.groupTransform=t.groupTransform,e.groupColorAlpha=t.groupColorAlpha,e.groupColor=t.groupColor,e.groupBlendMode=t.groupBlendMode,e.globalDisplayStatus=t.globalDisplayStatus,e.groupTransform=t.groupTransform,e.localDisplayStatus=t.localDisplayStatus,e.groupAlpha=t.groupAlpha,e._roundPixels=t._roundPixels}var gh,Rb=v(()=>{js(),te(),Lt(),fp(),Tb(),Pb(),Tp(),gh=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let i=this._getGpuBitmapText(t);Ap(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(Ue.return(e.customShader),e.customShader=null),Ue.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);Ap(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:i}=e,r=Ep.getFont(t.text,t._style);i.clear(),r.distanceField.type!=="none"&&(i.customShader||(i.customShader=Ue.get(vp)));let n=Array.from(t.text),s=t._style,a=r.baseLineOffset,o=wp(n,s,r,!0),l=0,h=s.padding,u=o.scale,d=o.width,p=o.height+o.offsetY;s._stroke&&(d+=s._stroke.width/u,p+=s._stroke.width/u),i.translate(-t._anchor._x*d-h,-t._anchor._y*p-h).scale(u,u);let g=r.applyFillAsTint?s._fill.color:16777215;for(let b=0;b{te(),Rb(),ge.add(gh)}),mh,kb=v(()=>{te(),pt(),_l(),Lt(),Kl(),mh=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){let i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),Ue.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),i=this._getGpuText(t),r=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(s=>{console.error(s)}),t._didTextUpdate=!1;let n=t._style.padding;Hs(r.bounds,t._anchor,r.texture,n)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=i;let r=t.resolution??this._renderer.resolution,n=await this._renderer.htmlText.getManagedTexture(t.text,r,t._style,t._getKey()),s=e.batchableSprite;s.texture=e.texture=n,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate();let a=t._style.padding;Hs(s.bounds,t._anchor,s.texture,a)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:ke.EMPTY,currentKey:"--",batchableSprite:Ue.get(Aa),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=ke.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}},mh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"htmlText"}});function Bb(){let{userAgent:t}=ft.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}var Ib=v(()=>{Ot()}),_h,vh,yh,Mp=v(()=>{"use strict";_h="http://www.w3.org/2000/svg",vh="http://www.w3.org/1999/xhtml",yh=class{constructor(){this.svgRoot=document.createElementNS(_h,"svg"),this.foreignObject=document.createElementNS(_h,"foreignObject"),this.domElement=document.createElementNS(vh,"div"),this.styleElement=document.createElementNS(vh,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:i,domElement:r}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(r)}}});function Gb(t){let e=t._stroke,i=t._fill,r=[`div { ${[`color: ${pe.shared.setValue(i.color).toHex()}`,`font-size: ${t.fontSize}px`,`font-family: ${t.fontFamily}`,`font-weight: ${t.fontWeight}`,`font-style: ${t.fontStyle}`,`font-variant: ${t.fontVariant}`,`letter-spacing: ${t.letterSpacing}px`,`text-align: ${t.align}`,`padding: ${t.padding}px`,`white-space: ${t.whiteSpace==="pre"&&t.wordWrap?"pre-wrap":t.whiteSpace}`,...t.lineHeight?[`line-height: ${t.lineHeight}px`]:[],...t.wordWrap?[`word-wrap: ${t.breakWords?"break-all":"break-word"}`,`max-width: ${t.wordWrapWidth}px`]:[],...e?[Rp(e)]:[],...t.dropShadow?[Pp(t.dropShadow)]:[],...t.cssOverrides].join(";")} }`];return Ob(t.tagStyles,r),r.join(" ")}function Pp(t){let e=pe.shared.setValue(t.color).setAlpha(t.alpha).toHexa(),i=Math.round(Math.cos(t.angle)*t.distance),r=Math.round(Math.sin(t.angle)*t.distance),n=`${i}px ${r}px`;return t.blur>0?`text-shadow: ${n} ${t.blur}px ${e}`:`text-shadow: ${n} ${e}`}function Rp(t){return[`-webkit-text-stroke-width: ${t.width}px`,`-webkit-text-stroke-color: ${pe.shared.setValue(t.color).toHex()}`,`text-stroke-width: ${t.width}px`,`text-stroke-color: ${pe.shared.setValue(t.color).toHex()}`,"paint-order: stroke"].join(";")}function Ob(t,e){for(let i in t){let r=t[i],n=[];for(let s in r)bh[s]?n.push(bh[s](r[s])):xh[s]&&n.push(xh[s].replace("{{VALUE}}",r[s]));e.push(`${i} { ${n.join(";")} }`)}}var xh,bh,Fb=v(()=>{Ie(),xh={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},bh={fill:t=>`color: ${pe.shared.setValue(t).toHex()}`,breakWords:t=>`word-wrap: ${t?"break-all":"break-word"}`,stroke:Rp,dropShadow:Pp}}),kp,Db=v(()=>{B(),Kn(),ap(),Fb(),kp=class vv extends $i{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=np(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new vv({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=Gb(this)),this._cssStyle}addOverride(...e){let i=e.filter(r=>!this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides.push(...i),this.update())}removeOverride(...e){let i=e.filter(r=>this.cssOverrides.includes(r));i.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!i.includes(r)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&G("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&G("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function Ub(t,e){let i=e.fontFamily,r=[],n={},s=/font-family:([^;"\s]+)/g,a=t.match(s);function o(l){n[l]||(r.push(l),n[l]=!0)}if(Array.isArray(i))for(let l=0;l{let h=l.split(":")[1].trim();o(h)});for(let l in e.tagStyles){let h=e.tagStyles[l].fontFamily;o(h)}return r}var Lb=v(()=>{"use strict"});async function Nb(t){let e=await(await ft.get().fetch(t)).blob(),i=new FileReader;return await new Promise((r,n)=>{i.onloadend=()=>r(i.result),i.onerror=n,i.readAsDataURL(e)})}var Hb=v(()=>{Ot()});async function Bp(t,e){let i=await Nb(e);return`@font-face {
font-family: "${t.fontFamily}";
src: url('${i}');
font-weight: ${t.fontWeight};
font-style: ${t.fontStyle};
}`}var zb=v(()=>{Hb()});async function Wb(t,e,i){let r=t.filter(n=>Ht.has(`${n}-and-url`)).map((n,s)=>{if(!Qn.has(n)){let{url:a}=Ht.get(`${n}-and-url`);s===0?Qn.set(n,Bp({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:n},a)):Qn.set(n,Bp({fontWeight:i.fontWeight,fontStyle:i.fontStyle,fontFamily:n},a))}return Qn.get(n)});return(await Promise.all(r)).join(`
`)}var Qn,jb=v(()=>{js(),zb(),Qn=new Map});function Vb(t,e,i,r,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`${t}
`,s.setAttribute("style",`transform: scale(${i});transform-origin: top left; display: inline-block`),a.textContent=r;let{width:l,height:h}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(o)}var $b=v(()=>{"use strict"});function Xb(t,e){let i=Vi.getOptimalCanvasAndContext(t.width,t.height,e),{context:r}=i;return r.clearRect(0,0,t.width,t.height),r.drawImage(t,0,0),Vi.returnCanvasAndContext(i),i.canvas}var Yb=v(()=>{Ca()});function qb(t,e,i){return new Promise(async r=>{i&&await new Promise(n=>setTimeout(n,100)),t.onload=()=>{r()},t.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,t.crossOrigin="anonymous"})}var Kb=v(()=>{"use strict"});function Zb(t,e,i,r){r=r||Ip||(Ip=new yh);let{domElement:n,styleElement:s,svgRoot:a}=r;n.innerHTML=`${t}
`,n.setAttribute("style","transform-origin: top left; display: inline-block"),i&&(s.textContent=i),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=Pi.measureFont(e.fontStyle).descent,h=e.padding*2;return{width:o.width-h,height:o.height+l-h}}var Ip,Qb=v(()=>{Da(),Mp()}),Na,Jb=v(()=>{te(),jn(),sr(),Ib(),B(),Lt(),hp(),Mp(),Db(),Lb(),jb(),$b(),Yb(),Kb(),Qb(),Na=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===wi.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,r){if(this._activeTextures[r])return this._increaseReferenceCount(r),this._activeTextures[r].promise;let n=this._buildTexturePromise(t,e,i).then(s=>(this._activeTextures[r].texture=s,s));return this._activeTextures[r]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(t,e,i){let r=Ue.get(yh),n=Ub(t,i),s=await Wb(n,i,kp.defaultTextStyle),a=Zb(t,i,s,r),o=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),h=r.image,u=2;h.width=(o|0)+u,h.height=(l|0)+u;let d=Vb(t,i,e,s,r);await qb(h,d,Bb()&&n.length>0);let p=h;this._createCanvas&&(p=Xb(h,e));let g=op(p,h.width-u,h.height-u,e);return this._createCanvas&&this._renderer.texture.initSource(g.source),Ue.return(r),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{G("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){pi.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}},Na.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"htmlText"},Na.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}}),Gp=v(()=>{te(),kb(),Jb(),ge.add(Na),ge.add(mh)}),wh,Ha,Th=v(()=>{hn(),Dr(),Ks(),_t(),wh=class yv extends Fn{constructor(...e){let i=e[0]??{};i instanceof Float32Array&&(We(je,"use new MeshGeometry({ positions, uvs, indices }) instead"),i={positions:i,uvs:e[1],indices:e[2]}),i={...yv.defaultOptions,...i};let r=i.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||new Float32Array([0,0,1,0,1,1,0,1]),s=i.indices||new Uint32Array([0,1,2,0,2,3]),a=i.shrinkBuffersToFit,o=new bi({data:r,label:"attribute-mesh-positions",shrinkToFit:a,usage:et.VERTEX|et.COPY_DST}),l=new bi({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:et.VERTEX|et.COPY_DST}),h=new bi({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:et.INDEX|et.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(e){this.attributes.aPosition.buffer.data=e}get uvs(){return this.attributes.aUV.buffer.data}set uvs(e){this.attributes.aUV.buffer.data=e}get indices(){return this.indexBuffer.data}set indices(e){this.indexBuffer.data=e}},wh.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},Ha=wh}),_n,Op,za,Jn=v(()=>{"use strict";_n={name:"local-uniform-bit",vertex:{header:`
struct LocalUniforms {
uTransformMatrix:mat3x3,
uColor:vec4,
uRound:f32,
}
@group(1) @binding(0) var localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`}},Op={..._n,vertex:{..._n.vertex,header:_n.vertex.header.replace("group(1)","group(2)")}},za={name:"local-uniform-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix = uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`}}}),Fp,Dp,e0=v(()=>{"use strict";Fp={name:"tiling-bit",vertex:{header:`
struct TilingUniforms {
uMapCoord:mat3x3,
uClampFrame:vec4,
uClampOffset:vec2,
uTextureTransform:mat3x3,
uSizeAnchor:vec4
};
@group(2) @binding(0) var tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
`},fragment:{header:`
struct TilingUniforms {
uMapCoord:mat3x3,
uClampFrame:vec4,
uClampOffset:vec2,
uTextureTransform:mat3x3,
uSizeAnchor:vec4
};
@group(2) @binding(0) var tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
var unclamped = coord;
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
var bias = 0.;
if(unclamped.x == coord.x && unclamped.y == coord.y)
{
bias = -32.;
}
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
`}},Dp={name:"tiling-bit",vertex:{header:`
uniform mat3 uTextureTransform;
uniform vec4 uSizeAnchor;
`,main:`
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
`},fragment:{header:`
uniform sampler2D uTexture;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
`,main:`
vec2 coord = vUV + ceil(uClampOffset - vUV);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
`}}}),Sh,Eh,Up,t0=v(()=>{Xe(),Ur(),Jn(),Lr(),ar(),fi(),pt(),e0(),Up=class extends Wi{constructor(){Sh??(Sh=Hn({name:"tiling-sprite-shader",bits:[_n,Fp,dn]})),Eh??(Eh=zn({name:"tiling-sprite-shader",bits:[za,Dp,fn]}));let t=new ti({uMapCoord:{value:new Ae,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new Ae,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:Eh,gpuProgram:Sh,resources:{localUniforms:new ti({uTransformMatrix:{value:new Ae,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:ke.EMPTY.source,uSampler:ke.EMPTY.source.style}})}updateUniforms(t,e,i,r,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,h=s.textureMatrix,u=a.uniforms.uTextureTransform;u.set(i.a*o/t,i.b*o/e,i.c*l/t,i.d*l/e,i.tx/t,i.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=r,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),Lp,i0=v(()=>{Th(),Lp=class extends Ha{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 r0(t,e){let i=t.anchor.x,r=t.anchor.y;e[0]=-i*t.width,e[1]=-r*t.height,e[2]=(1-i)*t.width,e[3]=-r*t.height,e[4]=(1-i)*t.width,e[5]=(1-r)*t.height,e[6]=-i*t.width,e[7]=(1-r)*t.height}var n0=v(()=>{"use strict"});function s0(t,e,i,r){let n=0,s=t.length/(e||2),a=r.a,o=r.b,l=r.c,h=r.d,u=r.tx,d=r.ty;for(i*=e;n{"use strict"});function o0(t,e){let i=t.texture,r=i.frame.width,n=i.frame.height,s=0,a=0;t._applyAnchorToTexture&&(s=t.anchor.x,a=t.anchor.y),e[0]=e[6]=-s,e[2]=e[4]=1-s,e[1]=e[3]=-a,e[5]=e[7]=1-a;let o=Ae.shared;o.copyFrom(t._tileTransform.matrix),o.tx/=t.width,o.ty/=t.height,o.invert(),o.scale(t.width/r,t.height/n),s0(e,2,0,o)}var l0=v(()=>{Xe(),a0()}),es,Ah,h0=v(()=>{te(),Rl(),or(),sr(),Sa(),Yl(),Th(),t0(),i0(),n0(),l0(),es=new Lp,Ah=class{constructor(t){this._state=ji.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let r=e.canBatch;if(r&&r===i){let{batchableMesh:n}=e;if(n&&n.texture._source!==t.texture._source)return!n._batcher.checkAndUpdateTexture(n,t.texture)}return i!==r}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let r=this._getTilingSpriteData(t),{geometry:n,canBatch:s}=r;if(s){r.batchableMesh||(r.batchableMesh=new Ea);let a=r.batchableMesh;t._didTilingSpriteUpdate&&(t._didTilingSpriteUpdate=!1,this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.texture=t._texture),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e)}else i.break(e),r.shader||(r.shader=new Up),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,Ta(t.groupColorAlpha,i.uColor,0),this._state.blendMode=Ys(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:es,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:r}=e;t._didTilingSpriteUpdate&&this._updateBatchableMesh(t),r._batcher.updateElement(r)}else if(t._didTilingSpriteUpdate){let{shader:r}=e;r.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}t._didTilingSpriteUpdate=!1}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ha({indices:es.indices,positions:es.positions.slice(),uvs:es.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,r=t.texture.source.style;r.addressMode!=="repeat"&&(r.addressMode="repeat",r.update()),o0(t,i.uvs),r0(t,i.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,r=!0;return this._renderer.type===wi.WEBGL&&(r=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(r||i.source.isPowerOfTwo),e.canBatch}},Ah.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"tilingSprite"}}),Np=v(()=>{te(),h0(),ge.add(Ah)}),Ch,Hp,u0=v(()=>{_t(),Th(),Ch=class xv extends Ha{constructor(...e){super({});let i=e[0]??{};typeof i=="number"&&(We(je,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),i={width:i,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(i)}build(e){e={...xv.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let i=this.verticesX*this.verticesY,r=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,h=this.height/o;for(let d=0;d{u0(),Mh=class bv extends Hp{constructor(e={}){e={...bv.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,i=this._leftWidth+this._rightWidth,r=this.width>i?1:this.width/i,n=this._topHeight+this._bottomHeight,s=this.height>n?1:this.height/n,a=Math.min(r,s);e[9]=e[11]=e[13]=e[15]=this._topHeight*a,e[17]=e[19]=e[21]=e[23]=this.height-this._bottomHeight*a,e[25]=e[27]=e[29]=e[31]=this.height,e[2]=e[10]=e[18]=e[26]=this._leftWidth*a,e[4]=e[12]=e[20]=e[28]=this.width-this._rightWidth*a,e[6]=e[14]=e[22]=e[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let i=1/this._originalWidth,r=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}},Mh.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},zp=Mh}),Ph,d0=v(()=>{te(),Lt(),Yl(),c0(),Ph=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){let i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];Ue.return(e.geometry),Ue.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.geometry.update(t),e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=Ue.get(Ea);return e.geometry=Ue.get(zp),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._didSpriteUpdate=!0,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}},Ph.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"nineSliceSprite"}}),Wp=v(()=>{te(),d0(),ge.add(Ph)}),Rh,f0=v(()=>{te(),Rh=class{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},Rh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"filter"}});function p0(t,e){return e.clear(),jp(t,e),e.isValid||e.set(0,0,0,0),t.renderGroup?e.applyMatrix(t.renderGroup.localTransform):e.applyMatrix(t.parentRenderGroup.worldTransform),e}function jp(t,e){if(t.localDisplayStatus!==7||!t.measurable)return;let i=!!t.effects.length,r=e;if((t.renderGroup||i)&&(r=S.get().clear()),t.boundsArea)e.addRect(t.boundsArea,t.worldTransform);else{if(t.renderPipeId){let s=t.bounds;r.addFrame(s.minX,s.minY,s.maxX,s.maxY,t.groupTransform)}let n=t.children;for(let s=0;s{Xe(),P(),Vp=new Ae});function m0(t,e){e.clear();let i=e.matrix;for(let r=0;r{"use strict"}),$p,kh,v0=v(()=>{te(),Xe(),jt(),Or(),Ks(),fi(),pt(),jn(),sr(),y(),g0(),_0(),B(),$p=new Fn({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])}),kh=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ti({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new zi({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let r=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){r.skip=!0;return}let n=r.bounds;t.renderables?m0(t.renderables,n):t.filterEffect.filterArea?(n.clear(),n.addRect(t.filterEffect.filterArea),n.applyMatrix(t.container.worldTransform)):p0(t.container,n);let s=e.renderTarget.renderTarget.colorTexture.source,a=1/0,o=0,l=!0,h=!1,u=!1;for(let p=0;p0?this._filterStack[this._filterStackIndex-1].bounds:null,o=t.renderTarget.getRenderTarget(e.previousRenderSurface);n=this.getBackTexture(o,r,a)}e.backTexture=n;let s=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),t.globalUniforms.pop(),s.length===1)s[0].apply(this,i,e.previousRenderSurface,!1),pi.returnTexture(i);else{let a=e.inputTexture,o=pi.getOptimalTexture(r.width,r.height,a.source._resolution,!1),l=0;for(l=0;l0&&this._filterStack[u].skip;)--u;u>0&&(h=this._filterStack[u].inputTexture.source._resolution);let d=this._filterGlobalUniforms,p=d.uniforms,g=p.uOutputFrame,b=p.uInputSize,x=p.uInputPixel,_=p.uInputClamp,T=p.uGlobalFrame,C=p.uOutputTexture;if(l){let N=this._filterStackIndex;for(;N>0;){N--;let re=this._filterStack[this._filterStackIndex-1];if(!re.skip){o.x=re.bounds.minX,o.y=re.bounds.minY;break}}g[0]=a.minX-o.x,g[1]=a.minY-o.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,b[0]=e.source.width,b[1]=e.source.height,b[2]=1/b[0],b[3]=1/b[1],x[0]=e.source.pixelWidth,x[1]=e.source.pixelHeight,x[2]=1/x[0],x[3]=1/x[1],_[0]=.5*x[2],_[1]=.5*x[3],_[2]=e.frame.width*b[2]-.5*x[2],_[3]=e.frame.height*b[3]-.5*x[3];let F=this.renderer.renderTarget.rootRenderTarget.colorTexture;T[0]=o.x*h,T[1]=o.y*h,T[2]=F.source.width*h,T[3]=F.source.height*h;let k=this.renderer.renderTarget.getRenderTarget(i);if(n.renderTarget.bind(i,!!r),i instanceof ke?(C[0]=i.frame.width,C[1]=i.frame.height):(C[0]=k.width,C[1]=k.height),C[2]=k.isRoot?-1:1,d.update(),n.renderPipes.uniformBatch){let N=n.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(N,0)}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:$p,shader:t,state:t._state,topology:"triangle-list"}),n.type===wi.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new m,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,r=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),n=e.worldTransform.copyTo(Ae.shared);return n.invert(),r.prepend(n),r.scale(1/e.texture.frame.width,1/e.texture.frame.height),r.translate(e.anchor.x,e.anchor.y),r}},kh.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"filter"}}),Xp=v(()=>{te(),f0(),v0(),ge.add(kh),ge.add(Rh)}),y0={},x0=v(()=>{Lv(),Wc(),Vv(),ml(),Sl(),Ef(),Af(),dp(),Cp(),Gp(),Np(),Wp(),Xp()}),b0={},w0=v(()=>{Wc(),ml(),Sl(),Ef(),Af(),dp(),Cp(),Gp(),Np(),Wp(),Xp()}),Bh,Yp,T0=v(()=>{Un(),na(),ar(),or(),Bh=class Pc extends Wi{constructor(e){e={...Pc.defaultOptions,...e},super(e),this.enabled=!0,this._state=ji.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.addResource("uTexture",0,1)}apply(e,i,r,n){e.applyFilter(this,i,r,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:i,gl:r,...n}=e,s,a;return i&&(s=Nn.from(i)),r&&(a=un.from(r)),new Pc({gpuProgram:s,glProgram:a,...n})}},Bh.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1},Yp=Bh});async function S0(t){if(!t)for(let e=0;e{te(),Wa=[],ge.handleByNamedList(O.Environment,Wa)});function qp(){if(typeof ts=="boolean")return ts;try{ts=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ts=!1}return ts}var ts,Kp=v(()=>{"use strict"}),oi,is=v(()=>{"use strict";oi=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(oi||{})}),Ih,Zp=v(()=>{"use strict";Ih=class{constructor(t){this.items=[],this._name=t}emit(t,e,i,r,n,s,a,o){let{name:l,items:h}=this;for(let u=0,d=h.length;u{Ie(),E0(),Ni(),Kp(),_t(),is(),Zp(),gt(),Qp=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],Gh=class wv extends qe{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let i=[...Qp,...this.config.runners??[]];this._addRunners(...i),this._unsafeEvalCheck()}async init(e={}){let i=e.skipExtensionImports===!0?!0:e.manageImports===!1;await S0(i),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)e={...this._systemsHash[r].constructor.defaultOptions,...e};e={...wv.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let r=0;r