@rel-packages/osu-beatmap-preview 0.11.4 → 0.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/default_skin_archive.d.ts +2 -0
- package/dist/assets/default_skin_archive.d.ts.map +1 -0
- package/dist/assets/default_skin_embedded.d.ts.map +1 -1
- package/dist/chunk-0e4ebmdy.js +2 -0
- package/dist/chunk-1sw3e1ar.js +23 -0
- package/dist/chunk-21p7cseg.js +1 -0
- package/dist/chunk-525kvqgh.js +1 -0
- package/dist/chunk-5evxnj3k.js +9 -0
- package/dist/chunk-5v6x1wpn.js +84 -0
- package/dist/chunk-7qazncxz.js +15 -0
- package/dist/chunk-a7wf9wxx.js +173 -0
- package/dist/chunk-ay0z741j.js +1 -0
- package/dist/chunk-dvctxyxp.js +2 -0
- package/dist/chunk-eb5gmq04.js +186 -0
- package/dist/chunk-edbhr7zr.js +156 -0
- package/dist/chunk-ef1ghrsq.js +1 -0
- package/dist/chunk-f3y92gm3.js +1 -0
- package/dist/chunk-fsbv6vcn.js +2 -0
- package/dist/chunk-kkmq6cvb.js +2 -0
- package/dist/chunk-kmf5rpya.js +1 -0
- package/dist/chunk-kt3t4zv0.js +2 -0
- package/dist/chunk-pn7re3na.js +2 -0
- package/dist/chunk-rp8z1jh7.js +2 -0
- package/dist/chunk-shb5s568.js +1 -0
- package/dist/chunk-sngkm5ds.js +218 -0
- package/dist/chunk-tb8nqrjk.js +1 -0
- package/dist/chunk-vzfdvw38.js +1 -0
- package/dist/chunk-zc79wdxj.js +41 -0
- package/dist/config/standard.d.ts +2 -2
- package/dist/index.js +1 -1146
- package/dist/player/audio_controller.d.ts +9 -0
- package/dist/player/audio_controller.d.ts.map +1 -1
- package/dist/player/player.d.ts +2 -0
- package/dist/player/player.d.ts.map +1 -1
- package/dist/renderer/backend/pixi_backend.d.ts +10 -1
- package/dist/renderer/backend/pixi_backend.d.ts.map +1 -1
- package/dist/renderer/backend/render_backend.d.ts +1 -1
- package/dist/renderer/backend/render_backend.d.ts.map +1 -1
- package/dist/renderer/drawable/drawable_slider.d.ts +2 -0
- package/dist/renderer/drawable/drawable_slider.d.ts.map +1 -1
- package/dist/renderer/mania/mania_renderer.d.ts +11 -0
- package/dist/renderer/mania/mania_renderer.d.ts.map +1 -1
- package/dist/renderer/standard/standard_renderer.d.ts +3 -1
- package/dist/renderer/standard/standard_renderer.d.ts.map +1 -1
- package/dist/renderer/standard/timing_state.d.ts +1 -0
- package/dist/renderer/standard/timing_state.d.ts.map +1 -1
- package/dist/utils/lru.d.ts +32 -0
- package/dist/utils/lru.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/index.js.map +0 -357
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default_skin_archive.d.ts","sourceRoot":"","sources":["../../src/assets/default_skin_archive.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,2BAA2B,qyjzBAAqyjzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_skin_embedded.d.ts","sourceRoot":"","sources":["../../src/assets/default_skin_embedded.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default_skin_embedded.d.ts","sourceRoot":"","sources":["../../src/assets/default_skin_embedded.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,+BAA+B,QAAa,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CA6BxF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{hb as F,ob as H}from"./chunk-1sw3e1ar.js";var J={};function N(q,v,A){let f=2166136261;for(let l=0;l<v;l++)f^=q[l].uid,f=Math.imul(f,16777619),f>>>=0;return J[f]||K(q,v,f,A)}function K(q,v,A,f){let l={},C=0;for(let w=0;w<f;w++){let E=w<v?q[w]:F.EMPTY.source;l[C++]=E.source,l[C++]=E.style}let D=new H(l);return J[A]=D,D}
|
|
2
|
+
export{N as ta};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{vb as l5,wb as g5}from"./chunk-dvctxyxp.js";var y0=g5((D8,F0)=>{var c5=Object.prototype.hasOwnProperty,X="~";function x(){}if(Object.create){if(x.prototype=Object.create(null),!new x().__proto__)X=!1}function v5($,q,J){this.fn=$,this.context=q,this.once=J||!1}function d0($,q,J,Q,Z){if(typeof J!=="function")throw TypeError("The listener must be a function");var N=new v5(J,Q||$,Z),K=X?X+q:q;if(!$._events[K])$._events[K]=N,$._eventsCount++;else if(!$._events[K].fn)$._events[K].push(N);else $._events[K]=[$._events[K],N];return $}function t($,q){if(--$._eventsCount===0)$._events=new x;else delete $._events[q]}function w(){this._events=new x,this._eventsCount=0}w.prototype.eventNames=function(){var q=[],J,Q;if(this._eventsCount===0)return q;for(Q in J=this._events)if(c5.call(J,Q))q.push(X?Q.slice(1):Q);if(Object.getOwnPropertySymbols)return q.concat(Object.getOwnPropertySymbols(J));return q};w.prototype.listeners=function(q){var J=X?X+q:q,Q=this._events[J];if(!Q)return[];if(Q.fn)return[Q.fn];for(var Z=0,N=Q.length,K=Array(N);Z<N;Z++)K[Z]=Q[Z].fn;return K};w.prototype.listenerCount=function(q){var J=X?X+q:q,Q=this._events[J];if(!Q)return 0;if(Q.fn)return 1;return Q.length};w.prototype.emit=function(q,J,Q,Z,N,K){var H=X?X+q:q;if(!this._events[H])return!1;var V=this._events[H],W=arguments.length,O,z;if(V.fn){if(V.once)this.removeListener(q,V.fn,void 0,!0);switch(W){case 1:return V.fn.call(V.context),!0;case 2:return V.fn.call(V.context,J),!0;case 3:return V.fn.call(V.context,J,Q),!0;case 4:return V.fn.call(V.context,J,Q,Z),!0;case 5:return V.fn.call(V.context,J,Q,Z,N),!0;case 6:return V.fn.call(V.context,J,Q,Z,N,K),!0}for(z=1,O=Array(W-1);z<W;z++)O[z-1]=arguments[z];V.fn.apply(V.context,O)}else{var F=V.length,k;for(z=0;z<F;z++){if(V[z].once)this.removeListener(q,V[z].fn,void 0,!0);switch(W){case 1:V[z].fn.call(V[z].context);break;case 2:V[z].fn.call(V[z].context,J);break;case 3:V[z].fn.call(V[z].context,J,Q);break;case 4:V[z].fn.call(V[z].context,J,Q,Z);break;default:if(!O)for(k=1,O=Array(W-1);k<W;k++)O[k-1]=arguments[k];V[z].fn.apply(V[z].context,O)}}}return!0};w.prototype.on=function(q,J,Q){return d0(this,q,J,Q,!1)};w.prototype.once=function(q,J,Q){return d0(this,q,J,Q,!0)};w.prototype.removeListener=function(q,J,Q,Z){var N=X?X+q:q;if(!this._events[N])return this;if(!J)return t(this,N),this;var K=this._events[N];if(K.fn){if(K.fn===J&&(!Z||K.once)&&(!Q||K.context===Q))t(this,N)}else{for(var H=0,V=[],W=K.length;H<W;H++)if(K[H].fn!==J||Z&&!K[H].once||Q&&K[H].context!==Q)V.push(K[H]);if(V.length)this._events[N]=V.length===1?V[0]:V;else t(this,N)}return this};w.prototype.removeAllListeners=function(q){var J;if(q){if(J=X?X+q:q,this._events[J])t(this,J)}else this._events=new x,this._eventsCount=0;return this};w.prototype.off=w.prototype.removeListener;w.prototype.addListener=w.prototype.on;w.prefixed=X;w.EventEmitter=w;if(typeof F0<"u")F0.exports=w});var W0=(($)=>{return $.Application="application",$.WebGLPipes="webgl-pipes",$.WebGLPipesAdaptor="webgl-pipes-adaptor",$.WebGLSystem="webgl-system",$.WebGPUPipes="webgpu-pipes",$.WebGPUPipesAdaptor="webgpu-pipes-adaptor",$.WebGPUSystem="webgpu-system",$.CanvasSystem="canvas-system",$.CanvasPipesAdaptor="canvas-pipes-adaptor",$.CanvasPipes="canvas-pipes",$.Asset="asset",$.LoadParser="load-parser",$.ResolveParser="resolve-parser",$.CacheParser="cache-parser",$.DetectionParser="detection-parser",$.MaskEffect="mask-effect",$.BlendMode="blend-mode",$.TextureSource="texture-source",$.Environment="environment",$.ShapeBuilder="shape-builder",$.Batcher="batcher",$})(W0||{}),H0=($)=>{if(typeof $==="function"||typeof $==="object"&&$.extension){if(!$.extension)throw Error("Extension class must have an extension object");$={...typeof $.extension!=="object"?{type:$.extension}:$.extension,ref:$}}if(typeof $==="object")$={...$};else throw Error("Invalid extension type");if(typeof $.type==="string")$.type=[$.type];return $},o=($,q)=>H0($).priority??q,K8={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...$){return $.map(H0).forEach((q)=>{q.type.forEach((J)=>this._removeHandlers[J]?.(q))}),this},add(...$){return $.map(H0).forEach((q)=>{q.type.forEach((J)=>{let Q=this._addHandlers,Z=this._queue;if(!Q[J])Z[J]=Z[J]||[],Z[J]?.push(q);else Q[J]?.(q)})}),this},handle($,q,J){let Q=this._addHandlers,Z=this._removeHandlers;if(Q[$]||Z[$])throw Error(`Extension type ${$} already has a handler`);Q[$]=q,Z[$]=J;let N=this._queue;if(N[$])N[$]?.forEach((K)=>q(K)),delete N[$];return this},handleByMap($,q){return this.handle($,(J)=>{if(J.name)q[J.name]=J.ref},(J)=>{if(J.name)delete q[J.name]})},handleByNamedList($,q,J=-1){return this.handle($,(Q)=>{if(q.findIndex((N)=>N.name===Q.name)>=0)return;q.push({name:Q.name,value:Q.ref}),q.sort((N,K)=>o(K.value,J)-o(N.value,J))},(Q)=>{let Z=q.findIndex((N)=>N.name===Q.name);if(Z!==-1)q.splice(Z,1)})},handleByList($,q,J=-1){return this.handle($,(Q)=>{if(q.includes(Q.ref))return;q.push(Q.ref),q.sort((Z,N)=>o(N,J)-o(Z,J))},(Q)=>{let Z=q.indexOf(Q.ref);if(Z!==-1)q.splice(Z,1)})},mixin($,...q){for(let J of q)Object.defineProperties($.prototype,Object.getOwnPropertyDescriptors(J))}};class R{constructor($=0,q=0){this.x=0,this.y=0,this.x=$,this.y=q}clone(){return new R(this.x,this.y)}copyFrom($){return this.set($.x,$.y),this}copyTo($){return $.set(this.x,this.y),$}equals($){return $.x===this.x&&$.y===this.y}set($=0,q=$){return this.x=$,this.y=q,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return z0.x=0,z0.y=0,z0}}var z0=new R;var a=[new R,new R,new R,new R];class T{constructor($=0,q=0,J=0,Q=0){this.type="rectangle",this.x=Number($),this.y=Number(q),this.width=Number(J),this.height=Number(Q)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new T(0,0,0,0)}clone(){return new T(this.x,this.y,this.width,this.height)}copyFromBounds($){return this.x=$.minX,this.y=$.minY,this.width=$.maxX-$.minX,this.height=$.maxY-$.minY,this}copyFrom($){return this.x=$.x,this.y=$.y,this.width=$.width,this.height=$.height,this}copyTo($){return $.copyFrom(this),$}contains($,q){if(this.width<=0||this.height<=0)return!1;if($>=this.x&&$<this.x+this.width){if(q>=this.y&&q<this.y+this.height)return!0}return!1}strokeContains($,q,J,Q=0.5){let{width:Z,height:N}=this;if(Z<=0||N<=0)return!1;let K=this.x,H=this.y,V=J*(1-Q),W=J-V,O=K-V,z=K+Z+V,F=H-V,k=H+N+V,I=K+W,A=K+Z-W,L=H+W,G=H+N-W;return $>=O&&$<=z&&q>=F&&q<=k&&!($>I&&$<A&&q>L&&q<G)}intersects($,q){if(!q){let h5=this.x<$.x?$.x:this.x;if((this.right>$.right?$.right:this.right)<=h5)return!1;let P5=this.y<$.y?$.y:this.y;return(this.bottom>$.bottom?$.bottom:this.bottom)>P5}let J=this.left,Q=this.right,Z=this.top,N=this.bottom;if(Q<=J||N<=Z)return!1;let K=a[0].set($.left,$.top),H=a[1].set($.left,$.bottom),V=a[2].set($.right,$.top),W=a[3].set($.right,$.bottom);if(V.x<=K.x||H.y<=K.y)return!1;let O=Math.sign(q.a*q.d-q.b*q.c);if(O===0)return!1;if(q.apply(K,K),q.apply(H,H),q.apply(V,V),q.apply(W,W),Math.max(K.x,H.x,V.x,W.x)<=J||Math.min(K.x,H.x,V.x,W.x)>=Q||Math.max(K.y,H.y,V.y,W.y)<=Z||Math.min(K.y,H.y,V.y,W.y)>=N)return!1;let z=O*(H.y-K.y),F=O*(K.x-H.x),k=z*J+F*Z,I=z*Q+F*Z,A=z*J+F*N,L=z*Q+F*N;if(Math.max(k,I,A,L)<=z*K.x+F*K.y||Math.min(k,I,A,L)>=z*W.x+F*W.y)return!1;let G=O*(K.y-V.y),j=O*(V.x-K.x),E0=G*J+j*Z,T0=G*Q+j*Z,S0=G*J+j*N,h0=G*Q+j*N;if(Math.max(E0,T0,S0,h0)<=G*K.x+j*K.y||Math.min(E0,T0,S0,h0)>=G*W.x+j*W.y)return!1;return!0}pad($=0,q=$){return this.x-=$,this.y-=q,this.width+=$*2,this.height+=q*2,this}fit($){let q=Math.max(this.x,$.x),J=Math.min(this.x+this.width,$.x+$.width),Q=Math.max(this.y,$.y),Z=Math.min(this.y+this.height,$.y+$.height);return this.x=q,this.width=Math.max(J-q,0),this.y=Q,this.height=Math.max(Z-Q,0),this}ceil($=1,q=0.001){let J=Math.ceil((this.x+this.width-q)*$)/$,Q=Math.ceil((this.y+this.height-q)*$)/$;return this.x=Math.floor((this.x+q)*$)/$,this.y=Math.floor((this.y+q)*$)/$,this.width=J-this.x,this.height=Q-this.y,this}scale($,q=$){return this.x*=$,this.y*=q,this.width*=$,this.height*=q,this}enlarge($){let q=Math.min(this.x,$.x),J=Math.max(this.x+this.width,$.x+$.width),Q=Math.min(this.y,$.y),Z=Math.max(this.y+this.height,$.y+$.height);return this.x=q,this.width=J-q,this.y=Q,this.height=Z-Q,this}getBounds($){return $||($=new T),$.copyFrom(this),$}containsRect($){if(this.width<=0||this.height<=0)return!1;let{x:q,y:J}=$,Q=$.x+$.width,Z=$.y+$.height;return q>=this.x&&q<this.x+this.width&&J>=this.y&&J<this.y+this.height&&Q>=this.x&&Q<this.x+this.width&&Z>=this.y&&Z<this.y+this.height}set($,q,J,Q){return this.x=$,this.y=q,this.width=J,this.height=Q,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}var P0=Math.PI*2,O8=180/Math.PI,F8=Math.PI/180;class U{constructor($=1,q=0,J=0,Q=1,Z=0,N=0){this.array=null,this.a=$,this.b=q,this.c=J,this.d=Q,this.tx=Z,this.ty=N}fromArray($){this.a=$[0],this.b=$[1],this.c=$[3],this.d=$[4],this.tx=$[2],this.ty=$[5]}set($,q,J,Q,Z,N){return this.a=$,this.b=q,this.c=J,this.d=Q,this.tx=Z,this.ty=N,this}toArray($,q){if(!this.array)this.array=new Float32Array(9);let J=q||this.array;if($)J[0]=this.a,J[1]=this.b,J[2]=0,J[3]=this.c,J[4]=this.d,J[5]=0,J[6]=this.tx,J[7]=this.ty,J[8]=1;else J[0]=this.a,J[1]=this.c,J[2]=this.tx,J[3]=this.b,J[4]=this.d,J[5]=this.ty,J[6]=0,J[7]=0,J[8]=1;return J}apply($,q){q=q||new R;let{x:J,y:Q}=$;return q.x=this.a*J+this.c*Q+this.tx,q.y=this.b*J+this.d*Q+this.ty,q}applyInverse($,q){q=q||new R;let J=this.a,Q=this.b,Z=this.c,N=this.d,K=this.tx,H=this.ty,V=1/(J*N+Z*-Q),W=$.x,O=$.y;return q.x=N*V*W+-Z*V*O+(H*Z-K*N)*V,q.y=J*V*O+-Q*V*W+(-H*J+K*Q)*V,q}translate($,q){return this.tx+=$,this.ty+=q,this}scale($,q){return this.a*=$,this.d*=q,this.c*=$,this.b*=q,this.tx*=$,this.ty*=q,this}rotate($){let q=Math.cos($),J=Math.sin($),Q=this.a,Z=this.c,N=this.tx;return this.a=Q*q-this.b*J,this.b=Q*J+this.b*q,this.c=Z*q-this.d*J,this.d=Z*J+this.d*q,this.tx=N*q-this.ty*J,this.ty=N*J+this.ty*q,this}append($){let q=this.a,J=this.b,Q=this.c,Z=this.d;return this.a=$.a*q+$.b*Q,this.b=$.a*J+$.b*Z,this.c=$.c*q+$.d*Q,this.d=$.c*J+$.d*Z,this.tx=$.tx*q+$.ty*Q+this.tx,this.ty=$.tx*J+$.ty*Z+this.ty,this}appendFrom($,q){let{a:J,b:Q,c:Z,d:N,tx:K,ty:H}=$,V=q.a,W=q.b,O=q.c,z=q.d;return this.a=J*V+Q*O,this.b=J*W+Q*z,this.c=Z*V+N*O,this.d=Z*W+N*z,this.tx=K*V+H*O+q.tx,this.ty=K*W+H*z+q.ty,this}setTransform($,q,J,Q,Z,N,K,H,V){return this.a=Math.cos(K+V)*Z,this.b=Math.sin(K+V)*Z,this.c=-Math.sin(K-H)*N,this.d=Math.cos(K-H)*N,this.tx=$-(J*this.a+Q*this.c),this.ty=q-(J*this.b+Q*this.d),this}prepend($){let q=this.tx;if($.a!==1||$.b!==0||$.c!==0||$.d!==1){let J=this.a,Q=this.c;this.a=J*$.a+this.b*$.c,this.b=J*$.b+this.b*$.d,this.c=Q*$.a+this.d*$.c,this.d=Q*$.b+this.d*$.d}return this.tx=q*$.a+this.ty*$.c+$.tx,this.ty=q*$.b+this.ty*$.d+$.ty,this}decompose($){let q=this.a,J=this.b,Q=this.c,Z=this.d,N=$.pivot,K=-Math.atan2(-Q,Z),H=Math.atan2(J,q),V=Math.abs(K+H);if(V<0.00001||Math.abs(P0-V)<0.00001)$.rotation=H,$.skew.x=$.skew.y=0;else $.rotation=0,$.skew.x=K,$.skew.y=H;return $.scale.x=Math.sqrt(q*q+J*J),$.scale.y=Math.sqrt(Q*Q+Z*Z),$.position.x=this.tx+(N.x*q+N.y*Q),$.position.y=this.ty+(N.x*J+N.y*Z),$}invert(){let $=this.a,q=this.b,J=this.c,Q=this.d,Z=this.tx,N=$*Q-q*J;return this.a=Q/N,this.b=-q/N,this.c=-J/N,this.d=$/N,this.tx=(J*this.ty-Q*Z)/N,this.ty=-($*this.ty-q*Z)/N,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let $=new U;return $.a=this.a,$.b=this.b,$.c=this.c,$.d=this.d,$.tx=this.tx,$.ty=this.ty,$}copyTo($){return $.a=this.a,$.b=this.b,$.c=this.c,$.d=this.d,$.tx=this.tx,$.ty=this.ty,$}copyFrom($){return this.a=$.a,this.b=$.b,this.c=$.c,this.d=$.d,this.tx=$.tx,this.ty=$.ty,this}equals($){return $.a===this.a&&$.b===this.b&&$.c===this.c&&$.d===this.d&&$.tx===this.tx&&$.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return d5.identity()}static get shared(){return f5.identity()}}var f5=new U,d5=new U;var h=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],P=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],f=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],d=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],O0=[],f0=[],r=Math.sign;function y5(){for(let $=0;$<16;$++){let q=[];O0.push(q);for(let J=0;J<16;J++){let Q=r(h[$]*h[J]+f[$]*P[J]),Z=r(P[$]*h[J]+d[$]*P[J]),N=r(h[$]*f[J]+f[$]*d[J]),K=r(P[$]*f[J]+d[$]*d[J]);for(let H=0;H<16;H++)if(h[H]===Q&&P[H]===Z&&f[H]===N&&d[H]===K){q.push(H);break}}}for(let $=0;$<16;$++){let q=new U;q.set(h[$],P[$],f[$],d[$],0,0),f0.push(q)}}y5();var C={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:($)=>h[$],uY:($)=>P[$],vX:($)=>f[$],vY:($)=>d[$],inv:($)=>{if($&8)return $&15;return-$&7},add:($,q)=>O0[$][q],sub:($,q)=>O0[$][C.inv(q)],rotate180:($)=>$^4,isVertical:($)=>($&3)===2,byDirection:($,q)=>{if(Math.abs($)*2<=Math.abs(q)){if(q>=0)return C.S;return C.N}else if(Math.abs(q)*2<=Math.abs($)){if($>0)return C.E;return C.W}else if(q>0){if($>0)return C.SE;return C.SW}else if($>0)return C.NE;return C.NW},matrixAppendRotationInv:($,q,J=0,Q=0,Z=0,N=0)=>{let K=f0[C.inv(q)],H=K.a,V=K.b,W=K.c,O=K.d,z=J-Math.min(0,H*Z,W*N,H*Z+W*N),F=Q-Math.min(0,V*Z,O*N,V*Z+O*N),k=$.a,I=$.b,A=$.c,L=$.d;$.a=H*k+V*A,$.b=H*I+V*L,$.c=W*k+O*A,$.d=W*I+O*L,$.tx=z*k+F*A+$.tx,$.ty=z*I+F*L+$.ty},transformRectCoords:($,q,J,Q)=>{let{x:Z,y:N,width:K,height:H}=$,{x:V,y:W,width:O,height:z}=q;if(J===C.E)return Q.set(Z+V,N+W,K,H),Q;else if(J===C.S)return Q.set(O-N-H+V,Z+W,H,K);else if(J===C.W)return Q.set(O-Z-K+V,z-N-H+W,K,H);else if(J===C.N)return Q.set(N+V,z-Z-K+W,H,K);return Q.set(Z+V,N+W,K,H)}};var g0=l5(y0(),1);var Y=g0.default;var k0={default:-1};function _($="default"){if(k0[$]===void 0)k0[$]=-1;return++k0[$]}var c0=new Set,e="8.0.0",X8="8.3.4",g={quiet:!1,noColor:!1},p=($,q,J=3)=>{if(g.quiet||c0.has(q))return;let Q=Error().stack,Z=`${q}
|
|
2
|
+
Deprecated since v${$}`,N=typeof console.groupCollapsed==="function"&&!g.noColor;if(typeof Q>"u")console.warn("PixiJS Deprecation Warning: ",Z);else if(Q=Q.split(`
|
|
3
|
+
`).splice(J).join(`
|
|
4
|
+
`),N)console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",Z),console.warn(Q),console.groupEnd();else console.warn("PixiJS Deprecation Warning: ",Z),console.warn(Q);c0.add(q)};Object.defineProperties(p,{quiet:{get:()=>g.quiet,set:($)=>{g.quiet=$},enumerable:!0,configurable:!1},noColor:{get:()=>g.noColor,set:($)=>{g.noColor=$},enumerable:!0,configurable:!1}});var A0=()=>{};function b8($){return $+=$===0?1:0,--$,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$+1}function I0($){return!($&$-1)&&!!$}function v0($){let q={};for(let J in $)if($[J]!==void 0)q[J]=$[J];return q}var l0=Object.create(null);function x5($){let q=l0[$];if(q===void 0)l0[$]=_("resource");return q}var x0=class $ extends Y{constructor(q={}){super();this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,q={...$.defaultOptions,...q},this.addressMode=q.addressMode,this.addressModeU=q.addressModeU??this.addressModeU,this.addressModeV=q.addressModeV??this.addressModeV,this.addressModeW=q.addressModeW??this.addressModeW,this.scaleMode=q.scaleMode,this.magFilter=q.magFilter??this.magFilter,this.minFilter=q.minFilter??this.minFilter,this.mipmapFilter=q.mipmapFilter??this.mipmapFilter,this.lodMinClamp=q.lodMinClamp,this.lodMaxClamp=q.lodMaxClamp,this.compare=q.compare,this.maxAnisotropy=q.maxAnisotropy??1}set addressMode(q){this.addressModeU=q,this.addressModeV=q,this.addressModeW=q}get addressMode(){return this.addressModeU}set wrapMode(q){p(e,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=q}get wrapMode(){return this.addressMode}set scaleMode(q){this.magFilter=q,this.minFilter=q,this.mipmapFilter=q}get scaleMode(){return this.magFilter}set maxAnisotropy(q){if(this._maxAnisotropy=Math.min(q,16),this._maxAnisotropy>1)this.scaleMode="linear"}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){let q=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=x5(q),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};x0.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};var p0=x0;var m0=class $ extends Y{constructor(q={}){super();if(this.options=q,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=_("textureSource"),this._resourceType="textureSource",this._resourceId=_("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.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,q={...$.defaultOptions,...q},this.label=q.label??"",this.resource=q.resource,this.autoGarbageCollect=q.autoGarbageCollect,this._resolution=q.resolution,q.width)this.pixelWidth=q.width*this._resolution;else this.pixelWidth=this.resource?this.resourceWidth??1:1;if(q.height)this.pixelHeight=q.height*this._resolution;else this.pixelHeight=this.resource?this.resourceHeight??1:1;this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=q.format,this.dimension=q.dimensions,this.viewDimension=q.viewDimension??q.dimensions,this.arrayLayerCount=q.arrayLayerCount,this.mipLevelCount=q.mipLevelCount,this.autoGenerateMipmaps=q.autoGenerateMipmaps,this.sampleCount=q.sampleCount,this.antialias=q.antialias,this.alphaMode=q.alphaMode,this.style=new p0(v0(q)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(q){if(this.style===q)return;this._style?.off("change",this._onStyleChange,this),this._style=q,this._style?.on("change",this._onStyleChange,this),this._onStyleChange()}set maxAnisotropy(q){this._style.maxAnisotropy=q}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(q){this._style.addressMode=q}get repeatMode(){return this._style.addressMode}set repeatMode(q){this._style.addressMode=q}get magFilter(){return this._style.magFilter}set magFilter(q){this._style.magFilter=q}get minFilter(){return this._style.minFilter}set minFilter(q){this._style.minFilter=q}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(q){this._style.mipmapFilter=q}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(q){this._style.lodMinClamp=q}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(q){this._style.lodMaxClamp=q}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let q=this._resolution;if(this.resize(this.resourceWidth/q,this.resourceHeight/q))return}this.emit("update",this)}destroy(){if(this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style)this._style.destroy(),this._style=null;this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=_("resource"),this.emit("change",this),this.emit("unload",this);for(let q in this._gpuData)this._gpuData[q]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){let{resource:q}=this;return q.naturalWidth||q.videoWidth||q.displayWidth||q.width}get resourceHeight(){let{resource:q}=this;return q.naturalHeight||q.videoHeight||q.displayHeight||q.height}get resolution(){return this._resolution}set resolution(q){if(this._resolution===q)return;this._resolution=q,this.width=this.pixelWidth/q,this.height=this.pixelHeight/q}resize(q,J,Q){Q||(Q=this._resolution),q||(q=this.width),J||(J=this.height);let Z=Math.round(q*Q),N=Math.round(J*Q);if(this.width=Z/Q,this.height=N/Q,this._resolution=Q,this.pixelWidth===Z&&this.pixelHeight===N)return!1;return this._refreshPOT(),this.pixelWidth=Z,this.pixelHeight=N,this.emit("resize",this),this._resourceId=_("resource"),this.emit("change",this),!0}updateMipmaps(){if(this.autoGenerateMipmaps&&this.mipLevelCount>1)this.emit("updateMipmaps",this)}set wrapMode(q){this._style.wrapMode=q}get wrapMode(){return this._style.wrapMode}set scaleMode(q){this._style.scaleMode=q}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=I0(this.pixelWidth)&&I0(this.pixelHeight)}static test(q){throw Error("Unimplemented")}};m0.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};var m=m0;class $0 extends m{constructor($){let q=$.resource||new Float32Array($.width*$.height*4),J=$.format;if(!J)if(q instanceof Float32Array)J="rgba32float";else if(q instanceof Int32Array)J="rgba32uint";else if(q instanceof Uint32Array)J="rgba32uint";else if(q instanceof Int16Array)J="rgba16uint";else if(q instanceof Uint16Array)J="rgba16uint";else if(q instanceof Int8Array)J="bgra8unorm";else J="bgra8unorm";super({...$,resource:q,format:J});this.uploadMethodId="buffer"}static test($){return $ instanceof Int8Array||$ instanceof Uint8Array||$ instanceof Uint8ClampedArray||$ instanceof Int16Array||$ instanceof Uint16Array||$ instanceof Int32Array||$ instanceof Uint32Array||$ instanceof Float32Array}}$0.extension=W0.TextureSource;var u0=new U;class L0{constructor($,q){if(this.mapCoord=new U,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof q>"u")this.clampMargin=$.width<10?0:0.5;else this.clampMargin=q;this.isSimple=!1,this.texture=$}get texture(){return this._texture}set texture($){if(this.texture===$)return;this._texture?.removeListener("update",this.update,this),this._texture=$,this._texture.addListener("update",this.update,this),this.update()}multiplyUvs($,q){if(q===void 0)q=$;let J=this.mapCoord;for(let Q=0;Q<$.length;Q+=2){let Z=$[Q],N=$[Q+1];q[Q]=Z*J.a+N*J.c+J.tx,q[Q+1]=Z*J.b+N*J.d+J.ty}return q}update(){let $=this._texture;this._updateID++;let q=$.uvs;this.mapCoord.set(q.x1-q.x0,q.y1-q.y0,q.x3-q.x0,q.y3-q.y0,q.x0,q.y0);let{orig:J,trim:Q}=$;if(Q)u0.set(J.width/Q.width,0,0,J.height/Q.height,-Q.x/Q.width,-Q.y/Q.height),this.mapCoord.append(u0);let Z=$.source,N=this.uClampFrame,K=this.clampMargin/Z._resolution,H=this.clampOffset/Z._resolution;return N[0]=($.frame.x+K+H)/Z.width,N[1]=($.frame.y+K+H)/Z.height,N[2]=($.frame.x+$.frame.width-K+H)/Z.width,N[3]=($.frame.y+$.frame.height-K+H)/Z.height,this.uClampOffset[0]=this.clampOffset/Z.pixelWidth,this.uClampOffset[1]=this.clampOffset/Z.pixelHeight,this.isSimple=$.frame.width===Z.width&&$.frame.height===Z.height&&$.rotate===0,!0}}class y extends Y{constructor({source:$,label:q,frame:J,orig:Q,trim:Z,defaultAnchor:N,defaultBorders:K,rotate:H,dynamic:V}={}){super();if(this.uid=_("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new T,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=q,this.source=$?.source??new m,this.noFrame=!J,J)this.frame.copyFrom(J);else{let{width:W,height:O}=this._source;this.frame.width=W,this.frame.height=O}this.orig=Q||this.frame,this.trim=Z,this.rotate=H??0,this.defaultAnchor=N,this.defaultBorders=K,this.destroyed=!1,this.dynamic=V||!1,this.updateUvs()}set source($){if(this._source)this._source.off("resize",this.update,this);this._source=$,$.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){if(!this._textureMatrix)this._textureMatrix=new L0(this);return this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:$,frame:q}=this,{width:J,height:Q}=this._source,Z=q.x/J,N=q.y/Q,K=q.width/J,H=q.height/Q,V=this.rotate;if(V){let W=K/2,O=H/2,z=Z+W,F=N+O;V=C.add(V,C.NW),$.x0=z+W*C.uX(V),$.y0=F+O*C.uY(V),V=C.add(V,2),$.x1=z+W*C.uX(V),$.y1=F+O*C.uY(V),V=C.add(V,2),$.x2=z+W*C.uX(V),$.y2=F+O*C.uY(V),V=C.add(V,2),$.x3=z+W*C.uX(V),$.y3=F+O*C.uY(V)}else $.x0=Z,$.y0=N,$.x1=Z+K,$.y1=N,$.x2=Z+K,$.y2=N+H,$.x3=Z,$.y3=N+H}destroy($=!1){if(this._source){if(this._source.off("resize",this.update,this),$)this._source.destroy(),this._source=null}this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){if(this.noFrame)this.frame.width=this._source.width,this.frame.height=this._source.height;this.updateUvs(),this.emit("update",this)}get baseTexture(){return p(e,"Texture.baseTexture is now Texture.source"),this._source}}y.EMPTY=new y({label:"EMPTY",source:new m({label:"EMPTY"})});y.EMPTY.destroy=A0;y.WHITE=new y({source:new $0({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});y.WHITE.destroy=A0;var q0=(($)=>{return $[$.WEBGL=1]="WEBGL",$[$.WEBGPU=2]="WEBGPU",$[$.CANVAS=4]="CANVAS",$[$.BOTH=3]="BOTH",$})(q0||{});var p5={grad:0.9,turn:360,rad:360/(2*Math.PI)},E=function($){return typeof $=="string"?$.length>0:typeof $=="number"},D=function($,q,J){return q===void 0&&(q=0),J===void 0&&(J=Math.pow(10,q)),Math.round(J*$)/J+0},M=function($,q,J){return q===void 0&&(q=0),J===void 0&&(J=1),$>J?J:$>q?$:q},e0=function($){return($=isFinite($)?$%360:0)>0?$:$+360},n0=function($){return{r:M($.r,0,255),g:M($.g,0,255),b:M($.b,0,255),a:M($.a)}},C0=function($){return{r:D($.r),g:D($.g),b:D($.b),a:D($.a,3)}},m5=/^#([0-9a-f]{3,8})$/i,J0=function($){var q=$.toString(16);return q.length<2?"0"+q:q},$5=function($){var{r:q,g:J,b:Q,a:Z}=$,N=Math.max(q,J,Q),K=N-Math.min(q,J,Q),H=K?N===q?(J-Q)/K:N===J?2+(Q-q)/K:4+(q-J)/K:0;return{h:60*(H<0?H+6:H),s:N?K/N*100:0,v:N/255*100,a:Z}},q5=function($){var{h:q,s:J,v:Q,a:Z}=$;q=q/360*6,J/=100,Q/=100;var N=Math.floor(q),K=Q*(1-J),H=Q*(1-(q-N)*J),V=Q*(1-(1-q+N)*J),W=N%6;return{r:255*[Q,H,K,K,V,Q][W],g:255*[V,Q,Q,H,K,K][W],b:255*[K,K,V,Q,Q,H][W],a:Z}},i0=function($){return{h:e0($.h),s:M($.s,0,100),l:M($.l,0,100),a:M($.a)}},s0=function($){return{h:D($.h),s:D($.s),l:D($.l),a:D($.a,3)}},o0=function($){return q5((J=(q=$).s,{h:q.h,s:(J*=((Q=q.l)<50?Q:100-Q)/100)>0?2*J/(Q+J)*100:0,v:Q+J,a:q.a}));var q,J,Q},u=function($){return{h:(q=$5($)).h,s:(Z=(200-(J=q.s))*(Q=q.v)/100)>0&&Z<200?J*Q/100/(Z<=100?Z:200-Z)*100:0,l:Z/2,a:q.a};var q,J,Q,Z},u5=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,n5=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,i5=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,s5=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w0={string:[[function($){var q=m5.exec($);return q?($=q[1]).length<=4?{r:parseInt($[0]+$[0],16),g:parseInt($[1]+$[1],16),b:parseInt($[2]+$[2],16),a:$.length===4?D(parseInt($[3]+$[3],16)/255,2):1}:$.length===6||$.length===8?{r:parseInt($.substr(0,2),16),g:parseInt($.substr(2,2),16),b:parseInt($.substr(4,2),16),a:$.length===8?D(parseInt($.substr(6,2),16)/255,2):1}:null:null},"hex"],[function($){var q=i5.exec($)||s5.exec($);return q?q[2]!==q[4]||q[4]!==q[6]?null:n0({r:Number(q[1])/(q[2]?0.39215686274509803:1),g:Number(q[3])/(q[4]?0.39215686274509803:1),b:Number(q[5])/(q[6]?0.39215686274509803:1),a:q[7]===void 0?1:Number(q[7])/(q[8]?100:1)}):null},"rgb"],[function($){var q=u5.exec($)||n5.exec($);if(!q)return null;var J,Q,Z=i0({h:(J=q[1],Q=q[2],Q===void 0&&(Q="deg"),Number(J)*(p5[Q]||1)),s:Number(q[3]),l:Number(q[4]),a:q[5]===void 0?1:Number(q[5])/(q[6]?100:1)});return o0(Z)},"hsl"]],object:[[function($){var{r:q,g:J,b:Q,a:Z}=$,N=Z===void 0?1:Z;return E(q)&&E(J)&&E(Q)?n0({r:Number(q),g:Number(J),b:Number(Q),a:Number(N)}):null},"rgb"],[function($){var{h:q,s:J,l:Q,a:Z}=$,N=Z===void 0?1:Z;if(!E(q)||!E(J)||!E(Q))return null;var K=i0({h:Number(q),s:Number(J),l:Number(Q),a:Number(N)});return o0(K)},"hsl"],[function($){var{h:q,s:J,v:Q,a:Z}=$,N=Z===void 0?1:Z;if(!E(q)||!E(J)||!E(Q))return null;var K=function(H){return{h:e0(H.h),s:M(H.s,0,100),v:M(H.v,0,100),a:M(H.a)}}({h:Number(q),s:Number(J),v:Number(Q),a:Number(N)});return q5(K)},"hsv"]]},a0=function($,q){for(var J=0;J<q.length;J++){var Q=q[J][0]($);if(Q)return[Q,q[J][1]]}return[null,void 0]},o5=function($){return typeof $=="string"?a0($.trim(),w0.string):typeof $=="object"&&$!==null?a0($,w0.object):[null,void 0]};var _0=function($,q){var J=u($);return{h:J.h,s:M(J.s+100*q,0,100),l:J.l,a:J.a}},D0=function($){return(299*$.r+587*$.g+114*$.b)/1000/255},r0=function($,q){var J=u($);return{h:J.h,s:J.s,l:M(J.l+100*q,0,100),a:J.a}},G0=function(){function $(q){this.parsed=o5(q)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return $.prototype.isValid=function(){return this.parsed!==null},$.prototype.brightness=function(){return D(D0(this.rgba),2)},$.prototype.isDark=function(){return D0(this.rgba)<0.5},$.prototype.isLight=function(){return D0(this.rgba)>=0.5},$.prototype.toHex=function(){return q=C0(this.rgba),J=q.r,Q=q.g,Z=q.b,K=(N=q.a)<1?J0(D(255*N)):"","#"+J0(J)+J0(Q)+J0(Z)+K;var q,J,Q,Z,N,K},$.prototype.toRgb=function(){return C0(this.rgba)},$.prototype.toRgbString=function(){return q=C0(this.rgba),J=q.r,Q=q.g,Z=q.b,(N=q.a)<1?"rgba("+J+", "+Q+", "+Z+", "+N+")":"rgb("+J+", "+Q+", "+Z+")";var q,J,Q,Z,N},$.prototype.toHsl=function(){return s0(u(this.rgba))},$.prototype.toHslString=function(){return q=s0(u(this.rgba)),J=q.h,Q=q.s,Z=q.l,(N=q.a)<1?"hsla("+J+", "+Q+"%, "+Z+"%, "+N+")":"hsl("+J+", "+Q+"%, "+Z+"%)";var q,J,Q,Z,N},$.prototype.toHsv=function(){return q=$5(this.rgba),{h:D(q.h),s:D(q.s),v:D(q.v),a:D(q.a,3)};var q},$.prototype.invert=function(){return B({r:255-(q=this.rgba).r,g:255-q.g,b:255-q.b,a:q.a});var q},$.prototype.saturate=function(q){return q===void 0&&(q=0.1),B(_0(this.rgba,q))},$.prototype.desaturate=function(q){return q===void 0&&(q=0.1),B(_0(this.rgba,-q))},$.prototype.grayscale=function(){return B(_0(this.rgba,-1))},$.prototype.lighten=function(q){return q===void 0&&(q=0.1),B(r0(this.rgba,q))},$.prototype.darken=function(q){return q===void 0&&(q=0.1),B(r0(this.rgba,-q))},$.prototype.rotate=function(q){return q===void 0&&(q=15),this.hue(this.hue()+q)},$.prototype.alpha=function(q){return typeof q=="number"?B({r:(J=this.rgba).r,g:J.g,b:J.b,a:q}):D(this.rgba.a,3);var J},$.prototype.hue=function(q){var J=u(this.rgba);return typeof q=="number"?B({h:q,s:J.s,l:J.l,a:J.a}):D(J.h)},$.prototype.isEqual=function(q){return this.toHex()===B(q).toHex()},$}(),B=function($){return $ instanceof G0?$:new G0($)},t0=[],J5=function($){$.forEach(function(q){t0.indexOf(q)<0&&(q(G0,w0),t0.push(q))})};function X0($,q){var J={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},Q={};for(var Z in J)Q[J[Z]]=Z;var N={};$.prototype.toName=function(K){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var H,V,W=Q[this.toHex()];if(W)return W;if(K==null?void 0:K.closest){var O=this.toRgb(),z=1/0,F="black";if(!N.length)for(var k in J)N[k]=new $(J[k]).toRgb();for(var I in J){var A=(H=O,V=N[I],Math.pow(H.r-V.r,2)+Math.pow(H.g-V.g,2)+Math.pow(H.b-V.b,2));A<z&&(z=A,F=I)}return F}},q.string.push([function(K){var H=K.toLowerCase(),V=H==="transparent"?"#0000":J[H];return V?new $(V).toRgb():null},"name"])}J5([X0]);var c=class ${constructor(q=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=q}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(q){return this.value=q,this}set value(q){if(q instanceof $)this._value=this._cloneSource(q._value),this._int=q._int,this._components.set(q._components);else if(q===null)throw Error("Cannot set Color#value to null");else if(this._value===null||!this._isSourceEqual(this._value,q))this._value=this._cloneSource(q),this._normalize(this._value)}get value(){return this._value}_cloneSource(q){if(typeof q==="string"||typeof q==="number"||q instanceof Number||q===null)return q;else if(Array.isArray(q)||ArrayBuffer.isView(q))return q.slice(0);else if(typeof q==="object"&&q!==null)return{...q};return q}_isSourceEqual(q,J){let Q=typeof q;if(Q!==typeof J)return!1;else if(Q==="number"||Q==="string"||q instanceof Number)return q===J;else if(Array.isArray(q)&&Array.isArray(J)||ArrayBuffer.isView(q)&&ArrayBuffer.isView(J)){if(q.length!==J.length)return!1;return q.every((N,K)=>N===J[K])}else if(q!==null&&J!==null){let N=Object.keys(q),K=Object.keys(J);if(N.length!==K.length)return!1;return N.every((H)=>q[H]===J[H])}return q===J}toRgba(){let[q,J,Q,Z]=this._components;return{r:q,g:J,b:Q,a:Z}}toRgb(){let[q,J,Q]=this._components;return{r:q,g:J,b:Q}}toRgbaString(){let[q,J,Q]=this.toUint8RgbArray();return`rgba(${q},${J},${Q},${this.alpha})`}toUint8RgbArray(q){let[J,Q,Z]=this._components;if(!this._arrayRgb)this._arrayRgb=[];return q||(q=this._arrayRgb),q[0]=Math.round(J*255),q[1]=Math.round(Q*255),q[2]=Math.round(Z*255),q}toArray(q){if(!this._arrayRgba)this._arrayRgba=[];q||(q=this._arrayRgba);let[J,Q,Z,N]=this._components;return q[0]=J,q[1]=Q,q[2]=Z,q[3]=N,q}toRgbArray(q){if(!this._arrayRgb)this._arrayRgb=[];q||(q=this._arrayRgb);let[J,Q,Z]=this._components;return q[0]=J,q[1]=Q,q[2]=Z,q}toNumber(){return this._int}toBgrNumber(){let[q,J,Q]=this.toUint8RgbArray();return(Q<<16)+(J<<8)+q}toLittleEndianNumber(){let q=this._int;return(q>>16)+(q&65280)+((q&255)<<16)}multiply(q){let[J,Q,Z,N]=$._temp.setValue(q)._components;return this._components[0]*=J,this._components[1]*=Q,this._components[2]*=Z,this._components[3]*=N,this._refreshInt(),this._value=null,this}premultiply(q,J=!0){if(J)this._components[0]*=q,this._components[1]*=q,this._components[2]*=q;return this._components[3]=q,this._refreshInt(),this._value=null,this}toPremultiplied(q,J=!0){if(q===1)return-16777216+this._int;if(q===0)return J?0:this._int;let Q=this._int>>16&255,Z=this._int>>8&255,N=this._int&255;if(J)Q=Q*q+0.5|0,Z=Z*q+0.5|0,N=N*q+0.5|0;return(q*255<<24)+(Q<<16)+(Z<<8)+N}toHex(){let q=this._int.toString(16);return`#${"000000".substring(0,6-q.length)+q}`}toHexa(){let J=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-J.length)+J}setAlpha(q){return this._components[3]=this._clamp(q),this}_normalize(q){let J,Q,Z,N;if((typeof q==="number"||q instanceof Number)&&q>=0&&q<=16777215){let K=q;J=(K>>16&255)/255,Q=(K>>8&255)/255,Z=(K&255)/255,N=1}else if((Array.isArray(q)||q instanceof Float32Array)&&q.length>=3&&q.length<=4)q=this._clamp(q),[J,Q,Z,N=1]=q;else if((q instanceof Uint8Array||q instanceof Uint8ClampedArray)&&q.length>=3&&q.length<=4)q=this._clamp(q,0,255),[J,Q,Z,N=255]=q,J/=255,Q/=255,Z/=255,N/=255;else if(typeof q==="string"||typeof q==="object"){if(typeof q==="string"){let H=$.HEX_PATTERN.exec(q);if(H)q=`#${H[2]}`}let K=B(q);if(K.isValid())({r:J,g:Q,b:Z,a:N}=K.rgba),J/=255,Q/=255,Z/=255}if(J!==void 0)this._components[0]=J,this._components[1]=Q,this._components[2]=Z,this._components[3]=N,this._refreshInt();else throw Error(`Unable to convert color ${q}`)}_refreshInt(){this._clamp(this._components);let[q,J,Q]=this._components;this._int=(q*255<<16)+(J*255<<8)+(Q*255|0)}_clamp(q,J=0,Q=1){if(typeof q==="number")return Math.min(Math.max(q,J),Q);return q.forEach((Z,N)=>{q[N]=Math.min(Math.max(Z,J),Q)}),q}static isColorLike(q){return typeof q==="number"||typeof q==="string"||q instanceof Number||q instanceof $||Array.isArray(q)||q instanceof Uint8Array||q instanceof Uint8ClampedArray||q instanceof Float32Array||q.r!==void 0&&q.g!==void 0&&q.b!==void 0||q.r!==void 0&&q.g!==void 0&&q.b!==void 0&&q.a!==void 0||q.h!==void 0&&q.s!==void 0&&q.l!==void 0||q.h!==void 0&&q.s!==void 0&&q.l!==void 0&&q.a!==void 0||q.h!==void 0&&q.s!==void 0&&q.v!==void 0||q.h!==void 0&&q.s!==void 0&&q.v!==void 0&&q.a!==void 0}};c.shared=new c;c._temp=new c;c.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Z6=c;var Y0=0,Q5=500;function K6(...$){if(Y0===Q5)return;if(Y0++,Y0===Q5)console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS.");else console.warn("PixiJS Warning: ",...$)}var Z5={_registeredResources:new Set,register($){this._registeredResources.add($)},unregister($){this._registeredResources.delete($)},release(){this._registeredResources.forEach(($)=>$.clear())},get registeredCount(){return this._registeredResources.size},isRegistered($){return this._registeredResources.has($)},reset(){this._registeredResources.clear()}};class M0{constructor($,q){if(this._pool=[],this._count=0,this._index=0,this._classType=$,q)this.prepopulate(q)}prepopulate($){for(let q=0;q<$;q++)this._pool[this._index++]=new this._classType;this._count+=$}get($){let q;if(this._index>0)q=this._pool[--this._index];else q=new this._classType,this._count++;return q.init?.($),q}return($){$.reset?.(),this._pool[this._index++]=$}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let $=0;$<this._index;$++)this._pool[$].destroy();this._pool.length=0,this._count=0,this._index=0}}class N5{constructor(){this._poolsByClass=new Map}prepopulate($,q){this.getPool($).prepopulate(q)}get($,q){return this.getPool($).get(q)}return($){this.getPool($.constructor).return($)}getPool($){if(!this._poolsByClass.has($))this._poolsByClass.set($,new M0($));return this._poolsByClass.get($)}stats(){let $={};return this._poolsByClass.forEach((q)=>{let J=$[q._classType.name]?q._classType.name+q._classType.ID:q._classType.name;$[J]={free:q.totalFree,used:q.totalUsed,size:q.totalSize}}),$}clear(){this._poolsByClass.forEach(($)=>$.clear()),this._poolsByClass.clear()}}var a5=new N5;Z5.register(a5);var K5=new U;class Q0{constructor($=1/0,q=1/0,J=-1/0,Q=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=K5,this.minX=$,this.minY=q,this.maxX=J,this.maxY=Q}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){if(!this._rectangle)this._rectangle=new T;let $=this._rectangle;if(this.minX>this.maxX||this.minY>this.maxY)$.x=0,$.y=0,$.width=0,$.height=0;else $.copyFromBounds(this);return $}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=K5,this}set($,q,J,Q){this.minX=$,this.minY=q,this.maxX=J,this.maxY=Q}addFrame($,q,J,Q,Z){Z||(Z=this.matrix);let{a:N,b:K,c:H,d:V,tx:W,ty:O}=Z,z=this.minX,F=this.minY,k=this.maxX,I=this.maxY,A=N*$+H*q+W,L=K*$+V*q+O;if(A<z)z=A;if(L<F)F=L;if(A>k)k=A;if(L>I)I=L;if(A=N*J+H*q+W,L=K*J+V*q+O,A<z)z=A;if(L<F)F=L;if(A>k)k=A;if(L>I)I=L;if(A=N*$+H*Q+W,L=K*$+V*Q+O,A<z)z=A;if(L<F)F=L;if(A>k)k=A;if(L>I)I=L;if(A=N*J+H*Q+W,L=K*J+V*Q+O,A<z)z=A;if(L<F)F=L;if(A>k)k=A;if(L>I)I=L;this.minX=z,this.minY=F,this.maxX=k,this.maxY=I}addRect($,q){this.addFrame($.x,$.y,$.x+$.width,$.y+$.height,q)}addBounds($,q){this.addFrame($.minX,$.minY,$.maxX,$.maxY,q)}addBoundsMask($){this.minX=this.minX>$.minX?this.minX:$.minX,this.minY=this.minY>$.minY?this.minY:$.minY,this.maxX=this.maxX<$.maxX?this.maxX:$.maxX,this.maxY=this.maxY<$.maxY?this.maxY:$.maxY}applyMatrix($){let q=this.minX,J=this.minY,Q=this.maxX,Z=this.maxY,{a:N,b:K,c:H,d:V,tx:W,ty:O}=$,z=N*q+H*J+W,F=K*q+V*J+O;this.minX=z,this.minY=F,this.maxX=z,this.maxY=F,z=N*Q+H*J+W,F=K*Q+V*J+O,this.minX=z<this.minX?z:this.minX,this.minY=F<this.minY?F:this.minY,this.maxX=z>this.maxX?z:this.maxX,this.maxY=F>this.maxY?F:this.maxY,z=N*q+H*Z+W,F=K*q+V*Z+O,this.minX=z<this.minX?z:this.minX,this.minY=F<this.minY?F:this.minY,this.maxX=z>this.maxX?z:this.maxX,this.maxY=F>this.maxY?F:this.maxY,z=N*Q+H*Z+W,F=K*Q+V*Z+O,this.minX=z<this.minX?z:this.minX,this.minY=F<this.minY?F:this.minY,this.maxX=z>this.maxX?z:this.maxX,this.maxY=F>this.maxY?F:this.maxY}fit($){if(this.minX<$.left)this.minX=$.left;if(this.maxX>$.right)this.maxX=$.right;if(this.minY<$.top)this.minY=$.top;if(this.maxY>$.bottom)this.maxY=$.bottom;return this}fitBounds($,q,J,Q){if(this.minX<$)this.minX=$;if(this.maxX>q)this.maxX=q;if(this.minY<J)this.minY=J;if(this.maxY>Q)this.maxY=Q;return this}pad($,q=$){return this.minX-=$,this.maxX+=$,this.minY-=q,this.maxY+=q,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 Q0(this.minX,this.minY,this.maxX,this.maxY)}scale($,q=$){return this.minX*=$,this.minY*=q,this.maxX*=$,this.maxY*=q,this}get x(){return this.minX}set x($){let q=this.maxX-this.minX;this.minX=$,this.maxX=$+q}get y(){return this.minY}set y($){let q=this.maxY-this.minY;this.minY=$,this.maxY=$+q}get width(){return this.maxX-this.minX}set width($){this.maxX=this.minX+$}get height(){return this.maxY-this.minY}set height($){this.maxY=this.minY+$}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($,q,J,Q){let Z=this.minX,N=this.minY,K=this.maxX,H=this.maxY;Q||(Q=this.matrix);let{a:V,b:W,c:O,d:z,tx:F,ty:k}=Q;for(let I=q;I<J;I+=2){let A=$[I],L=$[I+1],G=V*A+O*L+F,j=W*A+z*L+k;Z=G<Z?G:Z,N=j<N?j:N,K=G>K?G:K,H=j>H?j:H}this.minX=Z,this.minY=N,this.maxX=K,this.maxY=H}containsPoint($,q){if(this.minX<=$&&this.minY<=q&&this.maxX>=$&&this.maxY>=q)return!0;return!1}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom($){return this.minX=$.minX,this.minY=$.minY,this.maxX=$.maxX,this.maxY=$.maxY,this}}function L6($,q){if($===16777215||!q)return q;if(q===16777215||!$)return $;let J=$>>16&255,Q=$>>8&255,Z=$&255,N=q>>16&255,K=q>>8&255,H=q&255,V=J*N/255|0,W=Q*K/255|0,O=Z*H/255|0;return(V<<16)+(W<<8)+O}var V5={createCanvas:($,q)=>{let J=document.createElement("canvas");return J.width=$,J.height=q,J},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:($,q)=>fetch($,q),parseXML:($)=>{return new DOMParser().parseFromString($,"text/xml")}};var H5=V5,b0={get(){return H5},set($){H5=$}};var j0=Object.create(null),W5=Object.create(null);function v($,q){let J=W5[$];if(J===void 0){if(j0[q]===void 0)j0[q]=1;W5[$]=J=j0[q]++}return J}var Z0;function z5(){if(!Z0||Z0?.isContextLost())Z0=b0.get().createCanvas().getContext("webgl",{});return Z0}var N0;function O5(){if(!N0){N0="mediump";let $=z5();if($){if($.getShaderPrecisionFormat)N0=$.getShaderPrecisionFormat($.FRAGMENT_SHADER,$.HIGH_FLOAT).precision?"highp":"mediump"}}return N0}function F5($,q,J){if(q)return $;if(J)return $=$.replace("out vec4 finalColor;",""),`
|
|
5
|
+
|
|
6
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
7
|
+
#define in varying
|
|
8
|
+
#define finalColor gl_FragColor
|
|
9
|
+
#define texture texture2D
|
|
10
|
+
#endif
|
|
11
|
+
${$}
|
|
12
|
+
`;return`
|
|
13
|
+
|
|
14
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
15
|
+
#define in attribute
|
|
16
|
+
#define out varying
|
|
17
|
+
#endif
|
|
18
|
+
${$}
|
|
19
|
+
`}function k5($,q,J){let Q=J?q.maxSupportedFragmentPrecision:q.maxSupportedVertexPrecision;if($.substring(0,9)!=="precision"){let Z=J?q.requestedFragmentPrecision:q.requestedVertexPrecision;if(Z==="highp"&&Q!=="highp")Z="mediump";return`precision ${Z} float;
|
|
20
|
+
${$}`}else if(Q!=="highp"&&$.substring(0,15)==="precision highp")return $.replace("precision highp","precision mediump");return $}function A5($,q){if(!q)return $;return`#version 300 es
|
|
21
|
+
${$}`}var r5={},t5={};function I5($,{name:q="pixi-program"},J=!0){q=q.replace(/\s+/g,"-"),q+=J?"-fragment":"-vertex";let Q=J?r5:t5;if(Q[q])Q[q]++,q+=`-${Q[q]}`;else Q[q]=1;if($.indexOf("#define SHADER_NAME")!==-1)return $;return`${`#define SHADER_NAME ${q}`}
|
|
22
|
+
${$}`}function L5($,q){if(!q)return $;return $.replace("#version 300 es","")}var R0={stripVersion:L5,ensurePrecision:k5,addProgramDefines:F5,setProgramName:I5,insertVersion:A5},n=Object.create(null),C5=class ${constructor(q){q={...$.defaultOptions,...q};let J=q.fragment.indexOf("#version 300 es")!==-1,Q={stripVersion:J,ensurePrecision:{requestedFragmentPrecision:q.preferredFragmentPrecision,requestedVertexPrecision:q.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:O5()},setProgramName:{name:q.name},addProgramDefines:J,insertVersion:J},Z=q.fragment,N=q.vertex;Object.keys(R0).forEach((K)=>{let H=Q[K];Z=R0[K](Z,H,!0),N=R0[K](N,H,!1)}),this.fragment=Z,this.vertex=N,this.transformFeedbackVaryings=q.transformFeedbackVaryings,this._key=v(`${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,n[this._cacheKey]=null}static from(q){let J=`${q.vertex}:${q.fragment}`;if(!n[J])n[J]=new $(q),n[J]._cacheKey=J;return n[J]}};C5.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};var _5=C5;var D5={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 w5($){return D5[$]??D5.float32}class i{constructor($){this.resources=Object.create(null),this._dirty=!0;let q=0;for(let J in $){let Q=$[J];this.setResource(Q,q++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let $=[],q=0;for(let J in this.resources)$[q++]=this.resources[J]._resourceId;this._key=$.join("|")}setResource($,q){let J=this.resources[q];if($===J)return;if(J)$.off?.("change",this.onResourceChange,this);$.on?.("change",this.onResourceChange,this),this.resources[q]=$,this._dirty=!0}getResource($){return this.resources[$]}_touch($,q){let J=this.resources;for(let Q in J)J[Q]._gcLastUsed=$,J[Q]._touched=q}destroy(){let $=this.resources;for(let q in $)$[q]?.off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange($){if(this._dirty=!0,$.destroyed){let q=this.resources;for(let J in q)if(q[J]===$)q[J]=null}else this._updateKey()}}var U0=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],G5=U0.reduce(($,q)=>{return $[q]=!0,$},{});function X5($,q){switch($){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*q);case"vec3<f32>":return new Float32Array(3*q);case"vec4<f32>":return new Float32Array(4*q);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Y5=class ${constructor(q,J){this._touched=0,this.uid=_("uniform"),this._resourceType="uniformGroup",this._resourceId=_("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,J={...$.defaultOptions,...J},this.uniformStructures=q;let Q={};for(let Z in q){let N=q[Z];if(N.name=Z,N.size=N.size??1,!G5[N.type]){let K=N.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(K){let[,H,V]=K;throw Error(`Uniform type ${N.type} is not supported. Use type: '${H}', size: ${V} instead.`)}throw Error(`Uniform type ${N.type} is not supported. Supported uniform types are: ${U0.join(", ")}`)}N.value??(N.value=X5(N.type,N.size)),Q[Z]=N.value}this.uniforms=Q,this._dirtyId=1,this.ubo=J.ubo,this.isStatic=J.isStatic,this._signature=v(Object.keys(Q).map((Z)=>`${Z}-${q[Z].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Y5.defaultOptions={ubo:!1,isStatic:!1};var M5=Y5;var e5={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},b5=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function j5($,q){let J;while((J=b5.exec($))!==null){let Q=e5[J[3]]??"float32";q[J[2]]={location:parseInt(J[1],10),format:Q,stride:w5(Q).stride,offset:0,instance:!1,start:0}}b5.lastIndex=0}function $8($){return $.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function R5({source:$,entryPoint:q}){let J={},Q=$8($),Z=Q.indexOf(`fn ${q}(`);if(Z===-1)return J;let N=Q.indexOf("->",Z);if(N===-1)return J;let K=Q.substring(Z,N);if(j5(K,J),Object.keys(J).length===0){let H=K.match(/\(\s*\w+\s*:\s*(\w+)/);if(H){let V=H[1],W=new RegExp(`struct\\s+${V}\\s*\\{([^}]+)\\}`,"s"),O=Q.match(W);if(O)j5(O[1],J)}}return J}function K0($){let q=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,J=/@group\((\d+)\)/,Q=/@binding\((\d+)\)/,Z=/var(<[^>]+>)? (\w+)/,N=/:\s*([\w<>]+)/,K=/struct\s+(\w+)\s*{([^}]+)}/g,H=/(\w+)\s*:\s*([\w\<\>]+)/g,V=/struct\s+(\w+)/,W=$.match(q)?.map((z)=>({group:parseInt(z.match(J)[1],10),binding:parseInt(z.match(Q)[1],10),name:z.match(Z)[2],isUniform:z.match(Z)[1]==="<uniform>",type:z.match(N)[1]}));if(!W)return{groups:[],structs:[]};let O=$.match(K)?.map((z)=>{let F=z.match(V)[1],k=z.match(H).reduce((I,A)=>{let[L,G]=A.split(":");return I[L.trim()]=G.trim(),I},{});if(!k)return null;return{name:F,members:k}}).filter(({name:z})=>W.some((F)=>F.type===z||F.type.includes(`<${z}>`)))??[];return{groups:W,structs:O}}var S=(($)=>{return $[$.VERTEX=1]="VERTEX",$[$.FRAGMENT=2]="FRAGMENT",$[$.COMPUTE=4]="COMPUTE",$})(S||{});function U5({groups:$}){let q=[];for(let J=0;J<$.length;J++){let Q=$[J];if(!q[Q.group])q[Q.group]=[];if(Q.isUniform)q[Q.group].push({binding:Q.binding,visibility:S.VERTEX|S.FRAGMENT,buffer:{type:"uniform"}});else if(Q.type==="sampler")q[Q.group].push({binding:Q.binding,visibility:S.FRAGMENT,sampler:{type:"filtering"}});else if(Q.type==="texture_2d"||Q.type.startsWith("texture_2d<"))q[Q.group].push({binding:Q.binding,visibility:S.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}});else if(Q.type==="texture_2d_array"||Q.type.startsWith("texture_2d_array<"))q[Q.group].push({binding:Q.binding,visibility:S.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}});else if(Q.type==="texture_cube"||Q.type.startsWith("texture_cube<"))q[Q.group].push({binding:Q.binding,visibility:S.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let J=0;J<q.length;J++)q[J]||(q[J]=[]);return q}function B5({groups:$}){let q=[];for(let J=0;J<$.length;J++){let Q=$[J];if(!q[Q.group])q[Q.group]={};q[Q.group][Q.name]=Q.binding}return q}function E5($,q){let J=new Set,Q=new Set,Z=[...$.structs,...q.structs].filter((K)=>{if(J.has(K.name))return!1;return J.add(K.name),!0}),N=[...$.groups,...q.groups].filter((K)=>{let H=`${K.name}-${K.binding}`;if(Q.has(H))return!1;return Q.add(H),!0});return{structs:Z,groups:N}}var s=Object.create(null);class V0{constructor($){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:q,vertex:J,layout:Q,gpuLayout:Z,name:N}=$;if(this.name=N,this.fragment=q,this.vertex=J,q.source===J.source){let K=K0(q.source);this.structsAndGroups=K}else{let K=K0(J.source),H=K0(q.source);this.structsAndGroups=E5(K,H)}this.layout=Q??B5(this.structsAndGroups),this.gpuLayout=Z??U5(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:$,fragment:q}=this,J=$.source+q.source+$.entryPoint+q.entryPoint;this._layoutKey=v(J,"program")}get attributeData(){return this._attributeData??(this._attributeData=R5(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,s[this._cacheKey]=null}static from($){let q=`${$.vertex.source}:${$.fragment.source}:${$.fragment.entryPoint}:${$.vertex.entryPoint}`;if(!s[q])s[q]=new V0($),s[q]._cacheKey=q;return s[q]}}class T5 extends Y{constructor($){super();this.uid=_("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:q,glProgram:J,groups:Q,resources:Z,compatibleRenderers:N,groupMap:K}=$;if(this.gpuProgram=q,this.glProgram=J,N===void 0){if(N=0,q)N|=q0.WEBGPU;if(J)N|=q0.WEBGL}this.compatibleRenderers=N;let H={};if(!Z&&!Q)Z={};if(Z&&Q)throw Error("[Shader] Cannot have both resources and groups");else if(!q&&Q&&!K)throw Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");else if(!q&&Q&&K)for(let V in K)for(let W in K[V]){let O=K[V][W];H[O]={group:V,binding:W,name:O}}else if(q&&Q&&!K){let V=q.structsAndGroups.groups;K={},V.forEach((W)=>{K[W.group]=K[W.group]||{},K[W.group][W.binding]=W.name,H[W.name]=W})}else if(Z){if(Q={},K={},q)q.structsAndGroups.groups.forEach((O)=>{K[O.group]=K[O.group]||{},K[O.group][O.binding]=O.name,H[O.name]=O});let V=0;for(let W in Z){if(H[W])continue;if(!Q[99])Q[99]=new i,this._ownedBindGroups.push(Q[99]);H[W]={group:99,binding:V,name:W},K[99]=K[99]||{},K[99][V]=W,V++}for(let W in Z){let O=W,z=Z[W];if(!z.source&&!z._resourceType)z=new M5(z);let F=H[O];if(F){if(!Q[F.group])Q[F.group]=new i,this._ownedBindGroups.push(Q[F.group]);Q[F.group].setResource(z,F.binding)}}}this.groups=Q,this._uniformBindMap=K,this.resources=this._buildResourceAccessor(Q,H)}addResource($,q,J){var Q,Z;if((Q=this._uniformBindMap)[q]||(Q[q]={}),(Z=this._uniformBindMap[q])[J]||(Z[J]=$),!this.groups[q])this.groups[q]=new i,this._ownedBindGroups.push(this.groups[q])}_buildResourceAccessor($,q){let J={};for(let Q in q){let Z=q[Q];Object.defineProperty(J,Z.name,{get(){return $[Z.group].getResource(Z.binding)},set(N){$[Z.group].setResource(N,Z.binding)}})}return J}destroy($=!1){if(this._destroyed)return;if(this._destroyed=!0,this.emit("destroy",this),$)this.gpuProgram?.destroy(),this.glProgram?.destroy();this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach((q)=>{q.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from($){let{gpu:q,gl:J,...Q}=$,Z,N;if(q)Z=V0.from(q);if(J)N=_5.from(J);return new T5({gpuProgram:Z,glProgram:N,...Q})}}var b=(($)=>{return $[$.MAP_READ=1]="MAP_READ",$[$.MAP_WRITE=2]="MAP_WRITE",$[$.COPY_SRC=4]="COPY_SRC",$[$.COPY_DST=8]="COPY_DST",$[$.INDEX=16]="INDEX",$[$.VERTEX=32]="VERTEX",$[$.UNIFORM=64]="UNIFORM",$[$.STORAGE=128]="STORAGE",$[$.INDIRECT=256]="INDIRECT",$[$.QUERY_RESOLVE=512]="QUERY_RESOLVE",$[$.STATIC=1024]="STATIC",$})(b||{});class l extends Y{constructor($){let{data:q,size:J}=$,{usage:Q,label:Z,shrinkToFit:N}=$;super();if(this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=_("buffer"),this._resourceType="buffer",this._resourceId=_("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,q instanceof Array)q=new Float32Array(q);this._data=q,J??(J=q?.byteLength);let K=!!q;this.descriptor={size:J,usage:Q,mappedAtCreation:K,label:Z},this.shrinkToFit=N??!0}get data(){return this._data}set data($){this.setDataWithSize($,$.length,!0)}get dataInt32(){if(!this._dataInt32)this._dataInt32=new Int32Array(this.data.buffer);return this._dataInt32}get static(){return!!(this.descriptor.usage&b.STATIC)}set static($){if($)this.descriptor.usage|=b.STATIC;else this.descriptor.usage&=~b.STATIC}setDataWithSize($,q,J){if(this._updateID++,this._updateSize=q*$.BYTES_PER_ELEMENT,this._data===$){if(J)this.emit("update",this);return}let Q=this._data;if(this._data=$,this._dataInt32=null,!Q||Q.length!==$.length){if(!this.shrinkToFit&&Q&&$.byteLength<Q.byteLength){if(J)this.emit("update",this)}else this.descriptor.size=$.byteLength,this._resourceId=_("resource"),this.emit("change",this);return}if(J)this.emit("update",this)}update($){this._updateSize=$??this._updateSize,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(let $ in this._gpuData)this._gpuData[$]?.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function B0($,q){if(!($ instanceof l)){let J=q?b.INDEX:b.VERTEX;if($ instanceof Array)if(q)$=new Uint32Array($),J=b.INDEX|b.COPY_DST;else $=new Float32Array($),J=b.VERTEX|b.COPY_DST;$=new l({data:$,label:q?"index-mesh-buffer":"vertex-mesh-buffer",usage:J})}return $}function S5($,q,J){let Q=$.getAttribute(q);if(!Q)return J.minX=0,J.minY=0,J.maxX=0,J.maxY=0,J;let Z=Q.buffer.data,N=1/0,K=1/0,H=-1/0,V=-1/0,W=Z.BYTES_PER_ELEMENT,O=(Q.offset||0)/W,z=(Q.stride||8)/W;for(let F=O;F<Z.length;F+=z){let k=Z[F],I=Z[F+1];if(k>H)H=k;if(I>V)V=I;if(k<N)N=k;if(I<K)K=I}return J.minX=N,J.minY=K,J.maxX=H,J.maxY=V,J}function q8($){if($ instanceof l||Array.isArray($)||$.BYTES_PER_ELEMENT)$={buffer:$};return $.buffer=B0($.buffer,!1),$}class J8 extends Y{constructor($={}){super();this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=_("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Q0,this._boundsDirty=!0;let{attributes:q,indexBuffer:J,topology:Q}=$;if(this.buffers=[],this.attributes={},q)for(let Z in q)this.addAttribute(Z,q[Z]);if(this.instanceCount=$.instanceCount??1,J)this.addIndex(J);this.topology=Q||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute($){return this.attributes[$]}getIndex(){return this.indexBuffer}getBuffer($){return this.getAttribute($).buffer}getSize(){for(let $ in this.attributes){let q=this.attributes[$];return q.buffer.data.length/(q.stride/4||q.size)}return 0}addAttribute($,q){let J=q8(q);if(this.buffers.indexOf(J.buffer)===-1)this.buffers.push(J.buffer),J.buffer.on("update",this.onBufferUpdate,this),J.buffer.on("change",this.onBufferUpdate,this);this.attributes[$]=J}addIndex($){this.indexBuffer=B0($,!0),this.buffers.push(this.indexBuffer)}get bounds(){if(!this._boundsDirty)return this._bounds;return this._boundsDirty=!1,S5(this,"aPosition",this._bounds)}unload(){this.emit("unload",this);for(let $ in this._gpuData)this._gpuData[$]?.destroy();this._gpuData=Object.create(null)}destroy($=!1){if(this.emit("destroy",this),this.removeAllListeners(),$)this.buffers.forEach((q)=>q.destroy());this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}class Q8{constructor(){this.uid=_("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add($){this.instructions[this.instructionSize++]=$}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}
|
|
23
|
+
export{W0 as Ja,K8 as Ka,Y as La,Z6 as Ma,O8 as Na,F8 as Oa,R as Pa,U as Qa,_ as Ra,e as Sa,X8 as Ta,p as Ua,K6 as Va,Z5 as Wa,a5 as Xa,T as Ya,Q0 as Za,L6 as _a,Q8 as $a,b8 as ab,v0 as bb,p0 as cb,m as db,C as eb,$0 as fb,L0 as gb,y as hb,b0 as ib,v as jb,z5 as kb,_5 as lb,w5 as mb,V0 as nb,i as ob,q0 as pb,M5 as qb,T5 as rb,b as sb,l as tb,J8 as ub};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as a}from"./chunk-edbhr7zr.js";import"./chunk-eb5gmq04.js";import"./chunk-a7wf9wxx.js";import"./chunk-kt3t4zv0.js";import"./chunk-sngkm5ds.js";import"./chunk-1sw3e1ar.js";import"./chunk-dvctxyxp.js";export{a as WebGLRenderer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as a}from"./chunk-zc79wdxj.js";import"./chunk-eb5gmq04.js";import"./chunk-a7wf9wxx.js";import"./chunk-kt3t4zv0.js";import"./chunk-fsbv6vcn.js";import"./chunk-0e4ebmdy.js";import"./chunk-sngkm5ds.js";import"./chunk-1sw3e1ar.js";import"./chunk-dvctxyxp.js";export{a as WebGPURenderer};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{ga as o}from"./chunk-kkmq6cvb.js";import{ha as jQ}from"./chunk-fsbv6vcn.js";import{ja as r,ka as ZQ,pa as IQ,qa as AQ,ra as l}from"./chunk-rp8z1jh7.js";import{sa as vQ}from"./chunk-pn7re3na.js";import{La as qQ,Ma as h,Qa as PQ,Ra as TQ,Sa as S,Ua as g,Va as s,Ya as $Q,cb as BQ,eb as hQ,hb as c,ib as XQ}from"./chunk-1sw3e1ar.js";class t extends qQ{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 g(S,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return g(S,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return g(S,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return g(S,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return g(S,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(Z=!1){this.emit("destroy",this),this.removeAllListeners();for(let Q in this.chars)this.chars[Q].texture?.destroy();if(this.chars=null,Z)this.pages.forEach((Q)=>Q.texture.destroy(!0)),this.pages=null}}class RQ{constructor(Z=0,Q=0,$=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=Z,this.resetTtl=$,this.size=0,this.ttl=Q}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(Z){if(this.has(Z)){let Q=this.items[Z];if(delete this.items[Z],this.size--,Q.prev!==null)Q.prev.next=Q.next;if(Q.next!==null)Q.next.prev=Q.prev;if(this.first===Q)this.first=Q.next;if(this.last===Q)this.last=Q.prev}return this}entries(Z=this.keys()){let Q=Array(Z.length);for(let $=0;$<Z.length;$++){let J=Z[$];Q[$]=[J,this.get(J)]}return Q}evict(Z=!1){if(Z||this.size>0){let Q=this.first;if(delete this.items[Q.key],--this.size===0)this.first=null,this.last=null;else this.first=Q.next,this.first.prev=null}return this}expiresAt(Z){let Q;if(this.has(Z))Q=this.items[Z].expiry;return Q}get(Z){let Q=this.items[Z];if(Q!==void 0){if(this.ttl>0){if(Q.expiry<=Date.now()){this.delete(Z);return}}return this.moveToEnd(Q),Q.value}return}has(Z){return Z in this.items}moveToEnd(Z){if(this.last===Z)return;if(Z.prev!==null)Z.prev.next=Z.next;if(Z.next!==null)Z.next.prev=Z.prev;if(this.first===Z)this.first=Z.next;if(Z.prev=this.last,Z.next=null,this.last!==null)this.last.next=Z;if(this.last=Z,this.first===null)this.first=Z}keys(){let Z=Array(this.size),Q=this.first,$=0;while(Q!==null)Z[$++]=Q.key,Q=Q.next;return Z}setWithEvicted(Z,Q,$=this.resetTtl){let J=null;if(this.has(Z))this.set(Z,Q,!0,$);else{if(this.max>0&&this.size===this.max)J={...this.first},this.evict(!0);let q=this.items[Z]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:Z,prev:this.last,next:null,value:Q};if(++this.size===1)this.first=q;else this.last.next=q;this.last=q}return J}set(Z,Q,$=!1,J=this.resetTtl){let q=this.items[Z];if($||q!==void 0){if(q.value=Q,$===!1&&J)q.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;this.moveToEnd(q)}else{if(this.max>0&&this.size===this.max)this.evict(!0);if(q=this.items[Z]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:Z,prev:this.last,next:null,value:Q},++this.size===1)this.first=q;else this.last.next=q;this.last=q}return this}values(Z=this.keys()){let Q=Array(Z.length);for(let $=0;$<Z.length;$++)Q[$]=this.get(Z[$]);return Q}}function VQ(Z=1000,Q=0,$=!1){if(isNaN(Z)||Z<0)throw TypeError("Invalid max value");if(isNaN(Q)||Q<0)throw TypeError("Invalid ttl value");if(typeof $!=="boolean")throw TypeError("Invalid resetTtl value");return new RQ(Z,Q,$)}function HQ(Z){return!!Z.tagStyles&&Object.keys(Z.tagStyles).length>0}function NQ(Z){return Z.includes("<")}function xQ(Z,Q){return Z.clone().assign(Q)}function MQ(Z,Q){let $=[],J=Q.tagStyles;if(!HQ(Q)||!NQ(Z))return $.push({text:Z,style:Q}),$;let q=[Q],V=[],z="",K=0;while(K<Z.length){let Y=Z[K];if(Y==="<"){let U=Z.indexOf(">",K);if(U===-1){z+=Y,K++;continue}let X=Z.slice(K+1,U);if(X.startsWith("/")){let H=X.slice(1).trim();if(V.length>0&&V[V.length-1]===H){if(z.length>0)$.push({text:z,style:q[q.length-1]}),z="";q.pop(),V.pop(),K=U+1;continue}else{z+=Z.slice(K,U+1),K=U+1;continue}}else{let H=X.trim();if(J[H]){if(z.length>0)$.push({text:z,style:q[q.length-1]}),z="";let D=q[q.length-1],A=xQ(D,J[H]);q.push(A),V.push(H),K=U+1;continue}else{z+=Z.slice(K,U+1),K=U+1;continue}}}else z+=Y,K++}if(z.length>0)$.push({text:z,style:q[q.length-1]});return $}var dQ=[10,13],yQ=new Set(dQ),uQ=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],cQ=new Set(uQ),LQ=/(\r\n|\r|\n)/,FQ=/(?:\r\n|\r|\n)/;function e(Z){if(typeof Z!=="string")return!1;return yQ.has(Z.charCodeAt(0))}function k(Z,Q){if(typeof Z!=="string")return!1;return cQ.has(Z.charCodeAt(0))}function zQ(Z){return Z==="normal"||Z==="pre-line"}function YQ(Z){return Z==="normal"}function p(Z){if(typeof Z!=="string")return"";let Q=Z.length-1;while(Q>=0&&k(Z[Q]))Q--;return Q<Z.length-1?Z.slice(0,Q+1):Z}function UQ(Z){let Q=[],$=[];if(typeof Z!=="string")return Q;for(let J=0;J<Z.length;J++){let q=Z[J],V=Z[J+1];if(k(q,V)||e(q)){if($.length>0)Q.push($.join("")),$.length=0;if(q==="\r"&&V===`
|
|
2
|
+
`)Q.push(`\r
|
|
3
|
+
`),J++;else Q.push(q);continue}$.push(q)}if($.length>0)Q.push($.join(""));return Q}function KQ(Z,Q,$,J){let q=$(Z),V=[];for(let z=0;z<q.length;z++){let K=q[z],Y=K,U=1;while(q[z+U]){let X=q[z+U];if(!J(Y,X,Z,z,Q))K+=X,Y=X,U++;else break}z+=U-1,V.push(K)}return V}var oQ=/\r\n|\r|\n/g;function wQ(Z,Q,$,J,q,V,z,K){let Y=MQ(Z,Q);if(YQ(Q.whiteSpace))for(let F=0;F<Y.length;F++){let C=Y[F];Y[F]={text:C.text.replace(oQ," "),style:C.style}}let X=[],H=[];for(let F of Y){let C=F.text.split(LQ);for(let v=0;v<C.length;v++){let f=C[v];if(f===`\r
|
|
4
|
+
`||f==="\r"||f===`
|
|
5
|
+
`)X.push(H),H=[];else if(f.length>0)H.push({text:f,style:F.style})}}if(H.length>0||X.length===0)X.push(H);let D=$?lQ(X,Q,J,q,z,K):X,A=[],E=[],j=[],G=[],O=[],I=0,_=Q._fontString,B=V(_);if(B.fontSize===0)B.fontSize=Q.fontSize,B.ascent=Q.fontSize;let N="",b=!!Q.dropShadow;for(let F of D){let C=0,v=B.ascent,f=B.descent,T="";for(let x of F){let u=x.style._fontString,JQ=V(u);if(u!==N)J.font=u,N=u;let a=q(x.text,x.style.letterSpacing,J);if(C+=a,v=Math.max(v,JQ.ascent),f=Math.max(f,JQ.descent),T+=x.text,!b&&x.style.dropShadow)b=!0}if(F.length===0)v=B.ascent,f=B.descent;A.push(C),E.push(v),j.push(f),O.push(T);let m=Q.lineHeight||v+f;G.push(m+Q.leading),I=Math.max(I,C)}let M=Q._stroke?.width||0,y=($&&Q.align!=="left"&&Q.align!=="justify"?Math.max(I,Q.wordWrapWidth):I)+M+(Q.dropShadow?Q.dropShadow.distance:0),R=0;for(let F=0;F<G.length;F++)R+=G[F];R=Math.max(R,G[0]+M);let W=R+(Q.dropShadow?Q.dropShadow.distance:0),L=Q.lineHeight||B.fontSize;return{width:y,height:W,lines:O,lineWidths:A,lineHeight:L+Q.leading,maxLineWidth:I,fontProperties:B,runsByLine:D,lineAscents:E,lineDescents:j,lineHeights:G,hasDropShadow:b}}function lQ(Z,Q,$,J,q,V){let{letterSpacing:z,whiteSpace:K,wordWrapWidth:Y,breakWords:U}=Q,X=zQ(K),H=Y+z,D={},A="",E=(G,O)=>{let I=`${G}|${O.styleKey}`,_=D[I];if(_===void 0){let B=O._fontString;if(B!==A)$.font=B,A=B;_=J(G,O.letterSpacing,$)+O.letterSpacing,D[I]=_}return _},j=[];for(let G of Z){let O=iQ(G),I=j.length,_=(R)=>{let W=0,L=R;do{let{token:F,style:C}=O[L];W+=E(F,C),L++}while(L<O.length&&O[L].continuesFromPrevious);return W},B=(R)=>{let W=[],L=R;do W.push({token:O[L].token,style:O[L].style}),L++;while(L<O.length&&O[L].continuesFromPrevious);return W},N=[],b=0,M=!X,P=null,w=()=>{if(P&&P.text.length>0)N.push(P);P=null},y=()=>{if(w(),N.length>0){let R=N[N.length-1];if(R.text=p(R.text),R.text.length===0)N.pop()}j.push(N),N=[],b=0,M=!1};for(let R=0;R<O.length;R++){let{token:W,style:L,continuesFromPrevious:F}=O[R],C=E(W,L);if(X){let T=k(W),m=P?.text[P.text.length-1]??N[N.length-1]?.text.slice(-1)??"",x=m?k(m):!1;if(T&&x)continue}let v=!F,f=v?_(R):C;if(f>H&&v){if(b>0)y();if(U){let T=B(R);for(let m=0;m<T.length;m++){let x=T[m].token,u=T[m].style,JQ=KQ(x,U,V,q);for(let a of JQ){let _Q=E(a,u);if(_Q+b>H)y();if(!P||P.style!==u)w(),P={text:a,style:u};else P.text+=a;b+=_Q}}R+=T.length-1}else{let T=B(R);w(),j.push(T.map((m)=>({text:m.token,style:m.style}))),M=!1,R+=T.length-1}}else if(f+b>H&&v){if(k(W)){M=!1;continue}y(),P={text:W,style:L},b=C}else if(F&&!U){if(!P||P.style!==L)w(),P={text:W,style:L};else P.text+=W;b+=C}else{let T=k(W);if(b===0&&T&&!M)continue;if(!P||P.style!==L)w(),P={text:W,style:L};else P.text+=W;b+=C}}if(w(),N.length>0){let R=N[N.length-1];if(R.text=p(R.text),R.text.length===0)N.pop()}if(N.length>0||j.length===I)j.push(N)}return j}function iQ(Z){let Q=[],$=!1;for(let J of Z){let q=UQ(J.text),V=!0;for(let z of q){let K=k(z)||e(z),Y=V&&$&&!K;Q.push({token:z,style:J.style,continuesFromPrevious:Y}),$=!K,V=!1}}return Q}var rQ={willReadFrequently:!0};function WQ(Z,Q,$,J,q){let V=$[Z];if(typeof V!=="number")V=q(Z,Q,J)+Q,$[Z]=V;return V}function CQ(Z,Q,$,J,q,V,z){let K=$.getContext("2d",rQ);K.font=Q._fontString;let Y=0,U="",X=[],H=Object.create(null),{letterSpacing:D,whiteSpace:A}=Q,E=zQ(A),j=YQ(A),G=!E,O=Q.wordWrapWidth+D,I=UQ(Z);for(let B=0;B<I.length;B++){let N=I[B];if(e(N)){if(!j){X.push(p(U)),G=!E,U="",Y=0;continue}N=" "}if(E){let M=k(N),P=k(U[U.length-1]);if(M&&P)continue}let b=WQ(N,D,H,K,J);if(b>O){if(U!=="")X.push(p(U)),U="",Y=0;if(q(N,Q.breakWords)){let M=KQ(N,Q.breakWords,z,V);for(let P of M){let w=WQ(P,D,H,K,J);if(w+Y>O)X.push(p(U)),G=!1,U="",Y=0;U+=P,Y+=w}}else{if(U.length>0)X.push(p(U)),U="",Y=0;X.push(p(N)),G=!1,U="",Y=0}}else{if(b+Y>O)G=!1,X.push(p(U)),U="",Y=0;if(U.length>0||!k(N)||G)U+=N,Y+=b}}let _=p(U);if(_.length>0)X.push(_);return X.join(`
|
|
6
|
+
`)}var fQ={willReadFrequently:!0},d=class Z{static get experimentalLetterSpacingSupported(){let Q=Z._experimentalLetterSpacingSupported;if(Q===void 0){let $=XQ.get().getCanvasRenderingContext2D().prototype;Q=Z._experimentalLetterSpacingSupported="letterSpacing"in $||"textLetterSpacing"in $}return Q}constructor(Q,$,J,q,V,z,K,Y,U,X){if(this.text=Q,this.style=$,this.width=J,this.height=q,this.lines=V,this.lineWidths=z,this.lineHeight=K,this.maxLineWidth=Y,this.fontProperties=U,X)this.runsByLine=X.runsByLine,this.lineAscents=X.lineAscents,this.lineDescents=X.lineDescents,this.lineHeights=X.lineHeights,this.hasDropShadow=X.hasDropShadow}static measureText(Q=" ",$,J=Z._canvas,q=$.wordWrap){let V=`${Q}-${$.styleKey}-wordWrap-${q}`;if(Z._measurementCache.has(V))return Z._measurementCache.get(V);if(HQ($)&&NQ(Q)){let N=wQ(Q,$,q,Z._context,Z._measureText,Z.measureFont,Z.canBreakChars,Z.wordWrapSplit),b=new Z(Q,$,N.width,N.height,N.lines,N.lineWidths,N.lineHeight,N.maxLineWidth,N.fontProperties,{runsByLine:N.runsByLine,lineAscents:N.lineAscents,lineDescents:N.lineDescents,lineHeights:N.lineHeights,hasDropShadow:N.hasDropShadow});return Z._measurementCache.set(V,b),b}let K=$._fontString,Y=Z.measureFont(K);if(Y.fontSize===0)Y.fontSize=$.fontSize,Y.ascent=$.fontSize,Y.descent=0;let U=Z._context;U.font=K;let H=(q?Z._wordWrap(Q,$,J):Q).split(FQ),D=Array(H.length),A=0;for(let N=0;N<H.length;N++){let b=Z._measureText(H[N],$.letterSpacing,U);D[N]=b,A=Math.max(A,b)}let E=$._stroke?.width??0,j=$.lineHeight||Y.fontSize,G=Z._getAlignWidth(A,$,q),O=Z._adjustWidthForStyle(G,$),I=Math.max(j,Y.fontSize+E)+(H.length-1)*(j+$.leading),_=Z._adjustHeightForStyle(I,$),B=new Z(Q,$,O,_,H,D,j+$.leading,A,Y);return Z._measurementCache.set(V,B),B}static _adjustWidthForStyle(Q,$){let J=$._stroke?.width||0,q=Q+J;if($.dropShadow)q+=$.dropShadow.distance;return q}static _adjustHeightForStyle(Q,$){let J=Q;if($.dropShadow)J+=$.dropShadow.distance;return J}static _getAlignWidth(Q,$,J){return J&&$.align!=="left"&&$.align!=="justify"?Math.max(Q,$.wordWrapWidth):Q}static _measureText(Q,$,J){let q=!1;if(Z.experimentalLetterSpacingSupported)if(Z.experimentalLetterSpacing)J.letterSpacing=`${$}px`,J.textLetterSpacing=`${$}px`,q=!0;else J.letterSpacing="0px",J.textLetterSpacing="0px";let V=J.measureText(Q),z=V.width,K=-(V.actualBoundingBoxLeft??0),U=(V.actualBoundingBoxRight??0)-K;if(z>0)if(q)z-=$,U-=$;else{let X=(Z.graphemeSegmenter(Q).length-1)*$;z+=X,U+=X}return Math.max(z,U)}static _wordWrap(Q,$,J=Z._canvas){return CQ(Q,$,J,Z._measureText,Z.canBreakWords,Z.canBreakChars,Z.wordWrapSplit)}static isBreakingSpace(Q,$){return k(Q,$)}static canBreakWords(Q,$){return $}static canBreakChars(Q,$,J,q,V){return!0}static wordWrapSplit(Q){return Z.graphemeSegmenter(Q)}static measureFont(Q){if(Z._fonts[Q])return Z._fonts[Q];let $=Z._context;$.font=Q;let J=$.measureText(Z.METRICS_STRING+Z.BASELINE_SYMBOL),q=J.actualBoundingBoxAscent??0,V=J.actualBoundingBoxDescent??0,z={ascent:q,descent:V,fontSize:q+V};return Z._fonts[Q]=z,z}static clearMetrics(Q=""){if(Q)delete Z._fonts[Q];else Z._fonts={}}static get _canvas(){if(!Z.__canvas){let Q;try{let $=new OffscreenCanvas(0,0);if($.getContext("2d",fQ)?.measureText)return Z.__canvas=$,$;Q=XQ.get().createCanvas()}catch($){Q=XQ.get().createCanvas()}Q.width=Q.height=10,Z.__canvas=Q}return Z.__canvas}static get _context(){if(!Z.__context)Z.__context=Z._canvas.getContext("2d",fQ);return Z.__context}};d.METRICS_STRING="|ÉqÅ";d.BASELINE_SYMBOL="M";d.BASELINE_MULTIPLIER=1.4;d.HEIGHT_MULTIPLIER=2;d.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter==="function"){let Z=new Intl.Segmenter;return(Q)=>{let $=Z.segment(Q),J=[],q=0;for(let V of $)J[q++]=V.segment;return J}}return(Z)=>[...Z]})();d.experimentalLetterSpacing=!1;d._fonts={};d._measurementCache=VQ(1000);var i=d;var sQ=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function QQ(Z){let Q=typeof Z.fontSize==="number"?`${Z.fontSize}px`:Z.fontSize,$=Z.fontFamily;if(!Array.isArray(Z.fontFamily))$=Z.fontFamily.split(",");for(let J=$.length-1;J>=0;J--){let q=$[J].trim();if(!/([\"\'])[^\'\"]+\1/.test(q)&&!sQ.includes(q))q=`"${q}"`;$[J]=q}return`${Z.fontStyle} ${Z.fontVariant} ${Z.fontWeight} ${Q} ${$.join(",")}`}var GQ=class Z extends qQ{constructor(Q={}){super();this.uid=TQ("textStyle"),this._tick=0,this._cachedFontString=null,nQ(Q);let $=Q instanceof Z,J=Q;if($)Q=J._toObject();let q={...Z.defaultTextStyle,...Q};for(let V in q){let z=V;this[z]=q[V]}this._tagStyles=Q.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(Q){if(this._align===Q)return;this._align=Q,this.update()}get breakWords(){return this._breakWords}set breakWords(Q){if(this._breakWords===Q)return;this._breakWords=Q,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(Q){if(this._dropShadow===Q)return;if(Q!==null&&typeof Q==="object")this._dropShadow=this._createProxy({...Z.defaultDropShadow,...Q});else this._dropShadow=Q?this._createProxy({...Z.defaultDropShadow}):null;this.update()}get fontFamily(){return this._fontFamily}set fontFamily(Q){if(this._fontFamily===Q)return;this._fontFamily=Q,this.update()}get fontSize(){return this._fontSize}set fontSize(Q){if(this._fontSize===Q)return;if(typeof Q==="string")this._fontSize=parseInt(Q,10);else this._fontSize=Q;this.update()}get fontStyle(){return this._fontStyle}set fontStyle(Q){if(this._fontStyle===Q)return;this._fontStyle=Q.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(Q){if(this._fontVariant===Q)return;this._fontVariant=Q,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(Q){if(this._fontWeight===Q)return;this._fontWeight=Q,this.update()}get leading(){return this._leading}set leading(Q){if(this._leading===Q)return;this._leading=Q,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(Q){if(this._letterSpacing===Q)return;this._letterSpacing=Q,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(Q){if(this._lineHeight===Q)return;this._lineHeight=Q,this.update()}get padding(){return this._padding}set padding(Q){if(this._padding===Q)return;this._padding=Q,this.update()}get filters(){return this._filters}set filters(Q){if(this._filters===Q)return;this._filters=Object.freeze(Q),this.update()}get trim(){return this._trim}set trim(Q){if(this._trim===Q)return;this._trim=Q,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(Q){if(this._textBaseline===Q)return;this._textBaseline=Q,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(Q){if(this._whiteSpace===Q)return;this._whiteSpace=Q,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(Q){if(this._wordWrap===Q)return;this._wordWrap=Q,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(Q){if(this._wordWrapWidth===Q)return;this._wordWrapWidth=Q,this.update()}get fill(){return this._originalFill}set fill(Q){if(Q===this._originalFill)return;if(this._originalFill=Q,this._isFillStyle(Q))this._originalFill=this._createProxy({...l.defaultFillStyle,...Q},()=>{this._fill=IQ({...this._originalFill},l.defaultFillStyle)});this._fill=IQ(Q===0?"black":Q,l.defaultFillStyle),this.update()}get stroke(){return this._originalStroke}set stroke(Q){if(Q===this._originalStroke)return;if(this._originalStroke=Q,this._isFillStyle(Q))this._originalStroke=this._createProxy({...l.defaultStrokeStyle,...Q},()=>{this._stroke=AQ({...this._originalStroke},l.defaultStrokeStyle)});this._stroke=AQ(Q,l.defaultStrokeStyle),this.update()}get tagStyles(){return this._tagStyles}set tagStyles(Q){if(this._tagStyles===Q)return;this._tagStyles=Q??void 0,this.update()}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){let Q=Z.defaultTextStyle;for(let $ in Q)this[$]=Q[$]}assign(Q){for(let $ in Q){let J=$;this[J]=Q[$]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){if(this._cachedFontString===null)this._cachedFontString=QQ(this);return this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,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?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new Z(this._toObject())}_getFinalPadding(){let Q=0;if(this._filters)for(let $=0;$<this._filters.length;$++)Q+=this._filters[$].padding;return Math.max(this._padding,Q)}destroy(Q=!1){if(this.removeAllListeners(),typeof Q==="boolean"?Q:Q?.texture){let J=typeof Q==="boolean"?Q:Q?.textureSource;if(this._fill?.texture)this._fill.texture.destroy(J);if(this._originalFill?.texture)this._originalFill.texture.destroy(J);if(this._stroke?.texture)this._stroke.texture.destroy(J);if(this._originalStroke?.texture)this._originalStroke.texture.destroy(J)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(Q,$){return new Proxy(Q,{set:(J,q,V)=>{if(J[q]===V)return!0;return J[q]=V,$?.(q,V),this.update(),!0}})}_isFillStyle(Q){return(Q??null)!==null&&!(h.isColorLike(Q)||Q instanceof r||Q instanceof ZQ)}};GQ.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};GQ.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};var n=GQ;function nQ(Z){let Q=Z;if(typeof Q.dropShadow==="boolean"&&Q.dropShadow){let $=n.defaultDropShadow;Z.dropShadow={alpha:Q.dropShadowAlpha??$.alpha,angle:Q.dropShadowAngle??$.angle,blur:Q.dropShadowBlur??$.blur,color:Q.dropShadowColor??$.color,distance:Q.dropShadowDistance??$.distance}}if(Q.strokeThickness!==void 0){g(S,"strokeThickness is now a part of stroke");let $=Q.stroke,J={};if(h.isColorLike($))J.color=$;else if($ instanceof r||$ instanceof ZQ)J.fill=$;else if(Object.hasOwnProperty.call($,"color")||Object.hasOwnProperty.call($,"fill"))J=$;else throw Error("Invalid stroke value.");Z.stroke={...J,width:Q.strokeThickness}}if(Array.isArray(Q.fillGradientStops)){if(g(S,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(Q.fill)||Q.fill.length===0)throw Error("Invalid fill value. Expected an array of colors for gradient fill.");if(Q.fill.length!==Q.fillGradientStops.length)s("The number of fill colors must match the number of fill gradient stops.");let $=new r({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),J=Q.fillGradientStops.slice(),q=Q.fill.map((V)=>h.shared.setValue(V).toNumber());J.forEach((V,z)=>{$.addColorStop(V,q[z])}),Z.fill={fill:$}}}var kQ=1e5;function EQ(Z,Q,$,J=0,q=0,V=0){if(Z.texture===c.WHITE&&!Z.fill)return h.shared.setValue(Z.color).setAlpha(Z.alpha??1).toHexa();else if(!Z.fill){let z=Q.createPattern(Z.texture.source.resource,"repeat"),K=Z.matrix.copyTo(PQ.shared);return K.scale(Z.texture.source.pixelWidth,Z.texture.source.pixelHeight),z.setTransform(K),z}else if(Z.fill instanceof ZQ){let z=Z.fill,K=Q.createPattern(z.texture.source.resource,"repeat"),Y=z.transform.copyTo(PQ.shared);return Y.scale(z.texture.source.pixelWidth,z.texture.source.pixelHeight),K.setTransform(Y),K}else if(Z.fill instanceof r){let z=Z.fill,K=z.type==="linear",Y=z.textureSpace==="local",U=1,X=1;if(Y&&$)U=$.width+J,X=$.height+J;let H,D=!1;if(K){let{start:A,end:E}=z;H=Q.createLinearGradient(A.x*U+q,A.y*X+V,E.x*U+q,E.y*X+V),D=Math.abs(E.x-A.x)<Math.abs((E.y-A.y)*0.1)}else{let{center:A,innerRadius:E,outerCenter:j,outerRadius:G}=z;H=Q.createRadialGradient(A.x*U+q,A.y*X+V,E*U,j.x*U+q,j.y*X+V,G*U)}if(D&&Y&&$){let A=$.lineHeight/X;for(let E=0;E<$.lines.length;E++){let j=(E*$.lineHeight+J/2)/X;z.colorStops.forEach((G)=>{let O=j+G.offset*A;O=Math.max(0,Math.min(1,O)),H.addColorStop(Math.floor(O*kQ)/kQ,h.shared.setValue(G.color).toHex())})}}else z.colorStops.forEach((A)=>{H.addColorStop(A.offset,h.shared.setValue(A.color).toHex())});return H}return s("FillStyle not recognised",Z),"red"}var SQ=class Z extends t{constructor(Q){super();this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;let $={...Z.defaultOptions,...Q};this._textureSize=$.textureSize,this._mipmap=$.mipmap;let J=$.style.clone();if($.overrideFill)J._fill.color=16777215,J._fill.alpha=1,J._fill.texture=c.WHITE,J._fill.fill=null;this.applyFillAsTint=$.overrideFill;let q=J.fontSize;J.fontSize=this.baseMeasurementFontSize;let V=QQ(J);if($.overrideSize){if(J._stroke)J._stroke.width*=this.baseRenderedFontSize/q}else J.fontSize=this.baseRenderedFontSize=q;if(this._style=J,this._skipKerning=$.skipKerning??!1,this.resolution=$.resolution??1,this._padding=$.padding??4,$.textureStyle)this._textureStyle=$.textureStyle instanceof BQ?$.textureStyle:new BQ($.textureStyle);this.fontMetrics=i.measureFont(V),this.lineHeight=J.lineHeight||this.fontMetrics.fontSize||J.fontSize}ensureCharacters(Q){let $=i.graphemeSegmenter(Q).filter((G)=>!this._currentChars.includes(G)).filter((G,O,I)=>I.indexOf(G)===O);if(!$.length)return;this._currentChars=[...this._currentChars,...$];let J;if(this._currentPageIndex===-1)J=this._nextPage();else J=this.pages[this._currentPageIndex];let{canvas:q,context:V}=J.canvasAndContext,z=J.texture.source,K=this._style,Y=this._currentX,U=this._currentY,X=this._currentMaxCharHeight,H=this.baseRenderedFontSize/this.baseMeasurementFontSize,D=this._padding*H,A=!1,E=q.width/this.resolution,j=q.height/this.resolution;for(let G=0;G<$.length;G++){let O=$[G],I=i.measureText(O,K,q,!1);I.lineHeight=I.height;let _=I.width*H,B=Math.ceil((K.fontStyle==="italic"?2:1)*_),N=I.height*H,b=B+D*2,M=N+D*2;if(A=!1,O!==`
|
|
7
|
+
`&&O!=="\r"&&O!=="\t"&&O!==" ")A=!0,X=Math.ceil(Math.max(M,X));if(Y+b>E){if(U+=X,X=M,Y=0,U+X>j){z.update();let w=this._nextPage();q=w.canvasAndContext.canvas,V=w.canvasAndContext.context,z=w.texture.source,Y=0,U=0,X=0}}let P=_/H-(K.dropShadow?.distance??0)-(K._stroke?.width??0);if(this.chars[O]={id:O.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:P,kerning:{}},A){this._drawGlyph(V,I,Y+D,U+D,H,K);let w=z.width*H,y=z.height*H,R=new $Q(Y/w*z.width,U/y*z.height,b/w*z.width,M/y*z.height);this.chars[O].texture=new c({source:z,frame:R}),Y+=Math.ceil(b)}}z.update(),this._currentX=Y,this._currentY=U,this._currentMaxCharHeight=X,this._skipKerning&&this._applyKerning($,V)}get pageTextures(){return g(S,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(Q,$){let J=this._measureCache;for(let q=0;q<Q.length;q++){let V=Q[q];for(let z=0;z<this._currentChars.length;z++){let K=this._currentChars[z],Y=J[V];if(!Y)Y=J[V]=$.measureText(V).width;let U=J[K];if(!U)U=J[K]=$.measureText(K).width;let X=$.measureText(V+K).width,H=X-(Y+U);if(H)this.chars[V].kerning[K]=H;if(X=$.measureText(V+K).width,H=X-(Y+U),H)this.chars[K].kerning[V]=H}}}_nextPage(){this._currentPageIndex++;let Q=this.resolution,$=jQ.getOptimalCanvasAndContext(this._textureSize,this._textureSize,Q);this._setupContext($.context,this._style,Q);let J=Q*(this.baseRenderedFontSize/this.baseMeasurementFontSize),q=new c({source:new vQ({resource:$.canvas,resolution:J,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});if(this._textureStyle)q.source.style=this._textureStyle;let V={canvasAndContext:$,texture:q};return this.pages[this._currentPageIndex]=V,V}_setupContext(Q,$,J){$.fontSize=this.baseRenderedFontSize,Q.scale(J,J),Q.font=QQ($),$.fontSize=this.baseMeasurementFontSize,Q.textBaseline=$.textBaseline;let q=$._stroke,V=q?.width??0;if(q)Q.lineWidth=V,Q.lineJoin=q.join,Q.miterLimit=q.miterLimit,Q.strokeStyle=EQ(q,Q);if($._fill)Q.fillStyle=EQ($._fill,Q);if($.dropShadow){let z=$.dropShadow,K=h.shared.setValue(z.color).toArray(),Y=z.blur*J,U=z.distance*J;Q.shadowColor=`rgba(${K[0]*255},${K[1]*255},${K[2]*255},${z.alpha})`,Q.shadowBlur=Y,Q.shadowOffsetX=Math.cos(z.angle)*U,Q.shadowOffsetY=Math.sin(z.angle)*U}else Q.shadowColor="black",Q.shadowBlur=0,Q.shadowOffsetX=0,Q.shadowOffsetY=0}_drawGlyph(Q,$,J,q,V,z){let{text:K,fontProperties:Y}=$,X=(z._stroke?.width??0)*V,H=J+X/2,D=q-X/2,A=Y.descent*V,E=$.lineHeight*V,j=!1;if(z.stroke&&X)j=!0,Q.strokeText(K,H,D+E-A);let{shadowBlur:G,shadowOffsetX:O,shadowOffsetY:I}=Q;if(z._fill){if(j)Q.shadowBlur=0,Q.shadowOffsetX=0,Q.shadowOffsetY=0;Q.fillText(K,H,D+E-A)}if(j)Q.shadowBlur=G,Q.shadowOffsetX=O,Q.shadowOffsetY=I}destroy(){super.destroy();for(let Q=0;Q<this.pages.length;Q++){let{canvasAndContext:$,texture:J}=this.pages[Q];jQ.returnCanvasAndContext($),J.destroy(!0)}this.pages=null}};SQ.defaultOptions={textureSize:512,style:new n,mipmap:!0};var bQ=SQ;function gQ(Z,Q,$,J){let q={width:0,height:0,offsetY:0,scale:Q.fontSize/$.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};q.offsetY=$.baseLineOffset;let V=q.lines[0],z=null,K=!0,Y={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},U=$.baseMeasurementFontSize/Q.fontSize,X=Q.letterSpacing*U,H=Q.wordWrapWidth*U,D=Q.lineHeight?Q.lineHeight*U:$.lineHeight,A=Q.wordWrap&&Q.breakWords,E=(O)=>{let I=V.width;for(let _=0;_<Y.index;_++){let B=O.positions[_];V.chars.push(O.chars[_]),V.charPositions.push(B+I)}V.width+=O.width,K=!1,Y.width=0,Y.index=0,Y.chars.length=0},j=()=>{let O=V.chars.length-1;if(J){let I=V.chars[O];while(I===" ")V.width-=$.chars[I].xAdvance,I=V.chars[--O]}q.width=Math.max(q.width,V.width),V={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},K=!0,q.lines.push(V),q.height+=D},G=(O)=>O-X>H;for(let O=0;O<Z.length+1;O++){let I,_=O===Z.length;if(!_)I=Z[O];let B=$.chars[I]||$.chars[" "];if(/(?:\s)/.test(I)||I==="\r"||I===`
|
|
8
|
+
`||_){if(!K&&Q.wordWrap&&G(V.width+Y.width)){if(j(),E(Y),!_)V.charPositions.push(0)}else if(Y.start=V.width,E(Y),!_)V.charPositions.push(0);if(I==="\r"||I===`
|
|
9
|
+
`)j();else if(!_){let P=B.xAdvance+(B.kerning[z]||0)+X;V.width+=P,V.spaceWidth=P,V.spacesIndex.push(V.charPositions.length),V.chars.push(I)}}else{let M=B.kerning[z]||0,P=B.xAdvance+M+X;if(A&&G(V.width+Y.width+P))E(Y),j();Y.positions[Y.index++]=Y.width+M,Y.chars.push(I),Y.width+=P}z=I}if(j(),Q.align==="center")aQ(q);else if(Q.align==="right")tQ(q);else if(Q.align==="justify")eQ(q);return q}function aQ(Z){for(let Q=0;Q<Z.lines.length;Q++){let $=Z.lines[Q],J=Z.width/2-$.width/2;for(let q=0;q<$.charPositions.length;q++)$.charPositions[q]+=J}}function tQ(Z){for(let Q=0;Q<Z.lines.length;Q++){let $=Z.lines[Q],J=Z.width-$.width;for(let q=0;q<$.charPositions.length;q++)$.charPositions[q]+=J}}function eQ(Z){let Q=Z.width;for(let $=0;$<Z.lines.length;$++){let J=Z.lines[$],q=0,V=J.spacesIndex[q++],z=0,K=J.spacesIndex.length,U=(Q-J.width)/K;for(let X=0;X<J.charPositions.length;X++){if(X===V)V=J.spacesIndex[q++],z+=U;J.charPositions[X]+=z}}}function mQ(Z){if(Z==="")return[];if(typeof Z==="string")Z=[Z];let Q=[];for(let $=0,J=Z.length;$<J;$++){let q=Z[$];if(Array.isArray(q)){if(q.length!==2)throw Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${q.length}.`);if(q[0].length===0||q[1].length===0)throw Error("[BitmapFont]: Invalid character delimiter.");let V=q[0].charCodeAt(0),z=q[1].charCodeAt(0);if(z<V)throw Error("[BitmapFont]: Invalid character range.");for(let K=V,Y=z;K<=Y;K++)Q.push(String.fromCharCode(K))}else Q.push(...Array.from(q))}if(Q.length===0)throw Error("[BitmapFont]: Empty set when resolving characters.");return Q}var OQ=0;class pQ{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,textureStyle:null},this.measureCache=VQ(1000)}getFont(Z,Q){let $=`${Q.fontFamily}-bitmap`,J=!0;if(Q._fill.fill&&!Q._stroke)$+=Q._fill.fill.styleKey,J=!1;else if(Q._stroke||Q.dropShadow)$=`${Q.styleKey}-bitmap`,J=!1;if(!o.has($)){let V=Object.create(Q);V._lineHeight=0;let z=new bQ({style:V,overrideFill:J,overrideSize:!0,...this.defaultOptions});if(OQ++,OQ>50)s("BitmapText",`You have dynamically created ${OQ} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``);z.once("destroy",()=>{OQ--,o.remove($)}),o.set($,z)}let q=o.get($);return q.ensureCharacters?.(Z),q}getLayout(Z,Q,$=!0){let J=this.getFont(Z,Q),q=`${Z}-${Q.styleKey}-${$}`;if(this.measureCache.has(q))return this.measureCache.get(q);let V=i.graphemeSegmenter(Z),z=gQ(V,Q,J,$);return this.measureCache.set(q,z),z}measureText(Z,Q,$=!0){return this.getLayout(Z,Q,$)}install(...Z){let Q=Z[0];if(typeof Q==="string")Q={name:Q,style:Z[1],chars:Z[2]?.chars,resolution:Z[2]?.resolution,padding:Z[2]?.padding,skipKerning:Z[2]?.skipKerning},g(S,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})");let $=Q?.name;if(!$)throw Error("[BitmapFontManager] Property `name` is required.");Q={...this.defaultOptions,...Q};let J=Q.style,q=J instanceof n?J:new n(J),V=Q.dynamicFill??this._canUseTintForStyle(q),z=new bQ({style:q,overrideFill:V,skipKerning:Q.skipKerning,padding:Q.padding,resolution:Q.resolution,overrideSize:!1,textureStyle:Q.textureStyle}),K=mQ(Q.chars);return z.ensureCharacters(K.join("")),o.set(`${$}-bitmap`,z),z.once("destroy",()=>o.remove(`${$}-bitmap`)),z}uninstall(Z){let Q=`${Z}-bitmap`,$=o.get(Q);if($)$.destroy()}_canUseTintForStyle(Z){return!Z._stroke&&(!Z.dropShadow||Z.dropShadow.color===0)&&!Z._fill.fill&&Z._fill.color===16777215}}var DQ=new pQ;class QZ extends t{constructor(Z,Q){super();let{textures:$,data:J}=Z;Object.keys(J.pages).forEach((q)=>{let V=J.pages[parseInt(q,10)],z=$[V.id];this.pages.push({texture:z})}),Object.keys(J.chars).forEach((q)=>{let V=J.chars[q],{frame:z,source:K,rotate:Y}=$[V.page],U=hQ.transformRectCoords(V,z,Y,new $Q),X=new c({frame:U,orig:new $Q(0,0,V.width,V.height),source:K,rotate:Y});this.chars[q]={id:q.codePointAt(0),xOffset:V.xOffset,yOffset:V.yOffset,xAdvance:V.xAdvance,kerning:V.kerning??{},texture:X}}),this.baseRenderedFontSize=J.fontSize,this.baseMeasurementFontSize=J.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:J.fontSize},this.baseLineOffset=J.baseLineOffset,this.lineHeight=J.lineHeight,this.fontFamily=J.fontFamily,this.distanceField=J.distanceField??{type:"none",range:0},this.url=Q}destroy(){super.destroy();for(let Z=0;Z<this.pages.length;Z++){let{texture:Q}=this.pages[Z];Q.destroy(!0)}this.pages=null}static install(Z){DQ.install(Z)}static uninstall(Z){DQ.uninstall(Z)}}export{QZ as ea};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import{N as l,O as n,P as $J,S as HJ,T as j,Y as qJ,_ as T,aa as i,ba as NJ,da as BJ}from"./chunk-kt3t4zv0.js";import{fa as R,ga as I}from"./chunk-kkmq6cvb.js";import{sa as OJ}from"./chunk-pn7re3na.js";import{Ja as G,Ka as A,Qa as c,Va as M,Ya as y,Za as P,db as U,fb as YJ,hb as B,ib as S,lb as wJ,nb as CJ,ob as UJ,pb as jJ,qb as FJ,ub as MJ}from"./chunk-1sw3e1ar.js";var h=((J)=>{return J[J.Low=0]="Low",J[J.Normal=1]="Normal",J[J.High=2]="High",J})(h||{});function E(J){if(typeof J!=="string")throw TypeError(`Path must be a string. Received ${JSON.stringify(J)}`)}function v(J){return J.split("?")[0].split("#")[0]}function AJ(J){return J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vJ(J,Q,Z){return J.replace(new RegExp(AJ(Q),"g"),Z)}function yJ(J,Q){let Z="",$=0,H=-1,W=0,K=-1;for(let q=0;q<=J.length;++q){if(q<J.length)K=J.charCodeAt(q);else if(K===47)break;else K=47;if(K===47){if(H===q-1||W===1);else if(H!==q-1&&W===2){if(Z.length<2||$!==2||Z.charCodeAt(Z.length-1)!==46||Z.charCodeAt(Z.length-2)!==46){if(Z.length>2){let _=Z.lastIndexOf("/");if(_!==Z.length-1){if(_===-1)Z="",$=0;else Z=Z.slice(0,_),$=Z.length-1-Z.lastIndexOf("/");H=q,W=0;continue}}else if(Z.length===2||Z.length===1){Z="",$=0,H=q,W=0;continue}}if(Q){if(Z.length>0)Z+="/..";else Z="..";$=2}}else{if(Z.length>0)Z+=`/${J.slice(H+1,q)}`;else Z=J.slice(H+1,q);$=q-H-1}H=q,W=0}else if(K===46&&W!==-1)++W;else W=-1}return Z}var F={toPosix(J){return vJ(J,"\\","/")},isUrl(J){return/^https?:/.test(this.toPosix(J))},isDataUrl(J){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(J)},isBlobUrl(J){return J.startsWith("blob:")},hasProtocol(J){return/^[^/:]+:/.test(this.toPosix(J))},getProtocol(J){E(J),J=this.toPosix(J);let Q=/^file:\/\/\//.exec(J);if(Q)return Q[0];let Z=/^[^/:]+:\/{0,2}/.exec(J);if(Z)return Z[0];return""},toAbsolute(J,Q,Z){if(E(J),this.isDataUrl(J)||this.isBlobUrl(J))return J;let $=v(this.toPosix(Q??S.get().getBaseUrl())),H=v(this.toPosix(Z??this.rootname($)));if(J=this.toPosix(J),J.startsWith("/"))return F.join(H,J.slice(1));return this.isAbsolute(J)?J:this.join($,J)},normalize(J){if(E(J),J.length===0)return".";if(this.isDataUrl(J)||this.isBlobUrl(J))return J;J=this.toPosix(J);let Q="",Z=J.startsWith("/");if(this.hasProtocol(J))Q=this.rootname(J),J=J.slice(Q.length);let $=J.endsWith("/");if(J=yJ(J,!1),J.length>0&&$)J+="/";if(Z)return`/${J}`;return Q+J},isAbsolute(J){if(E(J),J=this.toPosix(J),this.hasProtocol(J))return!0;return J.startsWith("/")},join(...J){if(J.length===0)return".";let Q;for(let Z=0;Z<J.length;++Z){let $=J[Z];if(E($),$.length>0)if(Q===void 0)Q=$;else{let H=J[Z-1]??"";if(this.joinExtensions.includes(this.extname(H).toLowerCase()))Q+=`/../${$}`;else Q+=`/${$}`}}if(Q===void 0)return".";return this.normalize(Q)},dirname(J){if(E(J),J.length===0)return".";J=this.toPosix(J);let Q=J.charCodeAt(0),Z=Q===47,$=-1,H=!0,W=this.getProtocol(J),K=J;J=J.slice(W.length);for(let q=J.length-1;q>=1;--q)if(Q=J.charCodeAt(q),Q===47){if(!H){$=q;break}}else H=!1;if($===-1)return Z?"/":this.isUrl(K)?W+J:W;if(Z&&$===1)return"//";return W+J.slice(0,$)},rootname(J){E(J),J=this.toPosix(J);let Q="";if(J.startsWith("/"))Q="/";else Q=this.getProtocol(J);if(this.isUrl(J)){let Z=J.indexOf("/",Q.length);if(Z!==-1)Q=J.slice(0,Z);else Q=J;if(!Q.endsWith("/"))Q+="/"}return Q},basename(J,Q){if(E(J),Q)E(Q);J=v(this.toPosix(J));let Z=0,$=-1,H=!0,W;if(Q!==void 0&&Q.length>0&&Q.length<=J.length){if(Q.length===J.length&&Q===J)return"";let K=Q.length-1,q=-1;for(W=J.length-1;W>=0;--W){let _=J.charCodeAt(W);if(_===47){if(!H){Z=W+1;break}}else{if(q===-1)H=!1,q=W+1;if(K>=0)if(_===Q.charCodeAt(K)){if(--K===-1)$=W}else K=-1,$=q}}if(Z===$)$=q;else if($===-1)$=J.length;return J.slice(Z,$)}for(W=J.length-1;W>=0;--W)if(J.charCodeAt(W)===47){if(!H){Z=W+1;break}}else if($===-1)H=!1,$=W+1;if($===-1)return"";return J.slice(Z,$)},extname(J){E(J),J=v(this.toPosix(J));let Q=-1,Z=0,$=-1,H=!0,W=0;for(let K=J.length-1;K>=0;--K){let q=J.charCodeAt(K);if(q===47){if(!H){Z=K+1;break}continue}if($===-1)H=!1,$=K+1;if(q===46){if(Q===-1)Q=K;else if(W!==1)W=1}else if(Q!==-1)W=-1}if(Q===-1||$===-1||W===0||W===1&&Q===$-1&&Q===Z+1)return"";return J.slice(Q,$)},parse(J){E(J);let Q={root:"",dir:"",base:"",ext:"",name:""};if(J.length===0)return Q;J=v(this.toPosix(J));let Z=J.charCodeAt(0),$=this.isAbsolute(J),H,W="";if(Q.root=this.rootname(J),$||this.hasProtocol(J))H=1;else H=0;let K=-1,q=0,_=-1,Y=!0,N=J.length-1,z=0;for(;N>=H;--N){if(Z=J.charCodeAt(N),Z===47){if(!Y){q=N+1;break}continue}if(_===-1)Y=!1,_=N+1;if(Z===46){if(K===-1)K=N;else if(z!==1)z=1}else if(K!==-1)z=-1}if(K===-1||_===-1||z===0||z===1&&K===_-1&&K===q+1){if(_!==-1)if(q===0&&$)Q.base=Q.name=J.slice(1,_);else Q.base=Q.name=J.slice(q,_)}else{if(q===0&&$)Q.name=J.slice(1,K),Q.base=J.slice(1,_);else Q.name=J.slice(q,K),Q.base=J.slice(q,_);Q.ext=J.slice(K,_)}if(Q.dir=this.dirname(J),W)Q.dir=W+Q.dir;return Q},sep:"/",delimiter:":",joinExtensions:[".html"]};function t(J,Q,Z,$,H){let W=Q[Z];for(let K=0;K<W.length;K++){let q=W[K];if(Z<Q.length-1)t(J.replace($[Z],q),Q,Z+1,$,H);else H.push(J.replace($[Z],q))}}function e(J){let Q=/\{(.*?)\}/g,Z=J.match(Q),$=[];if(Z){let H=[];Z.forEach((W)=>{let K=W.substring(1,W.length-1).split(",");H.push(K)}),t(J,H,0,Z,$)}else $.push(J);return $}var d=(J)=>!Array.isArray(J);class D{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(J,Q)=>`${J}${this._bundleIdConnector}${Q}`,extractAssetIdFromBundle:(J,Q)=>Q.replace(`${J}${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(J){if(this._bundleIdConnector=J.connector??this._bundleIdConnector,this._createBundleAssetId=J.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=J.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...J){J.forEach((Q)=>{if(this._preferredOrder.push(Q),!Q.priority)Q.priority=Object.keys(Q.params)}),this._resolverHash={}}set basePath(J){this._basePath=J}get basePath(){return this._basePath}set rootPath(J){this._rootPath=J}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(J){if(typeof J==="string")this._defaultSearchParams=J;else{let Q=J;this._defaultSearchParams=Object.keys(Q).map((Z)=>`${encodeURIComponent(Z)}=${encodeURIComponent(Q[Z])}`).join("&")}}getAlias(J){let{alias:Q,src:Z}=J;return R(Q||Z,(H)=>{if(typeof H==="string")return H;if(Array.isArray(H))return H.map((W)=>W?.src??W);if(H?.src)return H.src;return H},!0)}addManifest(J){if(this._manifest)M("[Resolver] Manifest already exists, this will be overwritten");this._manifest=J,J.bundles.forEach((Q)=>{this.addBundle(Q.name,Q.assets)})}addBundle(J,Q){let Z=[],$=Q;if(!Array.isArray(Q))$=Object.entries(Q).map(([H,W])=>{if(typeof W==="string"||Array.isArray(W))return{alias:H,src:W};return{alias:H,...W}});$.forEach((H)=>{let{src:W,alias:K}=H,q;if(typeof K==="string"){let _=this._createBundleAssetId(J,K);Z.push(_),q=[K,_]}else{let _=K.map((Y)=>this._createBundleAssetId(J,Y));Z.push(..._),q=[...K,..._]}this.add({...H,...{alias:q,src:W}})}),this._bundles[J]=Z}add(J){let Q=[];if(Array.isArray(J))Q.push(...J);else Q.push(J);let Z;Z=(H)=>{if(this.hasKey(H))M(`[Resolver] already has key: ${H} overwriting`)},R(Q).forEach((H)=>{let{src:W}=H,{data:K,format:q,loadParser:_,parser:Y}=H,N=R(W).map((O)=>{if(typeof O==="string")return e(O);return Array.isArray(O)?O:[O]}),z=this.getAlias(H);Array.isArray(z)?z.forEach(Z):Z(z);let X=[],V=(O)=>{let w=this._parsers.find((C)=>C.test(O));return{src:O,...w?.parse(O)}};N.forEach((O)=>{O.forEach((w)=>{let C={};if(typeof w!=="object")C=V(w);else{if(K=w.data??K,q=w.format??q,w.loadParser||w.parser)_=w.loadParser??_,Y=w.parser??Y;C={...V(w.src),...w}}if(!z)throw Error(`[Resolver] alias is undefined for this asset: ${C.src}`);C=this._buildResolvedAsset(C,{aliases:z,data:K,format:q,loadParser:_,parser:Y,progressSize:H.progressSize}),X.push(C)})}),z.forEach((O)=>{this._assetMap[O]=X})})}resolveBundle(J){let Q=d(J);J=R(J);let Z={};return J.forEach(($)=>{let H=this._bundles[$];if(H){let W=this.resolve(H),K={};for(let q in W){let _=W[q];K[this._extractAssetIdFromBundle($,q)]=_}Z[$]=K}}),Q?Z[J[0]]:Z}resolveUrl(J){let Q=this.resolve(J);if(typeof J!=="string"){let Z={};for(let $ in Q)Z[$]=Q[$].src;return Z}return Q.src}resolve(J){let Q=d(J);J=R(J);let Z={};return J.forEach(($)=>{if(!this._resolverHash[$])if(this._assetMap[$]){let H=this._assetMap[$],W=this._getPreferredOrder(H);W?.priority.forEach((K)=>{W.params[K].forEach((q)=>{let _=H.filter((Y)=>{if(Y[K])return Y[K]===q;return!1});if(_.length)H=_})}),this._resolverHash[$]=H[0]}else this._resolverHash[$]=this._buildResolvedAsset({alias:[$],src:$},{});Z[$]=this._resolverHash[$]}),Q?Z[J[0]]:Z}hasKey(J){return!!this._assetMap[J]}hasBundle(J){return!!this._bundles[J]}_getPreferredOrder(J){for(let Q=0;Q<J.length;Q++){let Z=J[Q],$=this._preferredOrder.find((H)=>H.params.format.includes(Z.format));if($)return $}return this._preferredOrder[0]}_appendDefaultSearchParams(J){if(!this._defaultSearchParams)return J;let Q=/\?/.test(J)?"&":"?";return`${J}${Q}${this._defaultSearchParams}`}_buildResolvedAsset(J,Q){let{aliases:Z,data:$,loadParser:H,parser:W,format:K,progressSize:q}=Q;if(this._basePath||this._rootPath)J.src=F.toAbsolute(J.src,this._basePath,this._rootPath);if(J.alias=Z??J.alias??[J.src],J.src=this._appendDefaultSearchParams(J.src),J.data={...$||{},...J.data},J.loadParser=H??J.loadParser,J.parser=W??J.parser,J.format=K??J.format??TJ(J.src),q!==void 0)J.progressSize=q;return J}}D.RETINA_PREFIX=/@([0-9\.]+)x/;function TJ(J){return J.split(".").pop().split("?").shift().split("#").shift()}var p=(J,Q)=>{let Z=Q.split("?")[1];if(Z)J+=`?${Z}`;return J};var JJ=class J{constructor(Q,Z){this.linkedSheets=[];let $=Q;if(Q?.source instanceof U)$={texture:Q,data:Z};let{texture:H,data:W,cachePrefix:K=""}=$;this.cachePrefix=K,this._texture=H instanceof B?H:null,this.textureSource=H.source,this.textures={},this.animations={},this.data=W;let q=parseFloat(W.meta.scale);if(q)this.resolution=q,H.source.resolution=this.resolution;else this.resolution=H.source._resolution;this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise((Q)=>{if(this._callback=Q,this._batchIndex=0,this._frameKeys.length<=J.BATCH_SIZE)this._processFrames(0),this._processAnimations(),this._parseComplete();else this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(Q,Z=!1){let $=Q,H=Z?1/0:J.BATCH_SIZE;while($-Q<H&&$<this._frameKeys.length){let W=this._frameKeys[$],K=this._frames[W],q=K.frame;if(q){let _=null,Y=null,N=K.trimmed!==!1&&K.sourceSize?K.sourceSize:K.frame,z=new y(0,0,Math.floor(N.w)/this.resolution,Math.floor(N.h)/this.resolution);if(K.rotated)_=new y(Math.floor(q.x)/this.resolution,Math.floor(q.y)/this.resolution,Math.floor(q.h)/this.resolution,Math.floor(q.w)/this.resolution);else _=new y(Math.floor(q.x)/this.resolution,Math.floor(q.y)/this.resolution,Math.floor(q.w)/this.resolution,Math.floor(q.h)/this.resolution);if(K.trimmed!==!1&&K.spriteSourceSize)Y=new y(Math.floor(K.spriteSourceSize.x)/this.resolution,Math.floor(K.spriteSourceSize.y)/this.resolution,Math.floor(q.w)/this.resolution,Math.floor(q.h)/this.resolution);this.textures[W]=new B({source:this.textureSource,frame:_,orig:z,trim:Y,rotate:K.rotated?2:0,defaultAnchor:K.anchor,defaultBorders:K.borders,label:W.toString()})}$++}}_processAnimations(){let Q=this.data.animations||{};for(let Z in Q){this.animations[Z]=[];for(let $=0;$<Q[Z].length;$++){let H=Q[Z][$];this.animations[Z].push(this.textures[H])}}}_parseComplete(){let Q=this._callback;this._callback=null,this._batchIndex=0,Q.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*J.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{if(this._batchIndex*J.BATCH_SIZE<this._frameKeys.length)this._nextBatch();else this._processAnimations(),this._parseComplete()},0)}destroy(Q=!1){for(let Z in this.textures)this.textures[Z].destroy();if(this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,Q)this._texture?.destroy(),this.textureSource.destroy();this._texture=null,this.textureSource=null,this.linkedSheets=[]}};JJ.BATCH_SIZE=1000;var u=JJ;var SJ=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function QJ(J,Q,Z){let $={};if(J.forEach((H)=>{$[H]=Q}),Object.keys(Q.textures).forEach((H)=>{$[`${Q.cachePrefix}${H}`]=Q.textures[H]}),!Z){let H=F.dirname(J[0]);Q.linkedSheets.forEach((W,K)=>{let q=QJ([`${H}/${Q.data.meta.related_multi_packs[K]}`],W,!0);Object.assign($,q)})}return $}var ZJ={extension:G.Asset,cache:{test:(J)=>J instanceof u,getCacheableAssets:(J,Q)=>QJ(J,Q,!1)},resolver:{extension:{type:G.ResolveParser,name:"resolveSpritesheet"},test:(J)=>{let Z=J.split("?")[0].split("."),$=Z.pop(),H=Z.pop();return $==="json"&&SJ.includes(H)},parse:(J)=>{let Q=J.split(".");return{resolution:parseFloat(D.RETINA_PREFIX.exec(J)?.[1]??"1"),format:Q[Q.length-2],src:J}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:G.LoadParser,priority:h.Normal,name:"spritesheetLoader"},async testParse(J,Q){return F.extname(Q.src).toLowerCase()===".json"&&!!J.frames},async parse(J,Q,Z){let{texture:$,imageFilename:H,textureOptions:W,cachePrefix:K}=Q?.data??{},q=F.dirname(Q.src);if(q&&q.lastIndexOf("/")!==q.length-1)q+="/";let _;if($ instanceof B)_=$;else{let z=p(q+(H??J.meta.image),Q.src);_=(await Z.load([{src:z,data:W}]))[z]}let Y=new u({texture:_.source,data:J,cachePrefix:K});await Y.parse();let N=J?.meta?.related_multi_packs;if(Array.isArray(N)){let z=[];for(let V of N){if(typeof V!=="string")continue;let O=q+V;if(Q.data?.ignoreMultiPack)continue;O=p(O,Q.src),z.push(Z.load({src:O,data:{textureOptions:W,ignoreMultiPack:!0}}))}let X=await Promise.all(z);Y.linkedSheets=X,X.forEach((V)=>{V.linkedSheets=[Y].concat(Y.linkedSheets.filter((O)=>O!==V))})}return Y},async unload(J,Q,Z){await Z.unload(J.textureSource._sourceOrigin),J.destroy(!1)}}};A.add(ZJ);var DJ=new P;function k(J,Q,Z){let $=DJ;J.measurable=!0,$J(J,Z,$),Q.addBoundsMask($),J.measurable=!1}function g(J,Q,Z){let $=n.get();J.measurable=!0;let H=l.get().identity(),W=WJ(J,Z,H);HJ(J,$,W),J.measurable=!1,Q.addBoundsMask($),l.return(H),n.return($)}function WJ(J,Q,Z){if(!J)return M("Mask bounds, renderable is not inside the root container"),Z;if(J!==Q)WJ(J.parent,Q,Z),J.updateLocalTransform(),Z.append(J.localTransform);return Z}class b{constructor(J){if(this.priority=0,this.inverse=!1,this.pipe="alphaMask",J?.mask)this.init(J.mask)}init(J){this.mask=J,this.renderMaskToTexture=!(J instanceof i),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){if(this.mask===null)return;this.mask.measurable=!0,this.mask=null}addBounds(J,Q){if(!this.inverse)k(this.mask,J,Q)}addLocalBounds(J,Q){g(this.mask,J,Q)}containsPoint(J,Q){let Z=this.mask;return Q(Z,J)}destroy(){this.reset()}static test(J){return J instanceof i}}b.extension=G.MaskEffect;class x{constructor(J){if(this.priority=0,this.pipe="colorMask",J?.mask)this.init(J.mask)}init(J){this.mask=J}destroy(){}static test(J){return typeof J==="number"}}x.extension=G.MaskEffect;class f{constructor(J){if(this.priority=0,this.pipe="stencilMask",J?.mask)this.init(J.mask)}init(J){this.mask=J,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){if(this.mask===null)return;this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(J,Q){k(this.mask,J,Q)}addLocalBounds(J,Q){g(this.mask,J,Q)}containsPoint(J,Q){let Z=this.mask;return Q(Z,J)}destroy(){this.reset()}static test(J){return J instanceof qJ}}f.extension=G.MaskEffect;var o;async function KJ(){return o??(o=(async()=>{let Q=S.get().createCanvas(1,1).getContext("webgl");if(!Q)return"premultiply-alpha-on-upload";let Z=await new Promise((K)=>{let q=document.createElement("video");q.onloadeddata=()=>K(q),q.onerror=()=>K(null),q.autoplay=!1,q.crossOrigin="anonymous",q.preload="auto",q.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",q.load()});if(!Z)return"premultiply-alpha-on-upload";let $=Q.createTexture();Q.bindTexture(Q.TEXTURE_2D,$);let H=Q.createFramebuffer();Q.bindFramebuffer(Q.FRAMEBUFFER,H),Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_2D,$,0),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),Q.pixelStorei(Q.UNPACK_COLORSPACE_CONVERSION_WEBGL,Q.NONE),Q.texImage2D(Q.TEXTURE_2D,0,Q.RGBA,Q.RGBA,Q.UNSIGNED_BYTE,Z);let W=new Uint8Array(4);return Q.readPixels(0,0,1,1,Q.RGBA,Q.UNSIGNED_BYTE,W),Q.deleteFramebuffer(H),Q.deleteTexture($),Q.getExtension("WEBGL_lose_context")?.loseContext(),W[0]<=W[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),o}var m=class J extends U{constructor(Q){super(Q);if(this.isReady=!1,this.uploadMethodId="video",Q={...J.defaultOptions,...Q},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=Q.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=Q.autoPlay!==!1,this.alphaMode=Q.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),Q.autoLoad!==!1)this.load()}updateFrame(){if(this.destroyed)return;if(this._updateFPS){let Q=T.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-Q)}if(!this._updateFPS||this._msToNextUpdate<=0)this._msToNextUpdate=this._updateFPS?Math.floor(1000/this._updateFPS):0;if(this.isValid)this.update()}_videoFrameRequestCallback(){if(this.updateFrame(),this.destroyed)this._videoFrameRequestCallbackHandle=null;else 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 Q=this.resource,Z=this.options;if((Q.readyState===Q.HAVE_ENOUGH_DATA||Q.readyState===Q.HAVE_FUTURE_DATA)&&Q.width&&Q.height)Q.complete=!0;if(Q.addEventListener("play",this._onPlayStart),Q.addEventListener("pause",this._onPlayStop),Q.addEventListener("seeked",this._onSeeked),!this._isSourceReady()){if(!Z.preload)Q.addEventListener("canplay",this._onCanPlay);Q.addEventListener("canplaythrough",this._onCanPlayThrough),Q.addEventListener("error",this._onError,!0)}else this._mediaReady();return this.alphaMode=await KJ(),this._load=new Promise(($,H)=>{if(this.isValid)$(this);else{if(this._resolve=$,this._reject=H,Z.preloadTimeoutMs!==void 0)this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${Z.preloadTimeoutMs}ms`))});Q.load()}}),this._load}_onError(Q){if(this.resource.removeEventListener("error",this._onError,!0),this.emit("error",Q),this._reject)this._reject(Q),this._reject=null,this._resolve=null}_isSourcePlaying(){let Q=this.resource;return!Q.paused&&!Q.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){if(!this.isValid)this._mediaReady();this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){if(this._autoUpdate&&!this._isSourcePlaying())this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){if(this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout)clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0;this._mediaReady()}_mediaReady(){let Q=this.resource;if(this.isValid)this.isReady=!0,this.resize(Q.videoWidth,Q.videoHeight);if(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve)this._resolve(this),this._resolve=null,this._reject=null;if(this._isSourcePlaying())this._onPlayStart();else if(this.autoPlay)this.resource.play()}destroy(){this._configureAutoUpdate();let Q=this.resource;if(Q)Q.removeEventListener("play",this._onPlayStart),Q.removeEventListener("pause",this._onPlayStop),Q.removeEventListener("seeked",this._onSeeked),Q.removeEventListener("canplay",this._onCanPlay),Q.removeEventListener("canplaythrough",this._onCanPlayThrough),Q.removeEventListener("error",this._onError,!0),Q.pause(),Q.src="",Q.load();super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(Q){if(Q!==this._autoUpdate)this._autoUpdate=Q,this._configureAutoUpdate()}get updateFPS(){return this._updateFPS}set updateFPS(Q){if(Q!==this._updateFPS)this._updateFPS=Q,this._configureAutoUpdate()}_configureAutoUpdate(){if(this._autoUpdate&&this._isSourcePlaying())if(!this._updateFPS&&this.resource.requestVideoFrameCallback){if(this._isConnectedToTicker)T.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0;if(this._videoFrameRequestCallbackHandle===null)this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}else{if(this._videoFrameRequestCallbackHandle!==null)this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null;if(!this._isConnectedToTicker)T.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0}else{if(this._videoFrameRequestCallbackHandle!==null)this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null;if(this._isConnectedToTicker)T.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0}}static test(Q){return globalThis.HTMLVideoElement&&Q instanceof HTMLVideoElement}};m.extension=G.TextureSource;m.defaultOptions={...U.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};m.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var _J=m;var a=[];A.handleByList(G.TextureSource,a);function zJ(J={}){let Q=J&&J.resource,Z=Q?J.resource:J,$=Q?J:{resource:J};for(let H=0;H<a.length;H++){let W=a[H];if(W.test(Z))return new W($)}throw Error(`Could not find a source type for resource: ${$.resource}`)}function PJ(J={},Q=!1){let Z=J&&J.resource,$=Z?J.resource:J,H=Z?J:{resource:J};if(!Q&&I.has($))return I.get($);let W=new B({source:zJ(H)});if(W.on("destroy",()=>{if(I.has($))I.remove($)}),!Q)I.set($,W);return W}function kJ(J,Q=!1){if(typeof J==="string")return I.get(J);else if(J instanceof U)return new B({source:J});return PJ(J,Q)}B.from=kJ;U.from=zJ;A.add(b,x,f,_J,OJ,NJ,YJ);class XJ{constructor(J){this._renderer=J}push(J,Q,Z){this._renderer.renderPipes.batch.break(Z),Z.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:Q,filterEffect:J})}pop(J,Q,Z){this._renderer.renderPipes.batch.break(Z),Z.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(J){if(J.action==="pushFilter")this._renderer.filter.push(J);else if(J.action==="popFilter")this._renderer.filter.pop()}destroy(){this._renderer=null}}XJ.extension={type:[G.WebGLPipes,G.WebGPUPipes,G.CanvasPipes],name:"filter"};var GJ=`in vec2 aPosition;
|
|
2
|
+
out vec2 vTextureCoord;
|
|
3
|
+
|
|
4
|
+
uniform vec4 uInputSize;
|
|
5
|
+
uniform vec4 uOutputFrame;
|
|
6
|
+
uniform vec4 uOutputTexture;
|
|
7
|
+
|
|
8
|
+
vec4 filterVertexPosition( void )
|
|
9
|
+
{
|
|
10
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
11
|
+
|
|
12
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
13
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
14
|
+
|
|
15
|
+
return vec4(position, 0.0, 1.0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
vec2 filterTextureCoord( void )
|
|
19
|
+
{
|
|
20
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void main(void)
|
|
24
|
+
{
|
|
25
|
+
gl_Position = filterVertexPosition();
|
|
26
|
+
vTextureCoord = filterTextureCoord();
|
|
27
|
+
}
|
|
28
|
+
`;var VJ=`in vec2 vTextureCoord;
|
|
29
|
+
out vec4 finalColor;
|
|
30
|
+
uniform sampler2D uTexture;
|
|
31
|
+
void main() {
|
|
32
|
+
finalColor = texture(uTexture, vTextureCoord);
|
|
33
|
+
}
|
|
34
|
+
`;var s=`struct GlobalFilterUniforms {
|
|
35
|
+
uInputSize: vec4<f32>,
|
|
36
|
+
uInputPixel: vec4<f32>,
|
|
37
|
+
uInputClamp: vec4<f32>,
|
|
38
|
+
uOutputFrame: vec4<f32>,
|
|
39
|
+
uGlobalFrame: vec4<f32>,
|
|
40
|
+
uOutputTexture: vec4<f32>,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
|
|
44
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
45
|
+
@group(0) @binding(2) var uSampler: sampler;
|
|
46
|
+
|
|
47
|
+
struct VSOutput {
|
|
48
|
+
@builtin(position) position: vec4<f32>,
|
|
49
|
+
@location(0) uv: vec2<f32>
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
|
|
53
|
+
{
|
|
54
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
55
|
+
|
|
56
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
57
|
+
position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
58
|
+
|
|
59
|
+
return vec4(position, 0.0, 1.0);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
|
|
63
|
+
{
|
|
64
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@vertex
|
|
68
|
+
fn mainVertex(
|
|
69
|
+
@location(0) aPosition: vec2<f32>,
|
|
70
|
+
) -> VSOutput {
|
|
71
|
+
return VSOutput(
|
|
72
|
+
filterVertexPosition(aPosition),
|
|
73
|
+
filterTextureCoord(aPosition)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@fragment
|
|
78
|
+
fn mainFragment(
|
|
79
|
+
@location(0) uv: vec2<f32>,
|
|
80
|
+
) -> @location(0) vec4<f32> {
|
|
81
|
+
return textureSample(uTexture, uSampler, uv);
|
|
82
|
+
}
|
|
83
|
+
`;class r extends BJ{constructor(){let J=CJ.from({vertex:{source:s,entryPoint:"mainVertex"},fragment:{source:s,entryPoint:"mainFragment"},name:"passthrough-filter"}),Q=wJ.from({vertex:GJ,fragment:VJ,name:"passthrough-filter"});super({gpuProgram:J,glProgram:Q})}}var EJ=new c;function LJ(J,Q){Q.clear();let Z=Q.matrix;for(let $=0;$<J.length;$++){let H=J[$];if(H.globalDisplayStatus<7)continue;let W=H.renderGroup??H.parentRenderGroup;if(W?.isCachedAsTexture)Q.matrix=EJ.copyFrom(W.textureOffsetInverseTransform).append(H.worldTransform);else if(W?._parentCacheAsTextureRenderGroup)Q.matrix=EJ.copyFrom(W._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(H.groupTransform);else Q.matrix=H.worldTransform;Q.addBounds(H.bounds)}return Q.matrix=Z,Q}var gJ=new MJ({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});class IJ{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new P,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}}class RJ{constructor(J){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new FJ({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new UJ({}),this.renderer=J}get activeBackTexture(){return this._activeFilterData?.backTexture}push(J){let Q=this.renderer,Z=J.filterEffect.filters,$=this._pushFilterData();$.skip=!1,$.filters=Z,$.container=J.container,$.outputRenderSurface=Q.renderTarget.renderSurface;let H=Q.renderTarget.renderTarget.colorTexture.source,W=H.resolution,K=H.antialias;if(Z.every((X)=>!X.enabled)){$.skip=!0;return}let q=$.bounds;if(this._calculateFilterArea(J,q),this._calculateFilterBounds($,Q.renderTarget.rootViewPort,K,W,1),$.skip)return;let _=this._getPreviousFilterData(),Y=this._findFilterResolution(W),N=0,z=0;if(_)N=_.bounds.minX,z=_.bounds.minY;this._calculateGlobalFrame($,N,z,Y,H.width,H.height),this._setupFilterTextures($,q,Q,_)}generateFilteredTexture({texture:J,filters:Q}){let Z=this._pushFilterData();this._activeFilterData=Z,Z.skip=!1,Z.filters=Q;let $=J.source,H=$.resolution,W=$.antialias;if(Q.every((X)=>!X.enabled))return Z.skip=!0,J;let K=Z.bounds;if(K.addRect(J.frame),this._calculateFilterBounds(Z,K.rectangle,W,H,0),Z.skip)return J;let q=H,_=0,Y=0;this._calculateGlobalFrame(Z,_,Y,q,$.width,$.height),Z.outputRenderSurface=j.getOptimalTexture(K.width,K.height,Z.resolution,Z.antialias),Z.backTexture=B.EMPTY,Z.inputTexture=J,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(Z,!0);let z=Z.outputRenderSurface;return z.source.alphaMode="premultiplied-alpha",z}pop(){let J=this.renderer,Q=this._popFilterData();if(Q.skip)return;if(J.globalUniforms.pop(),J.renderTarget.finishRenderPass(),this._activeFilterData=Q,this._applyFiltersToTexture(Q,!1),Q.blendRequired)j.returnTexture(Q.backTexture);j.returnTexture(Q.inputTexture)}getBackTexture(J,Q,Z){let $=J.colorTexture.source._resolution,H=j.getOptimalTexture(Q.width,Q.height,$,!1),W=Q.minX,K=Q.minY;if(Z)W-=Z.minX,K-=Z.minY;W=Math.floor(W*$),K=Math.floor(K*$);let q=Math.ceil(Q.width*$),_=Math.ceil(Q.height*$);return this.renderer.renderTarget.copyToTexture(J,H,{x:W,y:K},{width:q,height:_},{x:0,y:0}),H}applyFilter(J,Q,Z,$){let H=this.renderer,W=this._activeFilterData,q=W.outputRenderSurface===Z,_=H.renderTarget.rootRenderTarget.colorTexture.source._resolution,Y=this._findFilterResolution(_),N=0,z=0;if(q){let V=this._findPreviousFilterOffset();N=V.x,z=V.y}this._updateFilterUniforms(Q,Z,W,N,z,Y,q,$);let X=J.enabled?J:this._getPassthroughFilter();this._setupBindGroupsAndRender(X,Q,H)}calculateSpriteMatrix(J,Q){let Z=this._activeFilterData,$=J.set(Z.inputTexture._source.width,0,0,Z.inputTexture._source.height,Z.bounds.minX,Z.bounds.minY),H=Q.worldTransform.copyTo(c.shared),W=Q.renderGroup||Q.parentRenderGroup;if(W&&W.cacheToLocalTransform)H.prepend(W.cacheToLocalTransform);return H.invert(),$.prepend(H),$.scale(1/Q.texture.orig.width,1/Q.texture.orig.height),$.translate(Q.anchor.x,Q.anchor.y),$}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new r),this._passthroughFilter}_setupBindGroupsAndRender(J,Q,Z){if(Z.renderPipes.uniformBatch){let $=Z.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource($,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);if(this._globalFilterBindGroup.setResource(Q.source,1),this._globalFilterBindGroup.setResource(Q.source.style,2),J.groups[0]=this._globalFilterBindGroup,Z.encoder.draw({geometry:gJ,shader:J,state:J._state,topology:"triangle-list"}),Z.type===jJ.WEBGL)Z.renderTarget.finishRenderPass()}_setupFilterTextures(J,Q,Z,$){if(J.backTexture=B.EMPTY,J.inputTexture=j.getOptimalTexture(Q.width,Q.height,J.resolution,J.antialias),J.blendRequired){Z.renderTarget.finishRenderPass();let H=Z.renderTarget.getRenderTarget(J.outputRenderSurface);J.backTexture=this.getBackTexture(H,Q,$?.bounds)}Z.renderTarget.bind(J.inputTexture,!0),Z.globalUniforms.push({offset:Q})}_calculateGlobalFrame(J,Q,Z,$,H,W){let K=J.globalFrame;K.x=Q*$,K.y=Z*$,K.width=H*$,K.height=W*$}_updateFilterUniforms(J,Q,Z,$,H,W,K,q){let _=this._filterGlobalUniforms.uniforms,Y=_.uOutputFrame,N=_.uInputSize,z=_.uInputPixel,X=_.uInputClamp,V=_.uGlobalFrame,O=_.uOutputTexture;if(K)Y[0]=Z.bounds.minX-$,Y[1]=Z.bounds.minY-H;else Y[0]=0,Y[1]=0;Y[2]=J.frame.width,Y[3]=J.frame.height,N[0]=J.source.width,N[1]=J.source.height,N[2]=1/N[0],N[3]=1/N[1],z[0]=J.source.pixelWidth,z[1]=J.source.pixelHeight,z[2]=1/z[0],z[3]=1/z[1],X[0]=0.5*z[2],X[1]=0.5*z[3],X[2]=J.frame.width*N[2]-0.5*z[2],X[3]=J.frame.height*N[3]-0.5*z[3];let w=this.renderer.renderTarget.rootRenderTarget.colorTexture;if(V[0]=$*W,V[1]=H*W,V[2]=w.source.width*W,V[3]=w.source.height*W,Q instanceof B)Q.source.resource=null;let C=this.renderer.renderTarget.getRenderTarget(Q);if(this.renderer.renderTarget.bind(Q,!!q),Q instanceof B)O[0]=Q.frame.width,O[1]=Q.frame.height;else O[0]=C.width,O[1]=C.height;O[2]=C.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(J){let Q=this._filterStackIndex-1;while(Q>0&&this._filterStack[Q].skip)--Q;return Q>0&&this._filterStack[Q].inputTexture?this._filterStack[Q].inputTexture.source._resolution:J}_findPreviousFilterOffset(){let J=0,Q=0,Z=this._filterStackIndex;while(Z>0){Z--;let $=this._filterStack[Z];if(!$.skip){J=$.bounds.minX,Q=$.bounds.minY;break}}return{x:J,y:Q}}_calculateFilterArea(J,Q){if(J.renderables)LJ(J.renderables,Q);else if(J.filterEffect.filterArea)Q.clear(),Q.addRect(J.filterEffect.filterArea),Q.applyMatrix(J.container.worldTransform);else J.container.getFastGlobalBounds(!0,Q);if(J.container){let $=(J.container.renderGroup||J.container.parentRenderGroup).cacheToLocalTransform;if($)Q.applyMatrix($)}}_applyFiltersToTexture(J,Q){let{inputTexture:Z,bounds:$,filters:H,firstEnabledIndex:W,lastEnabledIndex:K}=J;if(this._globalFilterBindGroup.setResource(Z.source.style,2),this._globalFilterBindGroup.setResource(J.backTexture.source,3),W===K)H[W].apply(this,Z,J.outputRenderSurface,Q);else{let q=J.inputTexture,_=j.getOptimalTexture($.width,$.height,q.source._resolution,!1),Y=_;for(let N=W;N<K;N++){let z=H[N];if(!z.enabled)continue;z.apply(this,q,Y,!0);let X=q;q=Y,Y=X}H[K].apply(this,q,J.outputRenderSurface,Q),j.returnTexture(_)}}_calculateFilterBounds(J,Q,Z,$,H){let W=this.renderer,K=J.bounds,q=J.filters,_=1/0,Y=0,N=!0,z=!1,X=!1,V=!0,O=-1,w=-1;for(let C=0;C<q.length;C++){let L=q[C];if(!L.enabled)continue;if(O===-1)O=C;if(w=C,_=Math.min(_,L.resolution==="inherit"?$:L.resolution),Y+=L.padding,L.antialias==="off")N=!1;else if(L.antialias==="inherit")N&&(N=Z);if(!L.clipToViewport)V=!1;if(!(L.compatibleRenderers&W.type)){X=!1;break}if(L.blendRequired&&!(W.backBuffer?.useBackBuffer??!0)){M("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),X=!1;break}X=!0,z||(z=L.blendRequired)}if(!X){J.skip=!0;return}if(V)K.fitBounds(0,Q.width/$,0,Q.height/$);if(K.scale(_).ceil().scale(1/_).pad((Y|0)*H),!K.isPositive){J.skip=!0;return}J.antialias=N,J.resolution=_,J.blendRequired=z,J.firstEnabledIndex=O,J.lastEnabledIndex=w}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let J,Q=this._filterStackIndex-1;while(Q>0)if(Q--,J=this._filterStack[Q],!J.skip)break;return J}_pushFilterData(){let J=this._filterStack[this._filterStackIndex];if(!J)J=this._filterStack[this._filterStackIndex]=new IJ;return this._filterStackIndex++,J}}RJ.extension={type:[G.WebGLSystem,G.WebGPUSystem],name:"filter"};
|
|
84
|
+
export{XJ as e,RJ as f};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{L as r,Z as w,_ as D}from"./chunk-kt3t4zv0.js";import{Ja as O,La as t,Pa as W,Va as U}from"./chunk-1sw3e1ar.js";class F{constructor(Q){if(this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;let q=this._canvas.getBoundingClientRect(),$=this._canvas.width,J=this._canvas.height,G=q.width/$*this._renderer.resolution,X=q.height/J*this._renderer.resolution,Y=q.left,N=q.top,Z=`translate(${Y}px, ${N}px) scale(${G}, ${X})`;if(Z!==this._lastTransform)this._domElement.style.transform=Z,this._lastTransform=Z},this._domElement=Q.domElement,this._renderer=Q.renderer,globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)return;this._canvas=this._renderer.canvas,this._attachObserver()}get canvas(){return this._canvas}ensureAttached(){if(!this._domElement.parentNode&&this._canvas.parentNode)this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation()}_attachObserver(){if("ResizeObserver"in globalThis){if(this._observer)this._observer.disconnect(),this._observer=null;this._observer=new ResizeObserver((Q)=>{for(let q of Q){if(q.target!==this._canvas)continue;let $=this.canvas.width,J=this.canvas.height,G=q.contentRect.width/$*this._renderer.resolution,X=q.contentRect.height/J*this._renderer.resolution;if(this._lastScaleX!==G||this._lastScaleY!==X)this.updateTranslation(),this._lastScaleX=G,this._lastScaleY=X}}),this._observer.observe(this._canvas)}else if(!this._tickerAttached)D.shared.add(this.updateTranslation,this,w.HIGH)}destroy(){if(this._observer)this._observer.disconnect(),this._observer=null;else if(this._tickerAttached)D.shared.remove(this.updateTranslation);this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class S{constructor(Q){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=S.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new W,this.page=new W,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=Q}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(){if(this.manager&&(!this.path||this.path[this.path.length-1]!==this.target))this.path=this.target?this.manager.propagationPath(this.target):[];return this.path}initEvent(Q,q,$){throw Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(Q,q,$,J,G){throw Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){if(this.nativeEvent instanceof Event&&this.nativeEvent.cancelable)this.nativeEvent.preventDefault();this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var M=/iPhone/i,f=/iPod/i,g=/iPad/i,u=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,h=/Android/i,j=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,b=/Silk/i,L=/Windows Phone/i,E=/\bWindows(?:.+)ARM\b/i,p=/BlackBerry/i,d=/BB10/i,l=/Opera Mini/i,m=/\b(CriOS|Chrome)(?:.+)Mobile/i,s=/Mobile(?:.+)Firefox\b/i,c=function(Q){return typeof Q<"u"&&Q.platform==="MacIntel"&&typeof Q.maxTouchPoints==="number"&&Q.maxTouchPoints>1&&typeof MSStream>"u"};function qq(Q){return function(q){return q.test(Q)}}function _(Q){var q={userAgent:"",platform:"",maxTouchPoints:0};if(!Q&&typeof navigator<"u")q={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};else if(typeof Q==="string")q.userAgent=Q;else if(Q&&Q.userAgent)q={userAgent:Q.userAgent,platform:Q.platform,maxTouchPoints:Q.maxTouchPoints||0};var $=q.userAgent,J=$.split("[FBAN");if(typeof J[1]<"u")$=J[0];if(J=$.split("Twitter"),typeof J[1]<"u")$=J[0];var G=qq($),X={apple:{phone:G(M)&&!G(L),ipod:G(f),tablet:!G(M)&&(G(g)||c(q))&&!G(L),universal:G(u),device:(G(M)||G(f)||G(g)||G(u)||c(q))&&!G(L)},amazon:{phone:G(j),tablet:!G(j)&&G(b),device:G(j)||G(b)},android:{phone:!G(L)&&G(j)||!G(L)&&G(k),tablet:!G(L)&&!G(j)&&!G(k)&&(G(b)||G(h)),device:!G(L)&&(G(j)||G(b)||G(k)||G(h))||G(/\bokhttp\b/i)},windows:{phone:G(L),tablet:G(E),device:G(L)||G(E)},other:{blackberry:G(p),blackberry10:G(d),opera:G(l),firefox:G(s),chrome:G(m),device:G(p)||G(d)||G(l)||G(s)||G(m)},any:!1,phone:!1,tablet:!1};return X.any=X.apple.device||X.android.device||X.windows.device||X.other.device,X.phone=X.apple.phone||X.android.phone||X.windows.phone,X.tablet=X.apple.tablet||X.android.tablet||X.windows.tablet,X}var Qq=_.default??_,v=Qq(globalThis.navigator);var $q=9,i=100,Jq=0,Gq=0,a=2,o=1,Xq=-1000,Yq=-1000,Nq=2,P=class Q{constructor(q,$=v){if(this._mobileInfo=$,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,$.tablet||$.phone)this._createTouchHook();this._renderer=q}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){let q=document.createElement("button");q.style.width=`${o}px`,q.style.height=`${o}px`,q.style.position="absolute",q.style.top=`${Xq}px`,q.style.left=`${Yq}px`,q.style.zIndex=Nq.toString(),q.style.backgroundColor="#FF0000",q.title="select to enable accessibility for this content",q.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(q),this._hookDiv=q}_destroyTouchHook(){if(!this._hookDiv)return;document.body.removeChild(this._hookDiv),this._hookDiv=null}_activate(){if(this._isActive)return;if(this._isActive=!0,!this._div)this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${Jq}px`,this._div.style.left=`${Gq}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=a.toString(),this._canvasObserver=new F({domElement:this._div,renderer:this._renderer});if(this._activateOnTab)globalThis.addEventListener("keydown",this._boundOnKeyDown,!1);if(this._deactivateOnMouseMove)globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);let q=this._renderer.view.canvas;if(!q.parentNode){let $=new MutationObserver(()=>{if(q.parentNode)$.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup()});$.observe(document.body,{childList:!0,subtree:!0})}else this._canvasObserver.ensureAttached(),this._initAccessibilitySetup()}_initAccessibilitySetup(){if(this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered)this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!this._isActive||this._isMobileAccessibility)return;if(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab)globalThis.addEventListener("keydown",this._boundOnKeyDown,!1);this._renderer.runners.postrender.remove(this);for(let q of this._children){if(q._accessibleDiv?.parentNode)q._accessibleDiv.parentNode.removeChild(q._accessibleDiv),q._accessibleDiv=null;q._accessibleActive=!1}for(let q in this._pools)this._pools[q].forEach((J)=>{if(J.parentNode)J.parentNode.removeChild(J)}),delete this._pools[q];if(this._div?.parentNode)this._div.parentNode.removeChild(this._div);this._pools={},this._children=[]}_updateAccessibleObjects(q){if(!q.visible||!q.accessibleChildren)return;if(q.accessible){if(!q._accessibleActive)this._addChild(q);q._renderId=this._renderId}let $=q.children;if($)for(let J=0;J<$.length;J++)this._updateAccessibleObjects($[J])}init(q){let J={accessibilityOptions:{...Q.defaultOptions,...q?.accessibilityOptions||{}}};if(this.debug=J.accessibilityOptions.debug,this._activateOnTab=J.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=J.accessibilityOptions.deactivateOnMouseMove,J.accessibilityOptions.enabledByDefault)this._activate();this._renderer.runners.postrender.remove(this)}postrender(){let q=performance.now();if(this._mobileInfo.android.device&&q<this._androidUpdateCount)return;if(this._androidUpdateCount=q+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests)return;let $=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let J of this._children)if(J._renderId===this._renderId)$.add(this._children.indexOf(J))}for(let J=this._children.length-1;J>=0;J--){let G=this._children[J];if(!$.has(J)){if(G._accessibleDiv&&G._accessibleDiv.parentNode)G._accessibleDiv.parentNode.removeChild(G._accessibleDiv),this._getPool(G.accessibleType).push(G._accessibleDiv),G._accessibleDiv=null;G._accessibleActive=!1,r(this._children,J,1)}}if(this._renderer.renderingToScreen)this._canvasObserver.ensureAttached();for(let J=0;J<this._children.length;J++){let G=this._children[J];if(!G._accessibleActive||!G._accessibleDiv)continue;let X=G._accessibleDiv,Y=G.hitArea||G.getBounds().rectangle;if(G.hitArea){let N=G.worldTransform;X.style.left=`${N.tx+Y.x*N.a}px`,X.style.top=`${N.ty+Y.y*N.d}px`,X.style.width=`${Y.width*N.a}px`,X.style.height=`${Y.height*N.d}px`}else this._capHitArea(Y),X.style.left=`${Y.x}px`,X.style.top=`${Y.y}px`,X.style.width=`${Y.width}px`,X.style.height=`${Y.height}px`}this._renderId++}_updateDebugHTML(q){q.innerHTML=`type: ${q.type}</br> title : ${q.title}</br> tabIndex: ${q.tabIndex}`}_capHitArea(q){if(q.x<0)q.width+=q.x,q.x=0;if(q.y<0)q.height+=q.y,q.y=0;let{width:$,height:J}=this._renderer;if(q.x+q.width>$)q.width=$-q.x;if(q.y+q.height>J)q.height=J-q.y}_addChild(q){let J=this._getPool(q.accessibleType).pop();if(J)J.innerHTML="",J.removeAttribute("title"),J.removeAttribute("aria-label"),J.tabIndex=0;else{if(q.accessibleType==="button")J=document.createElement("button");else if(J=document.createElement(q.accessibleType),J.style.cssText=`
|
|
2
|
+
color: transparent;
|
|
3
|
+
pointer-events: none;
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
border: 0;
|
|
7
|
+
outline: 0;
|
|
8
|
+
background: transparent;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
user-select: none;
|
|
11
|
+
-webkit-user-select: none;
|
|
12
|
+
-moz-user-select: none;
|
|
13
|
+
-ms-user-select: none;
|
|
14
|
+
`,q.accessibleText)J.innerText=q.accessibleText;if(J.style.width=`${i}px`,J.style.height=`${i}px`,J.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",J.style.position="absolute",J.style.zIndex=a.toString(),J.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome"))J.setAttribute("aria-live","off");else J.setAttribute("aria-live","polite");if(navigator.userAgent.match(/rv:.*Gecko\//))J.setAttribute("aria-relevant","additions");else J.setAttribute("aria-relevant","text");J.addEventListener("click",this._onClick.bind(this)),J.addEventListener("focus",this._onFocus.bind(this)),J.addEventListener("focusout",this._onFocusOut.bind(this))}if(J.style.pointerEvents=q.accessiblePointerEvents,J.type=q.accessibleType,q.accessibleTitle&&q.accessibleTitle!==null)J.title=q.accessibleTitle;else if(!q.accessibleHint||q.accessibleHint===null)J.title=`container ${q.tabIndex}`;if(q.accessibleHint&&q.accessibleHint!==null)J.setAttribute("aria-label",q.accessibleHint);if(q.interactive)J.tabIndex=q.tabIndex;else J.tabIndex=0;if(this.debug)this._updateDebugHTML(J);q._accessibleActive=!0,q._accessibleDiv=J,J.container=q,this._children.push(q),this._div.appendChild(q._accessibleDiv)}_dispatchEvent(q,$){let{container:J}=q.target,G=this._renderer.events.rootBoundary,X=Object.assign(new S(G),{target:J});G.rootTarget=this._renderer.lastObjectRendered,$.forEach((Y)=>G.dispatchEvent(X,Y))}_onClick(q){this._dispatchEvent(q,["click","pointertap","tap"])}_onFocus(q){if(!q.target.getAttribute("aria-live"))q.target.setAttribute("aria-live","assertive");this._dispatchEvent(q,["mouseover"])}_onFocusOut(q){if(!q.target.getAttribute("aria-live"))q.target.setAttribute("aria-live","polite");this._dispatchEvent(q,["mouseout"])}_onKeyDown(q){if(q.keyCode!==$q||!this._activateOnTab)return;this._activate()}_onMouseMove(q){if(q.movementX===0&&q.movementY===0)return;this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(q){if(q)this._activate();else this._deactivate()}_getPool(q){if(!this._pools[q])this._pools[q]=[];return this._pools[q]}};P.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"accessibility"};P.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};var Fq=P;var kq={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1};class n{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(Q){this.removeTickerListener(),this.events=Q,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(Q){this._pauseUpdate=Q}addTickerListener(){if(this._tickerAdded||!this.domElement)return;D.system.add(this._tickerUpdate,this,w.INTERACTION),this._tickerAdded=!0}removeTickerListener(){if(!this._tickerAdded)return;D.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 Q=this.events._rootPointerEvent;if(this.events.supportsTouchEvents&&Q.pointerType==="touch")return;globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:Q.clientX,clientY:Q.clientY,pointerType:Q.pointerType,pointerId:Q.pointerId}):new MouseEvent("mousemove",{clientX:Q.clientX,clientY:Q.clientY}))}_tickerUpdate(Q){if(this._deltaTime+=Q.deltaTime,this._deltaTime<this.interactionFrequency)return;this._deltaTime=0,this._update()}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}}var C=new n;class H extends S{constructor(){super(...arguments);this.client=new W,this.movement=new W,this.offset=new W,this.global=new W,this.screen=new W}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(Q,q,$){return Q.worldTransform.applyInverse($||this.global,q)}getModifierState(Q){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(Q)}initMouseEvent(Q,q,$,J,G,X,Y,N,Z,K,R,V,z,A,Wq){throw Error("Method not implemented.")}}class B extends H{constructor(){super(...arguments);this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){if(this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove")return[this];return[]}getPredictedEvents(){throw Error("getPredictedEvents is not supported!")}}class x extends H{constructor(){super(...arguments);this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}x.DOM_DELTA_PIXEL=0;x.DOM_DELTA_LINE=1;x.DOM_DELTA_PAGE=2;var Kq=2048,Zq=new W,I=new W;class T{constructor(Q){this.dispatch=new t,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=Q,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(Q,q){if(!this.mappingTable[Q])this.mappingTable[Q]=[];this.mappingTable[Q].push({fn:q,priority:0}),this.mappingTable[Q].sort(($,J)=>$.priority-J.priority)}dispatchEvent(Q,q){Q.propagationStopped=!1,Q.propagationImmediatelyStopped=!1,this.propagate(Q,q),this.dispatch.emit(q||Q.type,Q)}mapEvent(Q){if(!this.rootTarget)return;let q=this.mappingTable[Q.type];if(q)for(let $=0,J=q.length;$<J;$++)q[$].fn(Q);else U(`[EventBoundary]: Event mapping not defined for ${Q.type}`)}hitTest(Q,q){C.pauseUpdate=!0;let J=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",G=this[J](this.rootTarget,this.rootTarget.eventMode,Zq.set(Q,q),this.hitTestFn,this.hitPruneFn);return G&&G[0]}propagate(Q,q){if(!Q.target)return;let $=Q.composedPath();Q.eventPhase=Q.CAPTURING_PHASE;for(let J=0,G=$.length-1;J<G;J++)if(Q.currentTarget=$[J],this.notifyTarget(Q,q),Q.propagationStopped||Q.propagationImmediatelyStopped)return;if(Q.eventPhase=Q.AT_TARGET,Q.currentTarget=Q.target,this.notifyTarget(Q,q),Q.propagationStopped||Q.propagationImmediatelyStopped)return;Q.eventPhase=Q.BUBBLING_PHASE;for(let J=$.length-2;J>=0;J--)if(Q.currentTarget=$[J],this.notifyTarget(Q,q),Q.propagationStopped||Q.propagationImmediatelyStopped)return}all(Q,q,$=this._allInteractiveElements){if($.length===0)return;Q.eventPhase=Q.BUBBLING_PHASE;let J=Array.isArray(q)?q:[q];for(let G=$.length-1;G>=0;G--)J.forEach((X)=>{Q.currentTarget=$[G],this.notifyTarget(Q,X)})}propagationPath(Q){let q=[Q];for(let $=0;$<Kq&&(Q!==this.rootTarget&&Q.parent);$++){if(!Q.parent)throw Error("Cannot find propagation path to disconnected target");q.push(Q.parent),Q=Q.parent}return q.reverse(),q}hitTestMoveRecursive(Q,q,$,J,G,X=!1){let Y=!1;if(this._interactivePrune(Q))return null;if(Q.eventMode==="dynamic"||q==="dynamic")C.pauseUpdate=!1;if(Q.interactiveChildren&&Q.children){let K=Q.children;for(let R=K.length-1;R>=0;R--){let V=K[R],z=this.hitTestMoveRecursive(V,this._isInteractive(q)?q:V.eventMode,$,J,G,X||G(Q,$));if(z){if(z.length>0&&!z[z.length-1].parent)continue;let A=Q.isInteractive();if(z.length>0||A){if(A)this._allInteractiveElements.push(Q);z.push(Q)}if(this._hitElements.length===0)this._hitElements=z;Y=!0}}}let N=this._isInteractive(q),Z=Q.isInteractive();if(Z&&Z)this._allInteractiveElements.push(Q);if(X||this._hitElements.length>0)return null;if(Y)return this._hitElements;if(N&&(!G(Q,$)&&J(Q,$)))return Z?[Q]:[];return null}hitTestRecursive(Q,q,$,J,G){if(this._interactivePrune(Q)||G(Q,$))return null;if(Q.eventMode==="dynamic"||q==="dynamic")C.pauseUpdate=!1;if(Q.interactiveChildren&&Q.children){let N=Q.children,Z=$;for(let K=N.length-1;K>=0;K--){let R=N[K],V=this.hitTestRecursive(R,this._isInteractive(q)?q:R.eventMode,Z,J,G);if(V){if(V.length>0&&!V[V.length-1].parent)continue;let z=Q.isInteractive();if(V.length>0||z)V.push(Q);return V}}}let X=this._isInteractive(q),Y=Q.isInteractive();if(X&&J(Q,$))return Y?[Q]:[];return null}_isInteractive(Q){return Q==="static"||Q==="dynamic"}_interactivePrune(Q){if(!Q||!Q.visible||!Q.renderable||!Q.measurable)return!0;if(Q.eventMode==="none")return!0;if(Q.eventMode==="passive"&&!Q.interactiveChildren)return!0;return!1}hitPruneFn(Q,q){if(Q.hitArea){if(Q.worldTransform.applyInverse(q,I),!Q.hitArea.contains(I.x,I.y))return!0}if(Q.effects&&Q.effects.length)for(let $=0;$<Q.effects.length;$++){let J=Q.effects[$];if(J.containsPoint){if(!J.containsPoint(q,this.hitTestFn))return!0}}return!1}hitTestFn(Q,q){if(Q.hitArea)return!0;if(Q?.containsPoint)return Q.worldTransform.applyInverse(q,I),Q.containsPoint(I);return!1}notifyTarget(Q,q){if(!Q.currentTarget.isInteractive())return;q??(q=Q.type);let $=`on${q}`;Q.currentTarget[$]?.(Q);let J=Q.eventPhase===Q.CAPTURING_PHASE||Q.eventPhase===Q.AT_TARGET?`${q}capture`:q;if(this._notifyListeners(Q,J),Q.eventPhase===Q.AT_TARGET)this._notifyListeners(Q,q)}mapPointerDown(Q){if(!(Q instanceof B)){U("EventBoundary cannot map a non-pointer event as a pointer event");return}let q=this.createPointerEvent(Q);if(this.dispatchEvent(q,"pointerdown"),q.pointerType==="touch")this.dispatchEvent(q,"touchstart");else if(q.pointerType==="mouse"||q.pointerType==="pen"){let J=q.button===2;this.dispatchEvent(q,J?"rightdown":"mousedown")}let $=this.trackingData(Q.pointerId);$.pressTargetsByButton[Q.button]=q.composedPath(),this.freeEvent(q)}mapPointerMove(Q){if(!(Q instanceof B)){U("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let q=this.createPointerEvent(Q);this._isPointerMoveEvent=!1;let $=q.pointerType==="mouse"||q.pointerType==="pen",J=this.trackingData(Q.pointerId),G=this.findMountedTarget(J.overTargets);if(J.overTargets?.length>0&&G!==q.target){let N=Q.type==="mousemove"?"mouseout":"pointerout",Z=this.createPointerEvent(Q,N,G);if(this.dispatchEvent(Z,"pointerout"),$)this.dispatchEvent(Z,"mouseout");if(!q.composedPath().includes(G)){let K=this.createPointerEvent(Q,"pointerleave",G);K.eventPhase=K.AT_TARGET;while(K.target&&!q.composedPath().includes(K.target)){if(K.currentTarget=K.target,this.notifyTarget(K),$)this.notifyTarget(K,"mouseleave");K.target=K.target.parent}this.freeEvent(K)}this.freeEvent(Z)}if(G!==q.target){let N=Q.type==="mousemove"?"mouseover":"pointerover",Z=this.clonePointerEvent(q,N);if(this.dispatchEvent(Z,"pointerover"),$)this.dispatchEvent(Z,"mouseover");let K=G?.parent;while(K&&K!==this.rootTarget.parent){if(K===q.target)break;K=K.parent}if(!K||K===this.rootTarget.parent){let V=this.clonePointerEvent(q,"pointerenter");V.eventPhase=V.AT_TARGET;while(V.target&&V.target!==G&&V.target!==this.rootTarget.parent){if(V.currentTarget=V.target,this.notifyTarget(V),$)this.notifyTarget(V,"mouseenter");V.target=V.target.parent}this.freeEvent(V)}this.freeEvent(Z)}let X=[],Y=this.enableGlobalMoveEvents??!0;if(this.moveOnAll?X.push("pointermove"):this.dispatchEvent(q,"pointermove"),Y&&X.push("globalpointermove"),q.pointerType==="touch")this.moveOnAll?X.splice(1,0,"touchmove"):this.dispatchEvent(q,"touchmove"),Y&&X.push("globaltouchmove");if($)this.moveOnAll?X.splice(1,0,"mousemove"):this.dispatchEvent(q,"mousemove"),Y&&X.push("globalmousemove"),this.cursor=q.target?.cursor;if(X.length>0)this.all(q,X);this._allInteractiveElements.length=0,this._hitElements.length=0,J.overTargets=q.composedPath(),this.freeEvent(q)}mapPointerOver(Q){if(!(Q instanceof B)){U("EventBoundary cannot map a non-pointer event as a pointer event");return}let q=this.trackingData(Q.pointerId),$=this.createPointerEvent(Q),J=$.pointerType==="mouse"||$.pointerType==="pen";if(this.dispatchEvent($,"pointerover"),J)this.dispatchEvent($,"mouseover");if($.pointerType==="mouse")this.cursor=$.target?.cursor;let G=this.clonePointerEvent($,"pointerenter");G.eventPhase=G.AT_TARGET;while(G.target&&G.target!==this.rootTarget.parent){if(G.currentTarget=G.target,this.notifyTarget(G),J)this.notifyTarget(G,"mouseenter");G.target=G.target.parent}q.overTargets=$.composedPath(),this.freeEvent($),this.freeEvent(G)}mapPointerOut(Q){if(!(Q instanceof B)){U("EventBoundary cannot map a non-pointer event as a pointer event");return}let q=this.trackingData(Q.pointerId);if(q.overTargets){let $=Q.pointerType==="mouse"||Q.pointerType==="pen",J=this.findMountedTarget(q.overTargets),G=this.createPointerEvent(Q,"pointerout",J);if(this.dispatchEvent(G),$)this.dispatchEvent(G,"mouseout");let X=this.createPointerEvent(Q,"pointerleave",J);X.eventPhase=X.AT_TARGET;while(X.target&&X.target!==this.rootTarget.parent){if(X.currentTarget=X.target,this.notifyTarget(X),$)this.notifyTarget(X,"mouseleave");X.target=X.target.parent}q.overTargets=null,this.freeEvent(G),this.freeEvent(X)}this.cursor=null}mapPointerUp(Q){if(!(Q instanceof B)){U("EventBoundary cannot map a non-pointer event as a pointer event");return}let q=performance.now(),$=this.createPointerEvent(Q);if(this.dispatchEvent($,"pointerup"),$.pointerType==="touch")this.dispatchEvent($,"touchend");else if($.pointerType==="mouse"||$.pointerType==="pen"){let Y=$.button===2;this.dispatchEvent($,Y?"rightup":"mouseup")}let J=this.trackingData(Q.pointerId),G=this.findMountedTarget(J.pressTargetsByButton[Q.button]),X=G;if(G&&!$.composedPath().includes(G)){let Y=G;while(Y&&!$.composedPath().includes(Y)){if($.currentTarget=Y,this.notifyTarget($,"pointerupoutside"),$.pointerType==="touch")this.notifyTarget($,"touchendoutside");else if($.pointerType==="mouse"||$.pointerType==="pen"){let N=$.button===2;this.notifyTarget($,N?"rightupoutside":"mouseupoutside")}Y=Y.parent}delete J.pressTargetsByButton[Q.button],X=Y}if(X){let Y=this.clonePointerEvent($,"click");if(Y.target=X,Y.path=null,!J.clicksByButton[Q.button])J.clicksByButton[Q.button]={clickCount:0,target:Y.target,timeStamp:q};let N=J.clicksByButton[Q.button];if(N.target===Y.target&&q-N.timeStamp<200)++N.clickCount;else N.clickCount=1;if(N.target=Y.target,N.timeStamp=q,Y.detail=N.clickCount,Y.pointerType==="mouse"){let Z=Y.button===2;this.dispatchEvent(Y,Z?"rightclick":"click")}else if(Y.pointerType==="touch")this.dispatchEvent(Y,"tap");this.dispatchEvent(Y,"pointertap"),this.freeEvent(Y)}this.freeEvent($)}mapPointerUpOutside(Q){if(!(Q instanceof B)){U("EventBoundary cannot map a non-pointer event as a pointer event");return}let q=this.trackingData(Q.pointerId),$=this.findMountedTarget(q.pressTargetsByButton[Q.button]),J=this.createPointerEvent(Q);if($){let G=$;while(G){if(J.currentTarget=G,this.notifyTarget(J,"pointerupoutside"),J.pointerType==="touch")this.notifyTarget(J,"touchendoutside");else if(J.pointerType==="mouse"||J.pointerType==="pen")this.notifyTarget(J,J.button===2?"rightupoutside":"mouseupoutside");G=G.parent}delete q.pressTargetsByButton[Q.button]}this.freeEvent(J)}mapWheel(Q){if(!(Q instanceof x)){U("EventBoundary cannot map a non-wheel event as a wheel event");return}let q=this.createWheelEvent(Q);this.dispatchEvent(q),this.freeEvent(q)}findMountedTarget(Q){if(!Q)return null;let q=Q[0];for(let $=1;$<Q.length;$++)if(Q[$].parent===q)q=Q[$];else break;return q}createPointerEvent(Q,q,$){let J=this.allocateEvent(B);if(this.copyPointerData(Q,J),this.copyMouseData(Q,J),this.copyData(Q,J),J.nativeEvent=Q.nativeEvent,J.originalEvent=Q,J.target=$??this.hitTest(J.global.x,J.global.y)??this._hitElements[0],typeof q==="string")J.type=q;return J}createWheelEvent(Q){let q=this.allocateEvent(x);return this.copyWheelData(Q,q),this.copyMouseData(Q,q),this.copyData(Q,q),q.nativeEvent=Q.nativeEvent,q.originalEvent=Q,q.target=this.hitTest(q.global.x,q.global.y),q}clonePointerEvent(Q,q){let $=this.allocateEvent(B);return $.nativeEvent=Q.nativeEvent,$.originalEvent=Q.originalEvent,this.copyPointerData(Q,$),this.copyMouseData(Q,$),this.copyData(Q,$),$.target=Q.target,$.path=Q.composedPath().slice(),$.type=q??$.type,$}copyWheelData(Q,q){q.deltaMode=Q.deltaMode,q.deltaX=Q.deltaX,q.deltaY=Q.deltaY,q.deltaZ=Q.deltaZ}copyPointerData(Q,q){if(!(Q instanceof B&&q instanceof B))return;q.pointerId=Q.pointerId,q.width=Q.width,q.height=Q.height,q.isPrimary=Q.isPrimary,q.pointerType=Q.pointerType,q.pressure=Q.pressure,q.tangentialPressure=Q.tangentialPressure,q.tiltX=Q.tiltX,q.tiltY=Q.tiltY,q.twist=Q.twist}copyMouseData(Q,q){if(!(Q instanceof H&&q instanceof H))return;q.altKey=Q.altKey,q.button=Q.button,q.buttons=Q.buttons,q.client.copyFrom(Q.client),q.ctrlKey=Q.ctrlKey,q.metaKey=Q.metaKey,q.movement.copyFrom(Q.movement),q.screen.copyFrom(Q.screen),q.shiftKey=Q.shiftKey,q.global.copyFrom(Q.global)}copyData(Q,q){q.isTrusted=Q.isTrusted,q.srcElement=Q.srcElement,q.timeStamp=performance.now(),q.type=Q.type,q.detail=Q.detail,q.view=Q.view,q.which=Q.which,q.layer.copyFrom(Q.layer),q.page.copyFrom(Q.page)}trackingData(Q){if(!this.mappingState.trackingData[Q])this.mappingState.trackingData[Q]={pressTargetsByButton:{},clicksByButton:{},overTarget:null};return this.mappingState.trackingData[Q]}allocateEvent(Q){if(!this.eventPool.has(Q))this.eventPool.set(Q,[]);let q=this.eventPool.get(Q).pop()||new Q(this);return q.eventPhase=q.NONE,q.currentTarget=null,q.defaultPrevented=!1,q.path=null,q.target=null,q}freeEvent(Q){if(Q.manager!==this)throw Error("It is illegal to free an event not managed by this EventBoundary!");let q=Q.constructor;if(!this.eventPool.has(q))this.eventPool.set(q,[]);this.eventPool.get(q).push(Q)}_notifyListeners(Q,q){let $=Q.currentTarget._events[q];if(!$)return;if("fn"in $){if($.once)Q.currentTarget.removeListener(q,$.fn,void 0,!0);$.fn.call($.context,Q)}else for(let J=0,G=$.length;J<G&&!Q.propagationImmediatelyStopped;J++){if($[J].once)Q.currentTarget.removeListener(q,$[J].fn,void 0,!0);$[J].fn.call($[J].context,Q)}}}var Vq=1,Bq={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},y=class Q{constructor(q){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=q,this.rootBoundary=new T(null),C.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new B(null),this._rootWheelEvent=new x(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Q.defaultEventFeatures},{set:($,J,G)=>{if(J==="globalMove")this.rootBoundary.enableGlobalMoveEvents=G;return $[J]=G,!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(q){let{canvas:$,resolution:J}=this.renderer;this.setTargetElement($),this.resolution=J,Q._defaultEventMode=q.eventMode??"passive",Object.assign(this.features,q.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(q){this.resolution=q}destroy(){C.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(q){q||(q="default");let $=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas)$=!1;if(this._currentCursor===q)return;this._currentCursor=q;let J=this.cursorStyles[q];if(J)switch(typeof J){case"string":if($)this.domElement.style.cursor=J;break;case"function":J(q);break;case"object":if($)Object.assign(this.domElement.style,J);break}else if($&&typeof q==="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,q))this.domElement.style.cursor=q}get pointer(){return this._rootPointerEvent}_onPointerDown(q){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let $=this._normalizeToPointerData(q);if(this.autoPreventDefault&&$[0].isNormalized){if(q.cancelable||!("cancelable"in q))q.preventDefault()}for(let J=0,G=$.length;J<G;J++){let X=$[J],Y=this._bootstrapEvent(this._rootPointerEvent,X);this.rootBoundary.mapEvent(Y)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(q){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,C.pointerMoved();let $=this._normalizeToPointerData(q);for(let J=0,G=$.length;J<G;J++){let X=this._bootstrapEvent(this._rootPointerEvent,$[J]);this.rootBoundary.mapEvent(X)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(q){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let $=q.target;if(q.composedPath&&q.composedPath().length>0)$=q.composedPath()[0];let J=$!==this.domElement?"outside":"",G=this._normalizeToPointerData(q);for(let X=0,Y=G.length;X<Y;X++){let N=this._bootstrapEvent(this._rootPointerEvent,G[X]);N.type+=J,this.rootBoundary.mapEvent(N)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(q){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let $=this._normalizeToPointerData(q);for(let J=0,G=$.length;J<G;J++){let X=this._bootstrapEvent(this._rootPointerEvent,$[J]);this.rootBoundary.mapEvent(X)}this.setCursor(this.rootBoundary.cursor)}onWheel(q){if(!this.features.wheel)return;let $=this.normalizeWheelEvent(q);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent($)}setTargetElement(q){this._removeEvents(),this.domElement=q,C.domElement=q,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;C.addTickerListener();let q=this.domElement.style;if(q){if(globalThis.navigator.msPointerEnabled)q.msContentZooming="none",q.msTouchAction="none";else if(this.supportsPointerEvents)q.touchAction="none"}if(this.supportsPointerEvents)globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0);else if(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents)this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0);this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;C.removeTickerListener();let q=this.domElement.style;if(q){if(globalThis.navigator.msPointerEnabled)q.msContentZooming="",q.msTouchAction="";else if(this.supportsPointerEvents)q.touchAction=""}if(this.supportsPointerEvents)globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0);else if(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents)this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0);this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(q,$,J){let G=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},X=1/this.resolution;q.x=($-G.left)*(this.domElement.width/G.width)*X,q.y=(J-G.top)*(this.domElement.height/G.height)*X}_normalizeToPointerData(q){let $=[];if(this.supportsTouchEvents&&q instanceof TouchEvent)for(let J=0,G=q.changedTouches.length;J<G;J++){let X=q.changedTouches[J];if(typeof X.button>"u")X.button=0;if(typeof X.buttons>"u")X.buttons=1;if(typeof X.isPrimary>"u")X.isPrimary=q.touches.length===1&&q.type==="touchstart";if(typeof X.width>"u")X.width=X.radiusX||1;if(typeof X.height>"u")X.height=X.radiusY||1;if(typeof X.tiltX>"u")X.tiltX=0;if(typeof X.tiltY>"u")X.tiltY=0;if(typeof X.pointerType>"u")X.pointerType="touch";if(typeof X.pointerId>"u")X.pointerId=X.identifier||0;if(typeof X.pressure>"u")X.pressure=X.force||0.5;if(typeof X.twist>"u")X.twist=0;if(typeof X.tangentialPressure>"u")X.tangentialPressure=0;if(typeof X.layerX>"u")X.layerX=X.offsetX=X.clientX;if(typeof X.layerY>"u")X.layerY=X.offsetY=X.clientY;X.isNormalized=!0,X.type=q.type,$.push(X)}else if(!globalThis.MouseEvent||q instanceof MouseEvent&&(!this.supportsPointerEvents||!(q instanceof globalThis.PointerEvent))){let J=q;if(typeof J.isPrimary>"u")J.isPrimary=!0;if(typeof J.width>"u")J.width=1;if(typeof J.height>"u")J.height=1;if(typeof J.tiltX>"u")J.tiltX=0;if(typeof J.tiltY>"u")J.tiltY=0;if(typeof J.pointerType>"u")J.pointerType="mouse";if(typeof J.pointerId>"u")J.pointerId=Vq;if(typeof J.pressure>"u")J.pressure=0.5;if(typeof J.twist>"u")J.twist=0;if(typeof J.tangentialPressure>"u")J.tangentialPressure=0;J.isNormalized=!0,$.push(J)}else $.push(q);return $}normalizeWheelEvent(q){let $=this._rootWheelEvent;return this._transferMouseData($,q),$.deltaX=q.deltaX,$.deltaY=q.deltaY,$.deltaZ=q.deltaZ,$.deltaMode=q.deltaMode,this.mapPositionToPoint($.screen,q.clientX,q.clientY),$.global.copyFrom($.screen),$.offset.copyFrom($.screen),$.nativeEvent=q,$.type=q.type,$}_bootstrapEvent(q,$){if(q.originalEvent=null,q.nativeEvent=$,q.pointerId=$.pointerId,q.width=$.width,q.height=$.height,q.isPrimary=$.isPrimary,q.pointerType=$.pointerType,q.pressure=$.pressure,q.tangentialPressure=$.tangentialPressure,q.tiltX=$.tiltX,q.tiltY=$.tiltY,q.twist=$.twist,this._transferMouseData(q,$),this.mapPositionToPoint(q.screen,$.clientX,$.clientY),q.global.copyFrom(q.screen),q.offset.copyFrom(q.screen),q.isTrusted=$.isTrusted,q.type==="pointerleave")q.type="pointerout";if(q.type.startsWith("mouse"))q.type=q.type.replace("mouse","pointer");if(q.type.startsWith("touch"))q.type=Bq[q.type]||q.type;return q}_transferMouseData(q,$){q.isTrusted=$.isTrusted,q.srcElement=$.srcElement,q.timeStamp=performance.now(),q.type=$.type,q.altKey=$.altKey,q.button=$.button,q.buttons=$.buttons,q.client.x=$.clientX,q.client.y=$.clientY,q.ctrlKey=$.ctrlKey,q.metaKey=$.metaKey,q.movement.x=$.movementX,q.movement.y=$.movementY,q.page.x=$.pageX,q.page.y=$.pageY,q.relatedTarget=null,q.shiftKey=$.shiftKey}};y.extension={name:"events",type:[O.WebGLSystem,O.CanvasSystem,O.WebGPUSystem],priority:-1};y.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};var e=y;var XQ={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(Q){this.eventMode=Q?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??e.defaultEventMode},set eventMode(Q){this._internalEventMode=Q},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(Q,q,$){let J=typeof $==="boolean"&&$||typeof $==="object"&&$.capture,G=typeof $==="object"?$.signal:void 0,X=typeof $==="object"?$.once===!0:!1,Y=typeof q==="function"?void 0:q;Q=J?`${Q}capture`:Q;let N=typeof q==="function"?q:q.handleEvent,Z=this;if(G)G.addEventListener("abort",()=>{Z.off(Q,N,Y)});if(X)Z.once(Q,N,Y);else Z.on(Q,N,Y)},removeEventListener(Q,q,$){let J=typeof $==="boolean"&&$||typeof $==="object"&&$.capture,G=typeof q==="function"?void 0:q;Q=J?`${Q}capture`:Q,q=typeof q==="function"?q:q.handleEvent,this.off(Q,q,G)},dispatchEvent(Q){if(!(Q instanceof S))throw Error("Container cannot propagate events outside of the Federated Events API");return Q.defaultPrevented=!1,Q.path=null,Q.target=this,Q.manager.dispatchEvent(Q),!Q.defaultPrevented}};
|
|
15
|
+
export{Fq as a,kq as b,e as c,XQ as d};
|