route-graphics 0.0.11 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/dist/RouteGraphics.js +27 -27
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var gR=Object.create;var Zu=Object.defineProperty;var xR=Object.getOwnPropertyDescriptor;var _R=Object.getOwnPropertyNames;var yR=Object.getPrototypeOf,bR=Object.prototype.hasOwnProperty;var x=(i,t)=>()=>(i&&(t=i(i=0)),t);var K=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),lx=(i,t)=>{for(var e in t)Zu(i,e,{get:t[e],enumerable:!0})},vR=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _R(t))!bR.call(i,s)&&s!==e&&Zu(i,s,{get:()=>t[s],enumerable:!(r=xR(t,s))||r.enumerable});return i};var Gi=(i,t,e)=>(e=i!=null?gR(yR(i)):{},vR(t||!i||!i.__esModule?Zu(e,"default",{value:i,enumerable:!0}):e,i));var y,Qu,ln,F,C=x(()=>{"use strict";y=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(y||{}),Qu=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},ln=(i,t)=>Qu(i).priority??t,F={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Qu).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Qu).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>ln(n.value,e)-ln(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>ln(o,e)-ln(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var ux=K((OU,Ju)=>{"use strict";var SR=Object.prototype.hasOwnProperty,ve="~";function cn(){}Object.create&&(cn.prototype=Object.create(null),new cn().__proto__||(ve=!1));function ER(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function cx(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new ER(e,r||i,s),n=ve?ve+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function qh(i,t){--i._eventsCount===0?i._events=new cn:delete i._events[t]}function xe(){this._events=new cn,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)SR.call(e,r)&&t.push(ve?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};xe.prototype.listeners=function(t){var e=ve?ve+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};xe.prototype.listenerCount=function(t){var e=ve?ve+t:t,r=this._events[e];return r?r.fn?1:r.length:0};xe.prototype.emit=function(t,e,r,s,o,n){var a=ve?ve+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};xe.prototype.on=function(t,e,r){return cx(this,t,e,r,!1)};xe.prototype.once=function(t,e,r){return cx(this,t,e,r,!0)};xe.prototype.removeListener=function(t,e,r,s){var o=ve?ve+t:t;if(!this._events[o])return this;if(!e)return qh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&qh(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:qh(this,o)}return this};xe.prototype.removeAllListeners=function(t){var e;return t?(e=ve?ve+t:t,this._events[e]&&qh(this,e)):(this._events=new cn,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=ve;xe.EventEmitter=xe;typeof Ju<"u"&&(Ju.exports=xe)});var dx,Pt,_e=x(()=>{dx=Gi(ux(),1),Pt=dx.default});var AR,Wr,ae,Ze,bx,fx,td,wR,Kh,vx,Tx,px,mx,gx,un,CR,PR,RR,MR,sd,xx,BR,ed,rd,_x,od,Ne,yx,Zh,nd=x(()=>{AR={grad:.9,turn:360,rad:360/(2*Math.PI)},Wr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ae=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Ze=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},bx=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},fx=function(i){return{r:Ze(i.r,0,255),g:Ze(i.g,0,255),b:Ze(i.b,0,255),a:Ze(i.a)}},td=function(i){return{r:ae(i.r),g:ae(i.g),b:ae(i.b),a:ae(i.a,3)}},wR=/^#([0-9a-f]{3,8})$/i,Kh=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},vx=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Tx=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),h=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,h,r][l],g:255*[h,r,r,a,n,n][l],b:255*[n,n,h,r,r,a][l],a:s}},px=function(i){return{h:bx(i.h),s:Ze(i.s,0,100),l:Ze(i.l,0,100),a:Ze(i.a)}},mx=function(i){return{h:ae(i.h),s:ae(i.s),l:ae(i.l),a:ae(i.a,3)}},gx=function(i){return Tx((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},un=function(i){return{h:(t=vx(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},CR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,PR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,RR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,MR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sd={string:[[function(i){var t=wR.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ae(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ae(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=RR.exec(i)||MR.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:fx({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=CR.exec(i)||PR.exec(i);if(!t)return null;var e,r,s=px({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(AR[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return gx(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Wr(t)&&Wr(e)&&Wr(r)?fx({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Wr(t)||!Wr(e)||!Wr(r))return null;var n=px({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return gx(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Wr(t)||!Wr(e)||!Wr(r))return null;var n=function(a){return{h:bx(a.h),s:Ze(a.s,0,100),v:Ze(a.v,0,100),a:Ze(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Tx(n)},"hsv"]]},xx=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},BR=function(i){return typeof i=="string"?xx(i.trim(),sd.string):typeof i=="object"&&i!==null?xx(i,sd.object):[null,void 0]},ed=function(i,t){var e=un(i);return{h:e.h,s:Ze(e.s+100*t,0,100),l:e.l,a:e.a}},rd=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},_x=function(i,t){var e=un(i);return{h:e.h,s:e.s,l:Ze(e.l+100*t,0,100),a:e.a}},od=function(){function i(t){this.parsed=BR(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return ae(rd(this.rgba),2)},i.prototype.isDark=function(){return rd(this.rgba)<.5},i.prototype.isLight=function(){return rd(this.rgba)>=.5},i.prototype.toHex=function(){return t=td(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Kh(ae(255*o)):"","#"+Kh(e)+Kh(r)+Kh(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return td(this.rgba)},i.prototype.toRgbString=function(){return t=td(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return mx(un(this.rgba))},i.prototype.toHslString=function(){return t=mx(un(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=vx(this.rgba),{h:ae(t.h),s:ae(t.s),v:ae(t.v),a:ae(t.a,3)};var t},i.prototype.invert=function(){return Ne({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Ne(ed(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ne(ed(this.rgba,-t))},i.prototype.grayscale=function(){return Ne(ed(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Ne(_x(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Ne(_x(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Ne({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ae(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=un(this.rgba);return typeof t=="number"?Ne({h:t,s:e.s,l:e.l,a:e.a}):ae(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Ne(t).toHex()},i}(),Ne=function(i){return i instanceof od?i:new od(i)},yx=[],Zh=function(i){i.forEach(function(t){yx.indexOf(t)<0&&(t(od,sd),yx.push(t))})}});function Qh(i,t){var e={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"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=r[this.toHex()];if(l)return l;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var p in e){var m=(a=c,h=o[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new i(h).toRgb():null},"name"])}var ad=x(()=>{});var Ss,et,fe=x(()=>{nd();ad();Zh([Qh]);Ss=class dn{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}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(t){return this.value=t,this}set value(t){if(t instanceof dn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=dn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=dn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ne(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof dn||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Ss.shared=new Ss;Ss._temp=new Ss;Ss.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;et=Ss});var Sx,Ex=x(()=>{"use strict";Sx={cullArea:null,cullable:!1,cullableChildren:!0}});var Ax,wx,Cx,hd=x(()=>{"use strict";Ax=Math.PI*2,wx=180/Math.PI,Cx=Math.PI/180});var at,ld,Qe=x(()=>{"use strict";at=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ld.x=0,ld.y=0,ld}},ld=new at});var B,IR,FR,dt=x(()=>{hd();Qe();B=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new at;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new at;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(r*n+o*-s),c=t.x,u=t.y;return e.x=n*l*c+-o*l*u+(h*o-a*n)*l,e.y=r*l*u+-s*l*c+(-h*r+a*s)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*c+s*d,this.c=o*l+n*u,this.d=o*c+n*d,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*d+e.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Ax-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/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 t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.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 FR.identity()}static get shared(){return IR.identity()}},IR=new B,FR=new B});var pe,Jh=x(()=>{"use strict";pe=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function nt(i="default"){return cd[i]===void 0&&(cd[i]=-1),++cd[i]}var cd,me=x(()=>{"use strict";cd={default:-1}});function W(i,t,e=3){if(Px[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1
|
+
var gR=Object.create;var Zu=Object.defineProperty;var xR=Object.getOwnPropertyDescriptor;var _R=Object.getOwnPropertyNames;var yR=Object.getPrototypeOf,bR=Object.prototype.hasOwnProperty;var x=(i,t)=>()=>(i&&(t=i(i=0)),t);var K=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),lx=(i,t)=>{for(var e in t)Zu(i,e,{get:t[e],enumerable:!0})},vR=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _R(t))!bR.call(i,s)&&s!==e&&Zu(i,s,{get:()=>t[s],enumerable:!(r=xR(t,s))||r.enumerable});return i};var Gi=(i,t,e)=>(e=i!=null?gR(yR(i)):{},vR(t||!i||!i.__esModule?Zu(e,"default",{value:i,enumerable:!0}):e,i));var y,Qu,ln,G,C=x(()=>{"use strict";y=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(y||{}),Qu=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},ln=(i,t)=>Qu(i).priority??t,G={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Qu).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Qu).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>ln(n.value,e)-ln(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>ln(o,e)-ln(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var ux=K((OU,Ju)=>{"use strict";var SR=Object.prototype.hasOwnProperty,ve="~";function cn(){}Object.create&&(cn.prototype=Object.create(null),new cn().__proto__||(ve=!1));function ER(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function cx(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new ER(e,r||i,s),n=ve?ve+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function qh(i,t){--i._eventsCount===0?i._events=new cn:delete i._events[t]}function xe(){this._events=new cn,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)SR.call(e,r)&&t.push(ve?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};xe.prototype.listeners=function(t){var e=ve?ve+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};xe.prototype.listenerCount=function(t){var e=ve?ve+t:t,r=this._events[e];return r?r.fn?1:r.length:0};xe.prototype.emit=function(t,e,r,s,o,n){var a=ve?ve+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};xe.prototype.on=function(t,e,r){return cx(this,t,e,r,!1)};xe.prototype.once=function(t,e,r){return cx(this,t,e,r,!0)};xe.prototype.removeListener=function(t,e,r,s){var o=ve?ve+t:t;if(!this._events[o])return this;if(!e)return qh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&qh(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:qh(this,o)}return this};xe.prototype.removeAllListeners=function(t){var e;return t?(e=ve?ve+t:t,this._events[e]&&qh(this,e)):(this._events=new cn,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=ve;xe.EventEmitter=xe;typeof Ju<"u"&&(Ju.exports=xe)});var dx,Pt,_e=x(()=>{dx=Gi(ux(),1),Pt=dx.default});var AR,Wr,ae,Ze,bx,fx,td,wR,Kh,vx,Tx,px,mx,gx,un,CR,PR,RR,MR,sd,xx,BR,ed,rd,_x,od,Ne,yx,Zh,nd=x(()=>{AR={grad:.9,turn:360,rad:360/(2*Math.PI)},Wr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ae=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Ze=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},bx=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},fx=function(i){return{r:Ze(i.r,0,255),g:Ze(i.g,0,255),b:Ze(i.b,0,255),a:Ze(i.a)}},td=function(i){return{r:ae(i.r),g:ae(i.g),b:ae(i.b),a:ae(i.a,3)}},wR=/^#([0-9a-f]{3,8})$/i,Kh=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},vx=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Tx=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),h=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,h,r][l],g:255*[h,r,r,a,n,n][l],b:255*[n,n,h,r,r,a][l],a:s}},px=function(i){return{h:bx(i.h),s:Ze(i.s,0,100),l:Ze(i.l,0,100),a:Ze(i.a)}},mx=function(i){return{h:ae(i.h),s:ae(i.s),l:ae(i.l),a:ae(i.a,3)}},gx=function(i){return Tx((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},un=function(i){return{h:(t=vx(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},CR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,PR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,RR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,MR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sd={string:[[function(i){var t=wR.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ae(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ae(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=RR.exec(i)||MR.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:fx({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=CR.exec(i)||PR.exec(i);if(!t)return null;var e,r,s=px({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(AR[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return gx(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Wr(t)&&Wr(e)&&Wr(r)?fx({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Wr(t)||!Wr(e)||!Wr(r))return null;var n=px({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return gx(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Wr(t)||!Wr(e)||!Wr(r))return null;var n=function(a){return{h:bx(a.h),s:Ze(a.s,0,100),v:Ze(a.v,0,100),a:Ze(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Tx(n)},"hsv"]]},xx=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},BR=function(i){return typeof i=="string"?xx(i.trim(),sd.string):typeof i=="object"&&i!==null?xx(i,sd.object):[null,void 0]},ed=function(i,t){var e=un(i);return{h:e.h,s:Ze(e.s+100*t,0,100),l:e.l,a:e.a}},rd=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},_x=function(i,t){var e=un(i);return{h:e.h,s:e.s,l:Ze(e.l+100*t,0,100),a:e.a}},od=function(){function i(t){this.parsed=BR(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return ae(rd(this.rgba),2)},i.prototype.isDark=function(){return rd(this.rgba)<.5},i.prototype.isLight=function(){return rd(this.rgba)>=.5},i.prototype.toHex=function(){return t=td(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?Kh(ae(255*o)):"","#"+Kh(e)+Kh(r)+Kh(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return td(this.rgba)},i.prototype.toRgbString=function(){return t=td(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return mx(un(this.rgba))},i.prototype.toHslString=function(){return t=mx(un(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=vx(this.rgba),{h:ae(t.h),s:ae(t.s),v:ae(t.v),a:ae(t.a,3)};var t},i.prototype.invert=function(){return Ne({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Ne(ed(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ne(ed(this.rgba,-t))},i.prototype.grayscale=function(){return Ne(ed(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Ne(_x(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Ne(_x(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Ne({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ae(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=un(this.rgba);return typeof t=="number"?Ne({h:t,s:e.s,l:e.l,a:e.a}):ae(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Ne(t).toHex()},i}(),Ne=function(i){return i instanceof od?i:new od(i)},yx=[],Zh=function(i){i.forEach(function(t){yx.indexOf(t)<0&&(t(od,sd),yx.push(t))})}});function Qh(i,t){var e={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"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=r[this.toHex()];if(l)return l;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var p in e){var m=(a=c,h=o[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new i(h).toRgb():null},"name"])}var ad=x(()=>{});var Ss,et,fe=x(()=>{nd();ad();Zh([Qh]);Ss=class dn{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}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(t){return this.value=t,this}set value(t){if(t instanceof dn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=dn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=dn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ne(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof dn||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Ss.shared=new Ss;Ss._temp=new Ss;Ss.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;et=Ss});var Sx,Ex=x(()=>{"use strict";Sx={cullArea:null,cullable:!1,cullableChildren:!0}});var Ax,wx,Cx,hd=x(()=>{"use strict";Ax=Math.PI*2,wx=180/Math.PI,Cx=Math.PI/180});var at,ld,Qe=x(()=>{"use strict";at=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return ld.x=0,ld.y=0,ld}},ld=new at});var I,IR,FR,dt=x(()=>{hd();Qe();I=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new at;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new at;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(r*n+o*-s),c=t.x,u=t.y;return e.x=n*l*c+-o*l*u+(h*o-a*n)*l,e.y=r*l*u+-s*l*c+(-h*r+a*s)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*c+s*d,this.c=o*l+n*u,this.d=o*c+n*d,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*d+e.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Ax-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/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 t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.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 FR.identity()}static get shared(){return IR.identity()}},IR=new I,FR=new I});var pe,Jh=x(()=>{"use strict";pe=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function nt(i="default"){return cd[i]===void 0&&(cd[i]=-1),++cd[i]}var cd,me=x(()=>{"use strict";cd={default:-1}});function z(i,t,e=3){if(Px[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
2
2
|
Deprecated since v${i}`):(r=r.split(`
|
|
3
3
|
`).splice(e).join(`
|
|
4
4
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
5
5
|
Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
-
Deprecated since v${i}`),console.warn(r))),Px[t]=!0}var Px,Q,Rx,Dt=x(()=>{"use strict";Px={},Q="8.0.0",Rx="8.3.4"});var Ui,ud=x(()=>{"use strict";Ui=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var dd,J,Te=x(()=>{ud();dd=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Ui(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},J=new dd});var Mx,Bx=x(()=>{Dt();Mx={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){W("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function tl(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var fd=x(()=>{"use strict"});var Ix,Fx=x(()=>{fd();Dt();Ix={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}tl(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||W(Q,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var Gx,Ux=x(()=>{"use strict";Gx={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var zr,el=x(()=>{"use strict";zr=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var pd,rl,kx=x(()=>{C();Te();pd=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return J.get(r.maskClass,t)}return t}returnMaskEffect(t){J.return(t)}},rl=new pd;F.handleByList(y.MaskEffect,rl._effectClasses)});var Ox,Lx=x(()=>{el();kx();Ox={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),rl.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=rl.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new zr);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new zr),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Dx,Nx=x(()=>{Dt();Dx={label:null,get name(){return W(Q,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){W(Q,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var il,it,he=x(()=>{Qe();il=[new at,new at,new at,new at],it=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}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 i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,h=this.y,l=r*(1-s),c=r-l,u=a-l,d=a+o+l,f=h-l,p=h+n+l,m=a+c,g=a+o-c,b=h+c,_=h+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<g&&e>b&&e<_)}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=il[0].set(t.left,t.top),h=il[1].set(t.left,t.bottom),l=il[2].set(t.right,t.top),c=il[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),v=u*(l.x-a.x),T=_*r+v*o,w=_*s+v*o,S=_*r+v*n,A=_*s+v*n;return!(Math.max(T,w,S,A)<=_*a.x+v*a.y||Math.min(T,w,S,A)>=_*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Hx,Et,Be=x(()=>{dt();he();Hx=new B,Et=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Hx,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new it);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Hx,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,h=o.c,l=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=n*t+h*e+c,b=a*t+l*e+u;g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*r+h*e+c,b=a*r+l*e+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*t+h*s+c,b=a*t+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*r+h*s+c,b=a*r+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:h,d:l,tx:c,ty:u}=t,d=n*e+h*r+c,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+h*r+c,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+h*o+c,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+h*o+c,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,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 i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}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(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,h=this.maxY;s||(s=this.matrix);let l=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=e;m<r;m+=2){let g=t[m],b=t[m+1],_=l*g+u*b+f,v=c*g+d*b+p;o=_<o?_:o,n=v<n?v:n,a=_>a?_:a,h=v>h?v:h}this.minX=o,this.minY=n,this.maxX=a,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var Zt,He,ki=x(()=>{dt();ud();Be();Zt=new Ui(B),He=new Ui(Et)});var GR,Vx,Wx=x(()=>{dt();Be();ki();GR=new B,Vx={getFastGlobalBounds(i,t){t||(t=new Et),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=He.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(GR).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),He.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),He.return(r))}}});function Es(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=Zt.get().identity(),r=sl(i,s)):r=B.IDENTITY,zx(i,e,r,t),s&&Zt.return(s),e.isValid||e.set(0,0,0,0),e}function zx(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=Zt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=He.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)zx(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,B.IDENTITY),He.return(t)}r||Zt.return(s)}function sl(i,t){let e=i.parent;return e&&(sl(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var fn=x(()=>{dt();ki()});function ol(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=r*n/255|0,c=s*a/255|0;return(h<<16)+(l<<8)+c}var md=x(()=>{"use strict"});function As(i,t){return i===$x?t:t===$x?i:ol(i,t)}var $x,gd=x(()=>{md();$x=16777215});function pn(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var Xx,jx=x(()=>{fn();ki();gd();Xx={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=sl(this,Zt.get().identity());return i.appendFrom(this.localTransform,e),Zt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?pn(this.renderGroup.worldColor):this.parentRenderGroup?pn(As(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=As(t,e.localColor),e=e.parent;return pn(t)}}});function O(...i){xd!==Yx&&(xd++,xd===Yx?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var xd,Yx,At=x(()=>{"use strict";xd=0,Yx=500});function ws(i,t,e){return t.clear(),e||(e=B.IDENTITY),qx(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function qx(i,t,e,r,s){let o;if(s)o=Zt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=Zt.get(),o.appendFrom(h,e)}let n=t,a=!!i.effects.length;if(a&&(t=He.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let h=i.children;for(let l=0;l<h.length;l++)qx(h[l],t,o,r,!1)}if(a){for(let h=0;h<i.effects.length;h++)i.effects[h].addLocalBounds?.(t,r);n.addBounds(t,B.IDENTITY),He.return(t)}Zt.return(o)}var nl=x(()=>{dt();ki()});function _d(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&_d(s,t)}return t.didChange}var Kx=x(()=>{"use strict"});var UR,Zx,Qx=x(()=>{dt();Be();fn();nl();Kx();UR=new B,Zx={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Et});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),_d(this,i),i.didChange&&ws(this,i.localBounds,UR),i.localBounds},getBounds(i,t){return Es(this,i,t||new Et)}}});var Jx,t_=x(()=>{"use strict";Jx={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function kR(i,t){return i._zIndex-t._zIndex}var e_,r_=x(()=>{"use strict";e_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(kR))}}});var i_,s_=x(()=>{Qe();ki();i_={getGlobalPosition(i=new at,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(Zt.get(),e);return t=r.apply(i,t),Zt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(Zt.get(),r);return e=s.applyInverse(i,e),Zt.return(s),e}}});var Cs,yd=x(()=>{me();Cs=class{constructor(){this.uid=nt("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function $r(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function bd(i){return!(i&i-1)&&!!i}var mn=x(()=>{"use strict"});function al(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var vd=x(()=>{"use strict"});function OR(i){let t=o_[i];return t===void 0&&(o_[i]=nt("resource")),t}var o_,n_,hl,Td=x(()=>{_e();me();Dt();o_=Object.create(null);n_=class a_ extends Pt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...a_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){W(Q,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=OR(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};n_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};hl=n_});var h_,bt,Ie=x(()=>{_e();mn();vd();me();Td();h_=class l_ extends Pt{constructor(t={}){super(),this.options=t,this.uid=nt("textureSource"),this._resourceType="textureSource",this._resourceId=nt("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...l_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new hl(al(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=nt("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=nt("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=bd(this.pixelWidth)&&bd(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};h_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};bt=h_});function LR(){for(let i=0;i<16;i++){let t=[];Sd.push(t);for(let e=0;e<16;e++){let r=ll(Oi[i]*Oi[e]+Di[i]*Li[e]),s=ll(Li[i]*Oi[e]+Ni[i]*Li[e]),o=ll(Oi[i]*Di[e]+Di[i]*Ni[e]),n=ll(Li[i]*Di[e]+Ni[i]*Ni[e]);for(let a=0;a<16;a++)if(Oi[a]===r&&Li[a]===s&&Di[a]===o&&Ni[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new B;t.set(Oi[i],Li[i],Di[i],Ni[i],0,0),c_.push(t)}}var Oi,Li,Di,Ni,Sd,c_,ll,Ut,u_=x(()=>{dt();Oi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Li=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Di=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ni=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Sd=[],c_=[],ll=Math.sign;LR();Ut={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:i=>Oi[i],uY:i=>Li[i],vX:i=>Di[i],vY:i=>Ni[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Sd[i][t],sub:(i,t)=>Sd[i][Ut.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Ut.S:Ut.N:Math.abs(t)*2<=Math.abs(i)?i>0?Ut.E:Ut.W:t>0?i>0?Ut.SE:Ut.SW:i>0?Ut.NE:Ut.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=c_[Ut.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var Ed,d_=x(()=>{"use strict";Ed=()=>{}});var Hi,Ad=x(()=>{C();Ie();Hi=class extends bt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Hi.extension=y.TextureSource});var f_,Ps,wd=x(()=>{dt();f_=new B,Ps=class{constructor(t,e){this.mapCoord=new B,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(f_.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(f_));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,h=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+h)/o.width,n[1]=(t.frame.y+a+h)/o.height,n[2]=(t.frame.x+t.frame.width-a+h)/o.width,n[3]=(t.frame.y+t.frame.height-a+h)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var E,vt=x(()=>{_e();u_();he();me();Dt();d_();Ad();Ie();wd();E=class extends Pt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=nt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new it,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new bt,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=h??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Ps(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,h=e.height/s,l=this.rotate;if(l){let c=a/2,u=h/2,d=o+c,f=n+u;l=Ut.add(l,Ut.NW),t.x0=d+c*Ut.uX(l),t.y0=f+u*Ut.uY(l),l=Ut.add(l,2),t.x1=d+c*Ut.uX(l),t.y1=f+u*Ut.uY(l),l=Ut.add(l,2),t.x2=d+c*Ut.uX(l),t.y2=f+u*Ut.uY(l),l=Ut.add(l,2),t.x3=d+c*Ut.uX(l),t.y3=f+u*Ut.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+h,t.x3=o,t.y3=n+h}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return W(Q,"Texture.baseTexture is now Texture.source"),this._source}};E.EMPTY=new E({label:"EMPTY",source:new bt({label:"EMPTY"})});E.EMPTY.destroy=Ed;E.WHITE=new E({source:new Hi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});E.WHITE.destroy=Ed});var DR,Cd,Nt,ui=x(()=>{mn();Ie();vt();DR=0,Cd=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new bt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new E({source:s,label:`texturePool_${DR++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=$r(o),n=$r(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let h=this._texturePool[a].pop();return h||(h=this.createTexture(o,n,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=n/r,h.source.pixelWidth=o,h.source.pixelHeight=n,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=a,h}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},Nt=new Cd});var cl,p_=x(()=>{dt();yd();ui();cl=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Cs,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Nt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new B),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function m_(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var g_=x(()=>{"use strict"});var Pd,Rd,Md,Rs,gn,Vi,St,dr=x(()=>{_e();fe();Ex();C();dt();hd();Jh();me();Dt();Te();Bx();Fx();Ux();Lx();Nx();Wx();jx();Qx();t_();r_();s_();p_();g_();Pd=new pe(null),Rd=new pe(null),Md=new pe(null,1,1),Rs=1,gn=2,Vi=4,St=class i extends Pt{constructor(t={}){super(),this.uid=nt("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new pe(this,0,0),this._scale=Md,this._pivot=Rd,this._skew=Pd,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],m_(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){W("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),F.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||W(Q,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=J.get(cl,this),this.groupTransform=B.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),J.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new B),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*wx}set angle(t){this.rotation=t*Cx}get pivot(){return this._pivot===Rd&&(this._pivot=new pe(this,0,0)),this._pivot}set pivot(t){this._pivot===Rd&&(this._pivot=new pe(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Pd&&(this._skew=new pe(this,0,0)),this._skew}set skew(t){this._skew===Pd&&(this._skew=new pe(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Md&&(this._scale=new pe(this,1,1)),this._scale}set scale(t){this._scale===Md&&(this._scale=new pe(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,h=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(h*e.a+l*e.c),e.ty=o._y-(h*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Rs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=et.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Rs,this._onUpdate())}get tint(){return pn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=gn,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Vi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};F.mixin(St,Ix,Vx,i_,Jx,Zx,Ox,Dx,e_,Sx,Mx,Xx,Gx)});var di,ul=x(()=>{Qe();di=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new at,this.page=new at,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function NR(i){return function(t){return t.test(i)}}function fi(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=NR(e),o={apple:{phone:s(Bd)&&!s(Xr),ipod:s(x_),tablet:!s(Bd)&&(s(__)||C_(t))&&!s(Xr),universal:s(y_),device:(s(Bd)||s(x_)||s(__)||s(y_)||C_(t))&&!s(Xr)},amazon:{phone:s(Ms),tablet:!s(Ms)&&s(dl),device:s(Ms)||s(dl)},android:{phone:!s(Xr)&&s(Ms)||!s(Xr)&&s(Id),tablet:!s(Xr)&&!s(Ms)&&!s(Id)&&(s(dl)||s(b_)),device:!s(Xr)&&(s(Ms)||s(dl)||s(Id)||s(b_))||s(/\bokhttp\b/i)},windows:{phone:s(Xr),tablet:s(v_),device:s(Xr)||s(v_)},other:{blackberry:s(T_),blackberry10:s(S_),opera:s(E_),firefox:s(w_),chrome:s(A_),device:s(T_)||s(S_)||s(E_)||s(w_)||s(A_)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var Bd,x_,__,y_,Id,b_,Ms,dl,Xr,v_,T_,S_,E_,A_,w_,C_,Fd=x(()=>{Bd=/iPhone/i,x_=/iPod/i,__=/iPad/i,y_=/\biOS-universal(?:.+)Mac\b/i,Id=/\bAndroid(?:.+)Mobile\b/i,b_=/Android/i,Ms=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,dl=/Silk/i,Xr=/Windows Phone/i,v_=/\bWindows(?:.+)ARM\b/i,T_=/BlackBerry/i,S_=/BB10/i,E_=/Opera Mini/i,A_=/\b(CriOS|Chrome)(?:.+)Mobile/i,w_=/Mobile(?:.+)Firefox\b/i,C_=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var Gd=x(()=>{Fd();Fd()});var HR,P_,R_=x(()=>{Gd();HR=fi.default??fi,P_=HR(globalThis.navigator)});var VR,fl,WR,zR,M_,B_,$R,XR,jR,Ud,F_,G_=x(()=>{ul();C();R_();fd();VR=9,fl=100,WR=0,zR=0,M_=2,B_=1,$R=-1e3,XR=-1e3,jR=2,Ud=class I_{constructor(t,e=P_){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${B_}px`,t.style.height=`${B_}px`,t.style.position="absolute",t.style.top=`${$R}px`,t.style.left=`${XR}px`,t.style.zIndex=jR.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${fl}px`,this._div.style.height=`${fl}px`,this._div.style.position="absolute",this._div.style.top=`${WR}px`,this._div.style.left=`${zR}px`,this._div.style.zIndex=M_.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...I_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,tl(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,h=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*h}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*h}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*h}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*h}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
6
|
+
Deprecated since v${i}`),console.warn(r))),Px[t]=!0}var Px,Q,Rx,Dt=x(()=>{"use strict";Px={},Q="8.0.0",Rx="8.3.4"});var Ui,ud=x(()=>{"use strict";Ui=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var dd,J,Te=x(()=>{ud();dd=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Ui(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},J=new dd});var Mx,Bx=x(()=>{Dt();Mx={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){z("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function tl(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var fd=x(()=>{"use strict"});var Ix,Fx=x(()=>{fd();Dt();Ix={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}tl(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||z(Q,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var Gx,Ux=x(()=>{"use strict";Gx={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var zr,el=x(()=>{"use strict";zr=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var pd,rl,kx=x(()=>{C();Te();pd=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return J.get(r.maskClass,t)}return t}returnMaskEffect(t){J.return(t)}},rl=new pd;G.handleByList(y.MaskEffect,rl._effectClasses)});var Ox,Lx=x(()=>{el();kx();Ox={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),rl.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=rl.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new zr);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new zr),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Dx,Nx=x(()=>{Dt();Dx={label:null,get name(){return z(Q,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){z(Q,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var il,st,he=x(()=>{Qe();il=[new at,new at,new at,new at],st=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}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 i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,h=this.y,l=r*(1-s),c=r-l,u=a-l,d=a+o+l,f=h-l,p=h+n+l,m=a+c,g=a+o-c,b=h+c,_=h+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>m&&t<g&&e>b&&e<_)}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=il[0].set(t.left,t.top),h=il[1].set(t.left,t.bottom),l=il[2].set(t.right,t.top),c=il[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),v=u*(l.x-a.x),T=_*r+v*o,A=_*s+v*o,S=_*r+v*n,w=_*s+v*n;return!(Math.max(T,A,S,w)<=_*a.x+v*a.y||Math.min(T,A,S,w)>=_*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var Hx,Et,Be=x(()=>{dt();he();Hx=new I,Et=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Hx,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new st);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Hx,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,h=o.c,l=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=n*t+h*e+c,b=a*t+l*e+u;g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*r+h*e+c,b=a*r+l*e+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*t+h*s+c,b=a*t+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),g=n*r+h*s+c,b=a*r+l*s+u,g<d&&(d=g),b<f&&(f=b),g>p&&(p=g),b>m&&(m=b),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:h,d:l,tx:c,ty:u}=t,d=n*e+h*r+c,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+h*r+c,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+h*o+c,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+h*o+c,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,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 i(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}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(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,h=this.maxY;s||(s=this.matrix);let l=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=e;m<r;m+=2){let g=t[m],b=t[m+1],_=l*g+u*b+f,v=c*g+d*b+p;o=_<o?_:o,n=v<n?v:n,a=_>a?_:a,h=v>h?v:h}this.minX=o,this.minY=n,this.maxX=a,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var Zt,He,ki=x(()=>{dt();ud();Be();Zt=new Ui(I),He=new Ui(Et)});var GR,Vx,Wx=x(()=>{dt();Be();ki();GR=new I,Vx={getFastGlobalBounds(i,t){t||(t=new Et),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=He.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(GR).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),He.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),He.return(r))}}});function Es(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=Zt.get().identity(),r=sl(i,s)):r=I.IDENTITY,zx(i,e,r,t),s&&Zt.return(s),e.isValid||e.set(0,0,0,0),e}function zx(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=Zt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=He.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)zx(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,I.IDENTITY),He.return(t)}r||Zt.return(s)}function sl(i,t){let e=i.parent;return e&&(sl(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var fn=x(()=>{dt();ki()});function ol(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=r*n/255|0,c=s*a/255|0;return(h<<16)+(l<<8)+c}var md=x(()=>{"use strict"});function As(i,t){return i===$x?t:t===$x?i:ol(i,t)}var $x,gd=x(()=>{md();$x=16777215});function pn(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var Xx,jx=x(()=>{fn();ki();gd();Xx={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=sl(this,Zt.get().identity());return i.appendFrom(this.localTransform,e),Zt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?pn(this.renderGroup.worldColor):this.parentRenderGroup?pn(As(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=As(t,e.localColor),e=e.parent;return pn(t)}}});function O(...i){xd!==Yx&&(xd++,xd===Yx?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var xd,Yx,At=x(()=>{"use strict";xd=0,Yx=500});function ws(i,t,e){return t.clear(),e||(e=I.IDENTITY),qx(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function qx(i,t,e,r,s){let o;if(s)o=Zt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=Zt.get(),o.appendFrom(h,e)}let n=t,a=!!i.effects.length;if(a&&(t=He.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let h=i.children;for(let l=0;l<h.length;l++)qx(h[l],t,o,r,!1)}if(a){for(let h=0;h<i.effects.length;h++)i.effects[h].addLocalBounds?.(t,r);n.addBounds(t,I.IDENTITY),He.return(t)}Zt.return(o)}var nl=x(()=>{dt();ki()});function _d(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&_d(s,t)}return t.didChange}var Kx=x(()=>{"use strict"});var UR,Zx,Qx=x(()=>{dt();Be();fn();nl();Kx();UR=new I,Zx={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Et});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),_d(this,i),i.didChange&&ws(this,i.localBounds,UR),i.localBounds},getBounds(i,t){return Es(this,i,t||new Et)}}});var Jx,t_=x(()=>{"use strict";Jx={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function kR(i,t){return i._zIndex-t._zIndex}var e_,r_=x(()=>{"use strict";e_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(kR))}}});var i_,s_=x(()=>{Qe();ki();i_={getGlobalPosition(i=new at,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(Zt.get(),e);return t=r.apply(i,t),Zt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(Zt.get(),r);return e=s.applyInverse(i,e),Zt.return(s),e}}});var Cs,yd=x(()=>{me();Cs=class{constructor(){this.uid=nt("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function $r(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function bd(i){return!(i&i-1)&&!!i}var mn=x(()=>{"use strict"});function al(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var vd=x(()=>{"use strict"});function OR(i){let t=o_[i];return t===void 0&&(o_[i]=nt("resource")),t}var o_,n_,hl,Td=x(()=>{_e();me();Dt();o_=Object.create(null);n_=class a_ extends Pt{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...a_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){z(Q,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=OR(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};n_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};hl=n_});var h_,bt,Ie=x(()=>{_e();mn();vd();me();Td();h_=class l_ extends Pt{constructor(t={}){super(),this.options=t,this.uid=nt("textureSource"),this._resourceType="textureSource",this._resourceId=nt("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...l_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new hl(al(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=nt("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=nt("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=bd(this.pixelWidth)&&bd(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};h_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};bt=h_});function LR(){for(let i=0;i<16;i++){let t=[];Sd.push(t);for(let e=0;e<16;e++){let r=ll(Oi[i]*Oi[e]+Di[i]*Li[e]),s=ll(Li[i]*Oi[e]+Ni[i]*Li[e]),o=ll(Oi[i]*Di[e]+Di[i]*Ni[e]),n=ll(Li[i]*Di[e]+Ni[i]*Ni[e]);for(let a=0;a<16;a++)if(Oi[a]===r&&Li[a]===s&&Di[a]===o&&Ni[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new I;t.set(Oi[i],Li[i],Di[i],Ni[i],0,0),c_.push(t)}}var Oi,Li,Di,Ni,Sd,c_,ll,Ut,u_=x(()=>{dt();Oi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Li=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Di=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ni=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Sd=[],c_=[],ll=Math.sign;LR();Ut={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:i=>Oi[i],uY:i=>Li[i],vX:i=>Di[i],vY:i=>Ni[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Sd[i][t],sub:(i,t)=>Sd[i][Ut.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Ut.S:Ut.N:Math.abs(t)*2<=Math.abs(i)?i>0?Ut.E:Ut.W:t>0?i>0?Ut.SE:Ut.SW:i>0?Ut.NE:Ut.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=c_[Ut.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var Ed,d_=x(()=>{"use strict";Ed=()=>{}});var Hi,Ad=x(()=>{C();Ie();Hi=class extends bt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};Hi.extension=y.TextureSource});var f_,Ps,wd=x(()=>{dt();f_=new I,Ps=class{constructor(t,e){this.mapCoord=new I,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(f_.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(f_));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,h=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+h)/o.width,n[1]=(t.frame.y+a+h)/o.height,n[2]=(t.frame.x+t.frame.width-a+h)/o.width,n[3]=(t.frame.y+t.frame.height-a+h)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var E,vt=x(()=>{_e();u_();he();me();Dt();d_();Ad();Ie();wd();E=class extends Pt{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=nt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new st,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new bt,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=h??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Ps(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,h=e.height/s,l=this.rotate;if(l){let c=a/2,u=h/2,d=o+c,f=n+u;l=Ut.add(l,Ut.NW),t.x0=d+c*Ut.uX(l),t.y0=f+u*Ut.uY(l),l=Ut.add(l,2),t.x1=d+c*Ut.uX(l),t.y1=f+u*Ut.uY(l),l=Ut.add(l,2),t.x2=d+c*Ut.uX(l),t.y2=f+u*Ut.uY(l),l=Ut.add(l,2),t.x3=d+c*Ut.uX(l),t.y3=f+u*Ut.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+h,t.x3=o,t.y3=n+h}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return z(Q,"Texture.baseTexture is now Texture.source"),this._source}};E.EMPTY=new E({label:"EMPTY",source:new bt({label:"EMPTY"})});E.EMPTY.destroy=Ed;E.WHITE=new E({source:new Hi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});E.WHITE.destroy=Ed});var DR,Cd,Nt,ui=x(()=>{mn();Ie();vt();DR=0,Cd=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new bt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new E({source:s,label:`texturePool_${DR++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=$r(o),n=$r(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let h=this._texturePool[a].pop();return h||(h=this.createTexture(o,n,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=n/r,h.source.pixelWidth=o,h.source.pixelHeight=n,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=a,h}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},Nt=new Cd});var cl,p_=x(()=>{dt();yd();ui();cl=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new I,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Cs,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Nt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new I),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new I),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new I),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function m_(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var g_=x(()=>{"use strict"});var Pd,Rd,Md,Rs,gn,Vi,St,dr=x(()=>{_e();fe();Ex();C();dt();hd();Jh();me();Dt();Te();Bx();Fx();Ux();Lx();Nx();Wx();jx();Qx();t_();r_();s_();p_();g_();Pd=new pe(null),Rd=new pe(null),Md=new pe(null,1,1),Rs=1,gn=2,Vi=4,St=class i extends Pt{constructor(t={}){super(),this.uid=nt("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new I,this.relativeGroupTransform=new I,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new pe(this,0,0),this._scale=Md,this._pivot=Rd,this._skew=Pd,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],m_(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){z("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),G.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||z(Q,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=J.get(cl,this),this.groupTransform=I.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),J.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new I),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*wx}set angle(t){this.rotation=t*Cx}get pivot(){return this._pivot===Rd&&(this._pivot=new pe(this,0,0)),this._pivot}set pivot(t){this._pivot===Rd&&(this._pivot=new pe(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Pd&&(this._skew=new pe(this,0,0)),this._skew}set skew(t){this._skew===Pd&&(this._skew=new pe(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Md&&(this._scale=new pe(this,1,1)),this._scale}set scale(t){this._scale===Md&&(this._scale=new pe(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,h=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(h*e.a+l*e.c),e.ty=o._y-(h*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Rs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=et.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Rs,this._onUpdate())}get tint(){return pn(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=gn,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Vi,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Vi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};G.mixin(St,Ix,Vx,i_,Jx,Zx,Ox,Dx,e_,Sx,Mx,Xx,Gx)});var di,ul=x(()=>{Qe();di=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new at,this.page=new at,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function NR(i){return function(t){return t.test(i)}}function fi(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=NR(e),o={apple:{phone:s(Bd)&&!s(Xr),ipod:s(x_),tablet:!s(Bd)&&(s(__)||C_(t))&&!s(Xr),universal:s(y_),device:(s(Bd)||s(x_)||s(__)||s(y_)||C_(t))&&!s(Xr)},amazon:{phone:s(Ms),tablet:!s(Ms)&&s(dl),device:s(Ms)||s(dl)},android:{phone:!s(Xr)&&s(Ms)||!s(Xr)&&s(Id),tablet:!s(Xr)&&!s(Ms)&&!s(Id)&&(s(dl)||s(b_)),device:!s(Xr)&&(s(Ms)||s(dl)||s(Id)||s(b_))||s(/\bokhttp\b/i)},windows:{phone:s(Xr),tablet:s(v_),device:s(Xr)||s(v_)},other:{blackberry:s(T_),blackberry10:s(S_),opera:s(E_),firefox:s(w_),chrome:s(A_),device:s(T_)||s(S_)||s(E_)||s(w_)||s(A_)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var Bd,x_,__,y_,Id,b_,Ms,dl,Xr,v_,T_,S_,E_,A_,w_,C_,Fd=x(()=>{Bd=/iPhone/i,x_=/iPod/i,__=/iPad/i,y_=/\biOS-universal(?:.+)Mac\b/i,Id=/\bAndroid(?:.+)Mobile\b/i,b_=/Android/i,Ms=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,dl=/Silk/i,Xr=/Windows Phone/i,v_=/\bWindows(?:.+)ARM\b/i,T_=/BlackBerry/i,S_=/BB10/i,E_=/Opera Mini/i,A_=/\b(CriOS|Chrome)(?:.+)Mobile/i,w_=/Mobile(?:.+)Firefox\b/i,C_=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var Gd=x(()=>{Fd();Fd()});var HR,P_,R_=x(()=>{Gd();HR=fi.default??fi,P_=HR(globalThis.navigator)});var VR,fl,WR,zR,M_,B_,$R,XR,jR,Ud,F_,G_=x(()=>{ul();C();R_();fd();VR=9,fl=100,WR=0,zR=0,M_=2,B_=1,$R=-1e3,XR=-1e3,jR=2,Ud=class I_{constructor(t,e=P_){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let t=document.createElement("button");t.style.width=`${B_}px`,t.style.height=`${B_}px`,t.style.position="absolute",t.style.top=`${$R}px`,t.style.left=`${XR}px`,t.style.zIndex=jR.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${fl}px`,this._div.style.height=`${fl}px`,this._div.style.position="absolute",this._div.style.top=`${WR}px`,this._div.style.left=`${zR}px`,this._div.style.zIndex=M_.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...I_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,tl(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,h=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*h}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*h}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*h}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*h}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
7
7
|
color: transparent;
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
padding: 0;
|
|
@@ -16,9 +16,9 @@ Deprecated since v${i}`),console.warn(r))),Px[t]=!0}var Px,Q,Rx,Dt=x(()=>{"use s
|
|
|
16
16
|
-webkit-user-select: none;
|
|
17
17
|
-moz-user-select: none;
|
|
18
18
|
-ms-user-select: none;
|
|
19
|
-
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${fl}px`,e.style.height=`${fl}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=M_.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new di(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==VR||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}};Ud.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"accessibility"};Ud.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};F_=Ud});var U_,k_=x(()=>{"use strict";U_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var O_=x(()=>{C();dr();G_();k_();F.add(F_);F.mixin(St,U_)});var xn,L_=x(()=>{C();xn=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};xn.extension=y.Application});var pi,pl=x(()=>{"use strict";pi=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(pi||{})});var Bs,D_=x(()=>{"use strict";Bs=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var N_,Fe,_n=x(()=>{pl();D_();N_=class Ve{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Bs(null,null,1/0),this.deltaMS=1/Ve.targetFPMS,this.elapsedMS=1/Ve.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=pi.NORMAL){return this._addListener(new Bs(t,e,r))}addOnce(t,e,r=pi.NORMAL){return this._addListener(new Bs(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ve.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ve.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ve._shared){let t=Ve._shared=new Ve;t.autoStart=!0,t._protected=!0}return Ve._shared}static get system(){if(!Ve._system){let t=Ve._system=new Ve;t.autoStart=!0,t._protected=!0}return Ve._system}};N_.targetFPMS=.06;Fe=N_});var yn,H_=x(()=>{C();pl();_n();yn=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,pi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Fe.shared:new Fe,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};yn.extension=y.Application});var kd=x(()=>{C();L_();H_();F.add(xn);F.add(yn)});var Od,Sr,Ld=x(()=>{pl();_n();Od=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Fe.system.add(this._tickerUpdate,this,pi.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Fe.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Sr=new Od});var jr,ml=x(()=>{Qe();ul();jr=class extends di{constructor(){super(...arguments),this.client=new at,this.movement=new at,this.offset=new at,this.global=new at,this.screen=new at}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}});var Se,Dd=x(()=>{ml();Se=class extends jr{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Er,Nd=x(()=>{ml();Er=class extends jr{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Er.DOM_DELTA_PIXEL=0;Er.DOM_DELTA_LINE=1;Er.DOM_DELTA_PAGE=2});var YR,qR,bn,gl,V_=x(()=>{_e();Qe();At();Ld();ml();Dd();Nd();YR=2048,qR=new at,bn=new at,gl=class{constructor(t){this.dispatch=new Pt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else O(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Sr.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,qR.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<YR&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Sr.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:h&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Sr.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let c=h.length-1;c>=0;c--){let u=h[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,bn),!t.hitArea.contains(bn.x,bn.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,bn),t.containsPoint(bn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let h=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,h,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),r&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(o!==e.target){let h=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let h=r.button===2;this.notifyTarget(r,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Er)){O("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Se);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Er);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Se);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Se&&e instanceof Se&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof jr&&e instanceof jr&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var KR,ZR,Vd,xl,Wd=x(()=>{C();V_();Ld();Dd();Nd();KR=1,ZR={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Vd=class Hd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new gl(null),Sr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Se(null),this._rootWheelEvent=new Er(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Hd.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,!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(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Hd._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Sr.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Sr.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Sr.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!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)):(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;Sr.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!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)):(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(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=KR),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=ZR[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Vd.extension={name:"events",type:[y.WebGLSystem,y.CanvasSystem,y.WebGPUSystem],priority:-1};Vd.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};xl=Vd});var W_,z_=x(()=>{Wd();ul();W_={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??xl.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(i,a,n)}),o?h.once(i,a,n):h.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof di))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var $_=x(()=>{C();dr();Wd();z_();F.add(xl);F.mixin(St,W_)});var vn,X_=x(()=>{C();vn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,h=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${h}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-h}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};vn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"dom"}});var mi,_l=x(()=>{Be();dr();mi=class extends St{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new Et(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,r)}}});var j_=x(()=>{C();X_();F.add(vn)});var le,Yr=x(()=>{"use strict";le=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(le||{})});var Y_,q_=x(()=>{"use strict";Y_={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var K_,z,Rt=x(()=>{q_();K_=Y_,z={get(){return K_},set(i){K_=i}}});function fr(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Tn(i){return i.split("?")[0].split("#")[0]}function QR(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JR(i,t,e){return i.replace(new RegExp(QR(t),"g"),e)}function tM(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var ie,Wi=x(()=>{Rt();ie={toPosix(i){return JR(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){fr(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(fr(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Tn(this.toPosix(t??z.get().getBaseUrl())),s=Tn(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?ie.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(fr(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=tM(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return fr(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(fr(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(fr(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){fr(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){fr(i),t&&fr(t),i=Tn(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let h=i.charCodeAt(o);if(h===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(h===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){fr(i),i=Tn(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){fr(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Tn(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,h=-1,l=!0,c=i.length-1,u=0;for(;c>=s;--c){if(e=i.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}h===-1&&(l=!1,h=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&r?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ee,Sn=x(()=>{"use strict";Ee=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Z_(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Z_(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Q_(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Z_(i,s,0,e,r)}else r.push(i);return r}var J_=x(()=>{"use strict"});var zi,yl=x(()=>{"use strict";zi=i=>!Array.isArray(i)});function eM(i){return i.split(".").pop().split("?").shift().split("#").shift()}var We,Is=x(()=>{At();Wi();Sn();J_();yl();We=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return Ee(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&O("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,h;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),h=[a,l]}else{let l=a.map(c=>this._createBundleAssetId(t,c));r.push(...l),h=[...a,...l]}this.add({...o,alias:h,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&O(`[Resolver] already has key: ${o} overwriting`)},Ee(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=Ee(n).map(f=>typeof f=="string"?Q_(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];c.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g<this._parsers.length;g++){let b=this._parsers[g];if(b.test(p)){m=b.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,m={...m,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:u,data:a,format:h,loadParser:l}),d.push(m)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=zi(t);t=Ee(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let h in n){let l=n[h];a[this._extractAssetIdFromBundle(s,h)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=zi(t);t=Ee(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(h=>{let l=o.filter(c=>c[a]?c[a]===h:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=ie.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??eM(t.src),t}};We.RETINA_PREFIX=/@([0-9\.]+)x/});var En,zd=x(()=>{"use strict";En=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var ty,$d,ey=x(()=>{he();vt();ty=class An{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof E?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=An.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=An.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,h=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new it(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new it(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new it(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(h=new it(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new E({source:this.textureSource,frame:a,orig:c,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*An.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*An.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};ty.BATCH_SIZE=1e3;$d=ty});function ry(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=ie.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=ry([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var rM,iy,sy=x(()=>{Yr();Is();zd();C();vt();Wi();ey();rM=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];iy={extension:y.Asset,cache:{test:i=>i instanceof $d,getCacheableAssets:(i,t)=>ry(i,t,!1)},resolver:{extension:{type:y.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&rM.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(We.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:y.LoadParser,priority:le.Normal,name:"spritesheetLoader"},async testParse(i,t){return ie.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=ie.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof E)a=r;else{let c=En(n+(s??i.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let h=new $d(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let c=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=En(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);h.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var bl=x(()=>{C();sy();F.add(iy)});function vl(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var Xd=x(()=>{"use strict"});var se,Tl=x(()=>{Jh();vt();Xd();Dt();_l();se=class i extends mi{constructor(t=E.EMPTY){t instanceof E&&(t={texture:t});let{texture:e=E.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new pe({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof E?new i(t):new i(E.from(t,e))}set texture(t){t||(t=E.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return vl(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return W("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function Sl(i,t,e){let r=iM;i.measurable=!0,Es(i,e,r),t.addBoundsMask(r),i.measurable=!1}var iM,jd=x(()=>{Be();fn();iM=new Et});function El(i,t,e){let r=He.get();i.measurable=!0;let s=Zt.get().identity(),o=oy(i,e,s);ws(i,r,o),i.measurable=!1,t.addBoundsMask(r),Zt.return(s),He.return(r)}function oy(i,t,e){return i?(i!==t&&(oy(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var Yd=x(()=>{nl();ki();At()});var wn,ny=x(()=>{C();Tl();jd();Yd();wn=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof se),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||Sl(this.mask,t,e)}addLocalBounds(t,e){El(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof se}};wn.extension=y.MaskEffect});var Cn,ay=x(()=>{C();Cn=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};Cn.extension=y.MaskEffect});var Pn,hy=x(()=>{C();dr();jd();Yd();Pn=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){Sl(this.mask,t,e)}addLocalBounds(t,e){El(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof St}};Pn.extension=y.MaskEffect});var ye,Fs=x(()=>{Rt();C();Ie();ye=class extends bt{constructor(t){t.resource||(t.resource=z.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};ye.extension=y.TextureSource});var Ge,Gs=x(()=>{Rt();C();At();Ie();Ge=class extends bt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=z.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,O("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Ge.extension=y.TextureSource});async function Al(){return qd??(qd=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),qd}var qd,Kd=x(()=>{"use strict"});var wl,Us,Zd=x(()=>{C();_n();Kd();Ie();wl=class ly extends bt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ly.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Fe.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Al(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Fe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Fe.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Fe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};wl.extension=y.TextureSource;wl.defaultOptions={...bt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};wl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Us=wl});var Qd,xt,gi=x(()=>{At();Sn();Qd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||O(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ee(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(h=>{o.set(h,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{let l=s?s[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&O("[Cache] already has key:",h),this._cache.set(h,o.get(h))})}remove(t){if(!this._cacheMap.has(t)){O(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},xt=new Qd});function cy(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Jd.length;s++){let o=Jd[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function uy(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&xt.has(r))return xt.get(r);let o=new E({source:cy(s)});return o.on("destroy",()=>{xt.has(r)&&xt.remove(r)}),t||xt.set(r,o),o}function dy(i,t=!1){return typeof i=="string"?xt.get(i):i instanceof bt?new E({source:i}):uy(i,t)}var Jd,tf=x(()=>{gi();C();Ie();vt();Jd=[];F.handleByList(y.TextureSource,Jd);E.from=dy;bt.from=cy});var Cl=x(()=>{C();ny();ay();hy();Ad();Fs();Gs();Zd();tf();F.add(wn,Cn,Pn,Us,Ge,ye,Hi)});var ce,xi=x(()=>{"use strict";ce=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Rl(){return(!Pl||Pl?.isContextLost())&&(Pl=z.get().createCanvas().getContext("webgl",{})),Pl}var Pl,ef=x(()=>{Rt()});function oM(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
19
|
+
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${fl}px`,e.style.height=`${fl}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=M_.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new di(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==VR||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}};Ud.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"accessibility"};Ud.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};F_=Ud});var U_,k_=x(()=>{"use strict";U_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var O_=x(()=>{C();dr();G_();k_();G.add(F_);G.mixin(St,U_)});var xn,L_=x(()=>{C();xn=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};xn.extension=y.Application});var pi,pl=x(()=>{"use strict";pi=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(pi||{})});var Bs,D_=x(()=>{"use strict";Bs=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var N_,Fe,_n=x(()=>{pl();D_();N_=class Ve{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Bs(null,null,1/0),this.deltaMS=1/Ve.targetFPMS,this.elapsedMS=1/Ve.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=pi.NORMAL){return this._addListener(new Bs(t,e,r))}addOnce(t,e,r=pi.NORMAL){return this._addListener(new Bs(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ve.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ve.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ve._shared){let t=Ve._shared=new Ve;t.autoStart=!0,t._protected=!0}return Ve._shared}static get system(){if(!Ve._system){let t=Ve._system=new Ve;t.autoStart=!0,t._protected=!0}return Ve._system}};N_.targetFPMS=.06;Fe=N_});var yn,H_=x(()=>{C();pl();_n();yn=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,pi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Fe.shared:new Fe,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};yn.extension=y.Application});var kd=x(()=>{C();L_();H_();G.add(xn);G.add(yn)});var Od,Sr,Ld=x(()=>{pl();_n();Od=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Fe.system.add(this._tickerUpdate,this,pi.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Fe.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Sr=new Od});var jr,ml=x(()=>{Qe();ul();jr=class extends di{constructor(){super(...arguments),this.client=new at,this.movement=new at,this.offset=new at,this.global=new at,this.screen=new at}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}});var Se,Dd=x(()=>{ml();Se=class extends jr{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var Er,Nd=x(()=>{ml();Er=class extends jr{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};Er.DOM_DELTA_PIXEL=0;Er.DOM_DELTA_LINE=1;Er.DOM_DELTA_PAGE=2});var YR,qR,bn,gl,V_=x(()=>{_e();Qe();At();Ld();ml();Dd();Nd();YR=2048,qR=new at,bn=new at,gl=class{constructor(t){this.dispatch=new Pt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else O(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Sr.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,qR.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<YR&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Sr.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:h&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Sr.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let c=h.length-1;c>=0;c--){let u=h[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,bn),!t.hitArea.contains(bn.x,bn.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,bn),t.containsPoint(bn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let h=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,h,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),r&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(o!==e.target){let h=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let h=r.button===2;this.notifyTarget(r,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Se)){O("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Er)){O("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Se);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(Er);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Se);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Se&&e instanceof Se&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof jr&&e instanceof jr&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var KR,ZR,Vd,xl,Wd=x(()=>{C();V_();Ld();Dd();Nd();KR=1,ZR={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Vd=class Hd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new gl(null),Sr.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Se(null),this._rootWheelEvent=new Er(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Hd.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=s,!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(t){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Hd._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Sr.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Sr.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Sr.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!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)):(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;Sr.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!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)):(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(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=KR),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=ZR[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Vd.extension={name:"events",type:[y.WebGLSystem,y.CanvasSystem,y.WebGPUSystem],priority:-1};Vd.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};xl=Vd});var W_,z_=x(()=>{Wd();ul();W_={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??xl.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(i,a,n)}),o?h.once(i,a,n):h.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof di))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var $_=x(()=>{C();dr();Wd();z_();G.add(xl);G.mixin(St,W_)});var vn,X_=x(()=>{C();vn=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,h=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${h}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-h}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};vn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"dom"}});var mi,_l=x(()=>{Be();dr();mi=class extends St{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new Et(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,r)}}});var j_=x(()=>{C();X_();G.add(vn)});var le,Yr=x(()=>{"use strict";le=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(le||{})});var Y_,q_=x(()=>{"use strict";Y_={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var K_,$,Rt=x(()=>{q_();K_=Y_,$={get(){return K_},set(i){K_=i}}});function fr(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Tn(i){return i.split("?")[0].split("#")[0]}function QR(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JR(i,t,e){return i.replace(new RegExp(QR(t),"g"),e)}function tM(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var ie,Wi=x(()=>{Rt();ie={toPosix(i){return JR(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){fr(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(fr(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=Tn(this.toPosix(t??$.get().getBaseUrl())),s=Tn(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?ie.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(fr(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=tM(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return fr(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(fr(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(fr(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){fr(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){fr(i),t&&fr(t),i=Tn(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let h=i.charCodeAt(o);if(h===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(h===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){fr(i),i=Tn(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){fr(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Tn(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,h=-1,l=!0,c=i.length-1,u=0;for(;c>=s;--c){if(e=i.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}h===-1&&(l=!1,h=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&r?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ee,Sn=x(()=>{"use strict";Ee=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Z_(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Z_(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Q_(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Z_(i,s,0,e,r)}else r.push(i);return r}var J_=x(()=>{"use strict"});var zi,yl=x(()=>{"use strict";zi=i=>!Array.isArray(i)});function eM(i){return i.split(".").pop().split("?").shift().split("#").shift()}var We,Is=x(()=>{At();Wi();Sn();J_();yl();We=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return Ee(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&O("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,h;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),h=[a,l]}else{let l=a.map(c=>this._createBundleAssetId(t,c));r.push(...l),h=[...a,...l]}this.add({...o,alias:h,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&O(`[Resolver] already has key: ${o} overwriting`)},Ee(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=Ee(n).map(f=>typeof f=="string"?Q_(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];c.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g<this._parsers.length;g++){let b=this._parsers[g];if(b.test(p)){m=b.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,m={...m,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${m.src}`);m=this._buildResolvedAsset(m,{aliases:u,data:a,format:h,loadParser:l}),d.push(m)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=zi(t);t=Ee(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let h in n){let l=n[h];a[this._extractAssetIdFromBundle(s,h)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=zi(t);t=Ee(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(h=>{let l=o.filter(c=>c[a]?c[a]===h:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=ie.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??eM(t.src),t}};We.RETINA_PREFIX=/@([0-9\.]+)x/});var En,zd=x(()=>{"use strict";En=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var ty,$d,ey=x(()=>{he();vt();ty=class An{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof E?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=An.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=An.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,h=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new st(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new st(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new st(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(h=new st(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new E({source:this.textureSource,frame:a,orig:c,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*An.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*An.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};ty.BATCH_SIZE=1e3;$d=ty});function ry(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=ie.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=ry([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var rM,iy,sy=x(()=>{Yr();Is();zd();C();vt();Wi();ey();rM=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];iy={extension:y.Asset,cache:{test:i=>i instanceof $d,getCacheableAssets:(i,t)=>ry(i,t,!1)},resolver:{extension:{type:y.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&rM.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(We.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:y.LoadParser,priority:le.Normal,name:"spritesheetLoader"},async testParse(i,t){return ie.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=ie.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof E)a=r;else{let c=En(n+(s??i.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let h=new $d(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let c=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=En(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);h.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var bl=x(()=>{C();sy();G.add(iy)});function vl(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var Xd=x(()=>{"use strict"});var se,Tl=x(()=>{Jh();vt();Xd();Dt();_l();se=class i extends mi{constructor(t=E.EMPTY){t instanceof E&&(t={texture:t});let{texture:e=E.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new pe({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof E?new i(t):new i(E.from(t,e))}set texture(t){t||(t=E.EMPTY);let e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return vl(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return z("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function Sl(i,t,e){let r=iM;i.measurable=!0,Es(i,e,r),t.addBoundsMask(r),i.measurable=!1}var iM,jd=x(()=>{Be();fn();iM=new Et});function El(i,t,e){let r=He.get();i.measurable=!0;let s=Zt.get().identity(),o=oy(i,e,s);ws(i,r,o),i.measurable=!1,t.addBoundsMask(r),Zt.return(s),He.return(r)}function oy(i,t,e){return i?(i!==t&&(oy(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(O("Mask bounds, renderable is not inside the root container"),e)}var Yd=x(()=>{nl();ki();At()});var wn,ny=x(()=>{C();Tl();jd();Yd();wn=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof se),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||Sl(this.mask,t,e)}addLocalBounds(t,e){El(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof se}};wn.extension=y.MaskEffect});var Cn,ay=x(()=>{C();Cn=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};Cn.extension=y.MaskEffect});var Pn,hy=x(()=>{C();dr();jd();Yd();Pn=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){Sl(this.mask,t,e)}addLocalBounds(t,e){El(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof St}};Pn.extension=y.MaskEffect});var ye,Fs=x(()=>{Rt();C();Ie();ye=class extends bt{constructor(t){t.resource||(t.resource=$.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};ye.extension=y.TextureSource});var Ge,Gs=x(()=>{Rt();C();At();Ie();Ge=class extends bt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=$.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,O("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Ge.extension=y.TextureSource});async function Al(){return qd??(qd=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),qd}var qd,Kd=x(()=>{"use strict"});var wl,Us,Zd=x(()=>{C();_n();Kd();Ie();wl=class ly extends bt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ly.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Fe.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Al(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Fe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Fe.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Fe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};wl.extension=y.TextureSource;wl.defaultOptions={...bt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};wl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Us=wl});var Qd,xt,gi=x(()=>{At();Sn();Qd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||O(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ee(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(h=>{o.set(h,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{let l=s?s[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&O("[Cache] already has key:",h),this._cache.set(h,o.get(h))})}remove(t){if(!this._cacheMap.has(t)){O(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},xt=new Qd});function cy(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Jd.length;s++){let o=Jd[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function uy(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&xt.has(r))return xt.get(r);let o=new E({source:cy(s)});return o.on("destroy",()=>{xt.has(r)&&xt.remove(r)}),t||xt.set(r,o),o}function dy(i,t=!1){return typeof i=="string"?xt.get(i):i instanceof bt?new E({source:i}):uy(i,t)}var Jd,tf=x(()=>{gi();C();Ie();vt();Jd=[];G.handleByList(y.TextureSource,Jd);E.from=dy;bt.from=cy});var Cl=x(()=>{C();ny();ay();hy();Ad();Fs();Gs();Zd();tf();G.add(wn,Cn,Pn,Us,Ge,ye,Hi)});var ce,xi=x(()=>{"use strict";ce=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Rl(){return(!Pl||Pl?.isContextLost())&&(Pl=$.get().createCanvas().getContext("webgl",{})),Pl}var Pl,ef=x(()=>{Rt()});function oM(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
20
20
|
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function fy(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=sM.replace(/%forloop%/gi,oM(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e)}return i}var sM,py=x(()=>{"use strict";sM=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
21
|
-
`)});function Je(){if(ks)return ks;let i=Rl();return ks=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),ks=fy(ks,i),i.getExtension("WEBGL_lose_context")?.loseContext(),ks}var ks,$i=x(()=>{ef();py();ks=null});function Os(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return my[e]||nM(i,t,e)}function nM(i,t,e){let r={},s=0;rf||(rf=Je());for(let n=0;n<rf;n++){let a=n<t?i[n]:E.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new ce(r);return my[e]=o,o}var my,rf,Ml=x(()=>{xi();vt();$i();my={};rf=0});var Ar,sf=x(()=>{"use strict";Ar=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function Rn(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var of=x(()=>{"use strict"});var gy,It,Xi=x(()=>{"use strict";gy={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},It=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(It||{})});function qr(i,t){return t.alphaMode==="no-premultiply-alpha"&&gy[i]||i}var Mn=x(()=>{Xi()});var Bl,xy=x(()=>{"use strict";Bl=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function _y(){return af>0?by[--af]:new nf}function yy(i){by[af++]=i}var nf,by,af,Bn,vy,Ty,Sy=x(()=>{me();sf();of();Mn();$i();xy();nf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Bl,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},by=[],af=0;Bn=0,vy=class Il{constructor(t={}){this.uid=nt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Il.defaultOptions.maxTextures=Il.defaultOptions.maxTextures??Je(),t={...Il.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ar(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)yy(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=_y(),s=r.textures;s.clear();let o=e[this.elementStart],n=qr(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){let g=e[m];e[m]=null;let _=g.texture._source,v=qr(g.blendMode,_),T=n!==v||a!==g.topology;if(_._batchTick===Bn&&!T){g._textureId=_._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=r;continue}_._batchTick=Bn,(s.count>=p||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=g.topology,r=_y(),s=r.textures,s.clear(),++Bn),g._textureId=_._textureBindLocation=s.count,s.ids[_.uid]=s.count,s.textures[s.count++]=_,g._batch=r,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++Bn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Bn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ar(e);Rn(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Rn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-h}destroy(){for(let t=0;t<this.batches.length;t++)yy(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};vy.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Ty=vy});var st,Kr=x(()=>{"use strict";st=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(st||{})});var Vt,_i=x(()=>{_e();me();Kr();Vt=class extends Pt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=nt("buffer"),this._resourceType="buffer",this._resourceId=nt("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&st.STATIC)}set static(t){t?this.descriptor.usage|=st.STATIC:this.descriptor.usage&=~st.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=nt("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function hf(i,t){if(!(i instanceof Vt)){let e=t?st.INDEX:st.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=st.INDEX|st.COPY_DST):(i=new Float32Array(i),e=st.VERTEX|st.COPY_DST)),i=new Vt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var Ey=x(()=>{_i();Kr()});function Ay(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,c=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=c;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>h&&(h=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var wy=x(()=>{"use strict"});function aM(i){return(i instanceof Vt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=hf(i.buffer,!1),i}var tr,Ls=x(()=>{_e();Be();me();_i();Ey();wy();tr=class extends Pt{constructor(t={}){super(),this.uid=nt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Et,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=aM(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=hf(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Ay(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var hM,lM,Fl,Cy=x(()=>{_i();Kr();Ls();hM=new Float32Array(1),lM=new Uint32Array(1),Fl=class extends tr{constructor(){let e=new Vt({data:hM,label:"attribute-batch-buffer",usage:st.VERTEX|st.COPY_DST,shrinkToFit:!1}),r=new Vt({data:lM,label:"index-batch-buffer",usage:st.INDEX|st.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Zr(i,t){let e=Py[i];return e===void 0&&(lf[t]===void 0&&(lf[t]=1),Py[i]=e=lf[t]++),e}var lf,Py,In=x(()=>{"use strict";lf=Object.create(null),Py=Object.create(null)});function Ry(){if(!Gl){Gl="mediump";let i=Rl();i&&i.getShaderPrecisionFormat&&(Gl=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Gl}var Gl,My=x(()=>{ef()});function By(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
21
|
+
`)});function Je(){if(ks)return ks;let i=Rl();return ks=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),ks=fy(ks,i),i.getExtension("WEBGL_lose_context")?.loseContext(),ks}var ks,$i=x(()=>{ef();py();ks=null});function Os(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return my[e]||nM(i,t,e)}function nM(i,t,e){let r={},s=0;rf||(rf=Je());for(let n=0;n<rf;n++){let a=n<t?i[n]:E.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new ce(r);return my[e]=o,o}var my,rf,Ml=x(()=>{xi();vt();$i();my={};rf=0});var Ar,sf=x(()=>{"use strict";Ar=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function Rn(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var of=x(()=>{"use strict"});var gy,It,Xi=x(()=>{"use strict";gy={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},It=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(It||{})});function qr(i,t){return t.alphaMode==="no-premultiply-alpha"&&gy[i]||i}var Mn=x(()=>{Xi()});var Bl,xy=x(()=>{"use strict";Bl=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function _y(){return af>0?by[--af]:new nf}function yy(i){by[af++]=i}var nf,by,af,Bn,vy,Ty,Sy=x(()=>{me();sf();of();Mn();$i();xy();nf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Bl,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},by=[],af=0;Bn=0,vy=class Il{constructor(t={}){this.uid=nt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Il.defaultOptions.maxTextures=Il.defaultOptions.maxTextures??Je(),t={...Il.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ar(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)yy(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=_y(),s=r.textures;s.clear();let o=e[this.elementStart],n=qr(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){let g=e[m];e[m]=null;let _=g.texture._source,v=qr(g.blendMode,_),T=n!==v||a!==g.topology;if(_._batchTick===Bn&&!T){g._textureId=_._textureBindLocation,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=r;continue}_._batchTick=Bn,(s.count>=p||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=g.topology,r=_y(),s=r.textures,s.clear(),++Bn),g._textureId=_._textureBindLocation=s.count,s.ids[_.uid]=s.count,s.textures[s.count++]=_,g._batch=r,u+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,h,l,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,h,l,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++Bn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Bn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ar(e);Rn(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else Rn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-h}destroy(){for(let t=0;t<this.batches.length;t++)yy(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};vy.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Ty=vy});var ot,Kr=x(()=>{"use strict";ot=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(ot||{})});var Vt,_i=x(()=>{_e();me();Kr();Vt=class extends Pt{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=nt("buffer"),this._resourceType="buffer",this._resourceId=nt("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ot.STATIC)}set static(t){t?this.descriptor.usage|=ot.STATIC:this.descriptor.usage&=~ot.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=nt("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function hf(i,t){if(!(i instanceof Vt)){let e=t?ot.INDEX:ot.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=ot.INDEX|ot.COPY_DST):(i=new Float32Array(i),e=ot.VERTEX|ot.COPY_DST)),i=new Vt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var Ey=x(()=>{_i();Kr()});function Ay(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,c=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=c;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>h&&(h=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var wy=x(()=>{"use strict"});function aM(i){return(i instanceof Vt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=hf(i.buffer,!1),i}var tr,Ls=x(()=>{_e();Be();me();_i();Ey();wy();tr=class extends Pt{constructor(t={}){super(),this.uid=nt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Et,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=aM(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=hf(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Ay(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var hM,lM,Fl,Cy=x(()=>{_i();Kr();Ls();hM=new Float32Array(1),lM=new Uint32Array(1),Fl=class extends tr{constructor(){let e=new Vt({data:hM,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:!1}),r=new Vt({data:lM,label:"index-batch-buffer",usage:ot.INDEX|ot.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Zr(i,t){let e=Py[i];return e===void 0&&(lf[t]===void 0&&(lf[t]=1),Py[i]=e=lf[t]++),e}var lf,Py,In=x(()=>{"use strict";lf=Object.create(null),Py=Object.create(null)});function Ry(){if(!Gl){Gl="mediump";let i=Rl();i&&i.getShaderPrecisionFormat&&(Gl=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Gl}var Gl,My=x(()=>{ef()});function By(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
|
|
22
22
|
|
|
23
23
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
24
24
|
#define in varying
|
|
@@ -250,7 +250,7 @@ ${s.join(`
|
|
|
250
250
|
{
|
|
251
251
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
252
252
|
}
|
|
253
|
-
`}}});var vf,bb,vb=x(()=>{"use strict";vf=["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>"],bb=vf.reduce((i,t)=>(i[t]=!0,i),{})});function Tb(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Sb=x(()=>{"use strict"});var Eb,wt,Ae=x(()=>{me();In();vb();Sb();Eb=class Ab{constructor(t,e){this._touched=0,this.uid=nt("uniform"),this._resourceType="uniformGroup",this._resourceId=nt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Ab.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!bb[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${vf.join(", ")}`);o.value??(o.value=Tb(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Zr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Eb.defaultOptions={ubo:!1,isStatic:!1};wt=Eb});function $s(i){let t=wb[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=wb[i]=new wt({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var wb,kl=x(()=>{Ae();wb={}});var Qt,Mr=x(()=>{"use strict";Qt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Qt||{})});var Wt,pr=x(()=>{_e();me();ji();xi();Ns();Mr();Ae();Wt=class i extends Pt{constructor(t){super(),this.uid=nt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Qt.WEBGPU),r&&(n|=Qt.WEBGL)),this.compatibleRenderers=n;let h={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let l in a)for(let c in a[l]){let u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u});let l=0;for(let c in o)h[c]||(s[99]||(s[99]=new ce,this._ownedBindGroups.push(s[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new wt(d));let f=h[u];f&&(s[f.group]||(s[f.group]=new ce,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,h)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new ce,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=rr.from(e)),r&&(n=er.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Ol,Cb=x(()=>{bi();Fn();Gn();vi();kl();pr();Ol=class extends Wt{constructor(t){let e=Cr({name:"batch",bits:[Vs,zs(t),Rr]}),r=wr({name:"batch",bits:[Hs,Ws(t),Pr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:$s(t)}})}}});var Pb,Rb,Un,Tf=x(()=>{C();Sy();Cy();Cb();Pb=null,Rb=class Mb extends Ty{constructor(){super(...arguments),this.geometry=new Fl,this.shader=Pb||(Pb=new Ol(this.maxTextures)),this.name=Mb.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=t,g=t.color,b=t.attributeOffset,_=b+t.attributeSize;for(let v=b;v<_;v++){let T=v*2,w=p[T],S=p[T+1];e[s++]=h*w+c*S+d,e[s++]=u*S+l*w+f,e[s++]=m[T],e[s++]=m[T+1],r[s++]=g,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,m=p.maxX,g=p.minX,b=p.maxY,_=p.minY,v=n.uvs,T=t.color,w=o<<16|t.roundPixels&65535;e[s+0]=h*g+c*_+d,e[s+1]=u*_+l*g+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=w,e[s+6]=h*m+c*_+d,e[s+7]=u*_+l*m+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=w,e[s+12]=h*m+c*b+d,e[s+13]=u*b+l*m+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=w,e[s+18]=h*g+c*b+d,e[s+19]=u*b+l*g+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=w}};Rb.extension={type:[y.Batcher],name:"default"};Un=Rb});function Bb(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;h<n;){let m=i[e],g=i[e+1];r[s]=l*m+u*g+f,r[s+1]=c*m+d*g+p,s+=o,e+=t,h++}}function Ib(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var Fb=x(()=>{"use strict"});function Sf(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],p=i[u+1];i[u]=o*f+a*p+l,i[u+1]=n*f+h*p+c,u+=r}}var Gb=x(()=>{"use strict"});var vM,qi,Ef=x(()=>{dt();md();vM=new B,qi=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?ol(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||vM}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var Xs,Ub,kb,Ob=x(()=>{C();Xs={extension:{type:y.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,w=T.width/2,S=T.height/2;e=T.x+w,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(w,S))),s=w-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return t;if(h===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let c=0,u=h*4+(s?2:0)+2,d=u,f=l,p=s+n,m=o,g=e+p,b=e-p,_=r+m;if(t[c++]=g,t[c++]=_,t[--u]=_,t[--u]=b,o){let T=r-m;t[d++]=b,t[d++]=T,t[--f]=T,t[--f]=g}for(let T=1;T<h;T++){let w=Math.PI/2*(T/h),S=s+Math.cos(w)*n,A=o+Math.sin(w)*a,M=e+S,P=e-S,R=r+A,I=r-A;t[c++]=M,t[c++]=R,t[--u]=R,t[--u]=P,t[d++]=P,t[d++]=I,t[--f]=I,t[--f]=M}p=s,m=o+a,g=e+p,b=e-p,_=r+m;let v=r-m;return t[c++]=g,t[c++]=_,t[--f]=v,t[--f]=g,s&&(t[c++]=b,t[c++]=_,t[--f]=v,t[--f]=b),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let c=0;c<i.length;c+=2)n+=i[c],a+=i[c+1];n/=i.length/2,a/=i.length/2;let h=r;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let c=0;c<i.length;c+=2)t[h*e]=i[c],t[h*e+1]=i[c+1],c>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1}},Ub={...Xs,extension:{...Xs.extension,name:"ellipse"}},kb={...Xs,extension:{...Xs.extension,name:"roundedRectangle"}}});function Lb(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Db=x(()=>{"use strict"});function Nb(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,c=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let p=h+d,m=l+f,g=c+d,b=u+f;return a.push(p,m),a.push(g,b),2}function Ki(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,c=Math.atan2(h,l),u=Math.atan2(s-i,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,b=f/g;if(d+=b,a){n.push(i,t),n.push(e,r);for(let _=1,v=d;_<g;_++,v+=b)n.push(i,t),n.push(i+Math.sin(v)*m,t+Math.cos(v)*m);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let _=1,v=d;_<g;_++,v+=b)n.push(i+Math.sin(v)*m,t+Math.cos(v)*m),n.push(i,t);n.push(s,o),n.push(i,t)}return g*2}function Hb(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let U=Lb(i);e&&(U*=-1),h=(h-.5)*U+.5}let l=new at(i[0],i[1]),c=new at(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),c.set(i[i.length-2],i[i.length-1]));let U=(l.x+c.x)*.5,tt=(c.y+l.y)*.5;i.unshift(U,tt),i.push(U,tt)}let f=s,p=i.length/2,m=i.length,g=f.length/2,b=a.width/2,_=b*b,v=a.miterLimit*a.miterLimit,T=i[0],w=i[1],S=i[2],A=i[3],M=0,P=0,R=-(w-A),I=T-S,k=0,j=0,N=Math.sqrt(R*R+I*I);R/=N,I/=N,R*=b,I*=b;let ot=h,L=(1-ot)*2,$=ot*2;u||(a.cap==="round"?m+=Ki(T-R*(L-$)*.5,w-I*(L-$)*.5,T-R*L,w-I*L,T+R*$,w+I*$,f,!0)+2:a.cap==="square"&&(m+=Nb(T,w,R,I,L,$,!0,f))),f.push(T-R*L,w-I*L),f.push(T+R*$,w+I*$);for(let U=1;U<p-1;++U){T=i[(U-1)*2],w=i[(U-1)*2+1],S=i[U*2],A=i[U*2+1],M=i[(U+1)*2],P=i[(U+1)*2+1],R=-(w-A),I=T-S,N=Math.sqrt(R*R+I*I),R/=N,I/=N,R*=b,I*=b,k=-(A-P),j=S-M,N=Math.sqrt(k*k+j*j),k/=N,j/=N,k*=b,j*=b;let tt=S-T,yt=w-A,mt=S-M,Ot=P-A,Lt=tt*mt+yt*Ot,Yt=yt*mt-Ot*tt,re=Yt<0;if(Math.abs(Yt)<.001*Math.abs(Lt)){f.push(S-R*L,A-I*L),f.push(S+R*$,A+I*$),Lt>=0&&(a.join==="round"?m+=Ki(S,A,S-R*L,A-I*L,S-k*L,A-j*L,f,!1)+4:m+=2,f.push(S-k*$,A-j*$),f.push(S+k*L,A+j*L));continue}let ge=(-R+T)*(-I+A)-(-R+S)*(-I+w),Tt=(-k+M)*(-j+A)-(-k+S)*(-j+P),ct=(tt*Tt-mt*ge)/Yt,gt=(Ot*ge-yt*Tt)/Yt,Ft=(ct-S)*(ct-S)+(gt-A)*(gt-A),qt=S+(ct-S)*L,Kt=A+(gt-A)*L,Me=S-(ct-S)*$,Fi=A-(gt-A)*$,pR=Math.min(tt*tt+yt*yt,mt*mt+Ot*Ot),hx=re?L:$,mR=pR+hx*hx*_;Ft<=mR?a.join==="bevel"||Ft/_>v?(re?(f.push(qt,Kt),f.push(S+R*$,A+I*$),f.push(qt,Kt),f.push(S+k*$,A+j*$)):(f.push(S-R*L,A-I*L),f.push(Me,Fi),f.push(S-k*L,A-j*L),f.push(Me,Fi)),m+=2):a.join==="round"?re?(f.push(qt,Kt),f.push(S+R*$,A+I*$),m+=Ki(S,A,S+R*$,A+I*$,S+k*$,A+j*$,f,!0)+4,f.push(qt,Kt),f.push(S+k*$,A+j*$)):(f.push(S-R*L,A-I*L),f.push(Me,Fi),m+=Ki(S,A,S-R*L,A-I*L,S-k*L,A-j*L,f,!1)+4,f.push(S-k*L,A-j*L),f.push(Me,Fi)):(f.push(qt,Kt),f.push(Me,Fi)):(f.push(S-R*L,A-I*L),f.push(S+R*$,A+I*$),a.join==="round"?re?m+=Ki(S,A,S+R*$,A+I*$,S+k*$,A+j*$,f,!0)+2:m+=Ki(S,A,S-R*L,A-I*L,S-k*L,A-j*L,f,!1)+2:a.join==="miter"&&Ft/_<=v&&(re?(f.push(Me,Fi),f.push(Me,Fi)):(f.push(qt,Kt),f.push(qt,Kt)),m+=2),f.push(S-k*L,A-j*L),f.push(S+k*$,A+j*$),m+=2)}T=i[(p-2)*2],w=i[(p-2)*2+1],S=i[(p-1)*2],A=i[(p-1)*2+1],R=-(w-A),I=T-S,N=Math.sqrt(R*R+I*I),R/=N,I/=N,R*=b,I*=b,f.push(S-R*L,A-I*L),f.push(S+R*$,A+I*$),u||(a.cap==="round"?m+=Ki(S-R*(L-$)*.5,A-I*(L-$)*.5,S-R*L,A-I*L,S+R*$,A+I*$,f,!1)+2:a.cap==="square"&&(m+=Nb(S,A,R,I,L,$,!1,f)));let H=1e-4*1e-4;for(let U=g;U<m+g-2;++U)T=f[U*2],w=f[U*2+1],S=f[(U+1)*2],A=f[(U+1)*2+1],M=f[(U+2)*2],P=f[(U+2)*2+1],!(Math.abs(T*(A-P)+S*(P-w)+M*(w-A))<H)&&o.push(U,U+1,U+2)}var Vb=x(()=>{Qe();Db()});function Wb(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],h=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,c=e,u=i.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(i[f*2]),c.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var zb=x(()=>{});var Vl=K((W4,Pf)=>{"use strict";Pf.exports=Nl;Pf.exports.default=Nl;function Nl(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Xb(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,d,f;if(r&&(o=PM(i,t,o,e)),i.length>80*e){a=l=i[0],h=c=i[1];for(var p=e;p<s;p+=e)u=i[p],d=i[p+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return kn(o,n,e,a,h,f,0),n}function Xb(i,t,e,r,s){var o,n;if(s===Cf(i,t,e,r)>0)for(o=t;o<e;o+=r)n=$b(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=$b(o,i[o],i[o+1],n);return n&&Hl(n,n.next)&&(Ln(n),n=n.next),n}function Zi(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(Hl(e,e.next)||Ht(e.prev,e,e.next)===0)){if(Ln(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function kn(i,t,e,r,s,o,n){if(i){!n&&o&&FM(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?AM(i,r,s,o):EM(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Ln(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=wM(Zi(i),t,e),kn(i,t,e,r,s,o,2)):n===2&&CM(i,t,e,r,s,o):kn(Zi(i),t,e,r,s,o,1);break}}}}function EM(i){var t=i.prev,e=i,r=i.next;if(Ht(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,c=s<o?s<n?s:n:o<n?o:n,u=a<h?a<l?a:l:h<l?h:l,d=s>o?s>n?s:n:o>n?o:n,f=a>h?a>l?a:l:h>l?h:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&js(s,a,o,h,n,l,p.x,p.y)&&Ht(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function AM(i,t,e,r){var s=i.prev,o=i,n=i.next;if(Ht(s,o,n)>=0)return!1;for(var a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,d=n.y,f=a<h?a<l?a:l:h<l?h:l,p=c<u?c<d?c:d:u<d?u:d,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,b=Af(f,p,t,e,r),_=Af(m,g,t,e,r),v=i.prevZ,T=i.nextZ;v&&v.z>=b&&T&&T.z<=_;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==n&&js(a,c,h,u,l,d,v.x,v.y)&&Ht(v.prev,v,v.next)>=0||(v=v.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&js(a,c,h,u,l,d,T.x,T.y)&&Ht(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;v&&v.z>=b;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==n&&js(a,c,h,u,l,d,v.x,v.y)&&Ht(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;T&&T.z<=_;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&js(a,c,h,u,l,d,T.x,T.y)&&Ht(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function wM(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!Hl(s,o)&&jb(s,r,r.next,o)&&On(s,o)&&On(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Ln(r),Ln(r.next),r=i=o),r=r.next}while(r!==i);return Zi(r)}function CM(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&kM(n,a)){var h=Yb(n,a);n=Zi(n,n.next),h=Zi(h,h.next),kn(n,t,e,r,s,o,0),kn(h,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function PM(i,t,e,r){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=Xb(i,a,h,r,!1),l===l.next&&(l.steiner=!0),s.push(UM(l));for(s.sort(RM),o=0;o<s.length;o++)e=MM(s[o],e);return e}function RM(i,t){return i.x-t.x}function MM(i,t){var e=BM(i,t);if(!e)return t;var r=Yb(e,i);return Zi(r,r.next),Zi(e,e.next)}function BM(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var h=n,l=n.x,c=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&js(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),On(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&IM(n,e)))&&(n=e,u=d)),e=e.next;while(e!==h);return n}function IM(i,t){return Ht(i.prev,i,t.prev)<0&&Ht(t.next,i,i.next)<0}function FM(i,t,e,r){var s=i;do s.z===0&&(s.z=Af(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,GM(s)}function GM(i){var t,e,r,s,o,n,a,h,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(h=l;a>0||h>0&&r;)a!==0&&(h===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function Af(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function UM(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function js(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function kM(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!OM(i,t)&&(On(i,t)&&On(t,i)&&LM(i,t)&&(Ht(i.prev,i,t.prev)||Ht(i,t.prev,t))||Hl(i,t)&&Ht(i.prev,i,i.next)>0&&Ht(t.prev,t,t.next)>0)}function Ht(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Hl(i,t){return i.x===t.x&&i.y===t.y}function jb(i,t,e,r){var s=Dl(Ht(i,t,e)),o=Dl(Ht(i,t,r)),n=Dl(Ht(e,r,i)),a=Dl(Ht(e,r,t));return!!(s!==o&&n!==a||s===0&&Ll(i,e,t)||o===0&&Ll(i,r,t)||n===0&&Ll(e,i,r)||a===0&&Ll(e,t,r))}function Ll(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Dl(i){return i>0?1:i<0?-1:0}function OM(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&jb(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function On(i,t){return Ht(i.prev,i,i.next)<0?Ht(i,t,i.next)>=0&&Ht(i,i.prev,t)>=0:Ht(i,t,i.prev)<0||Ht(i,i.next,t)<0}function LM(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function Yb(i,t){var e=new wf(i.i,i.x,i.y),r=new wf(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function $b(i,t,e,r){var s=new wf(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Ln(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function wf(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Nl.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(Cf(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:i.length;n-=Math.abs(Cf(i,l,c,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function Cf(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Nl.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function Wl(i,t,e,r,s,o,n){let a=(0,qb.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let h=s*r;for(let l=0;l<i.length;l+=2)e[h]=i[l],e[h+1]=i[l+1],h+=r}var qb,Rf=x(()=>{qb=Gi(Vl(),1)});var DM,Kb,Zb=x(()=>{C();Rf();DM=[],Kb={extension:{type:y.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Wl(i,DM,t,e,r,s,o)}}});var Qb,Jb=x(()=>{C();Qb={extension:{type:y.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var tv,ev=x(()=>{C();tv={extension:{type:y.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function iv(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function sv(i,t){let e=z.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function NM(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(W("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??ke.defaultLinearOptions.textureSize}),t}var rv,Bf,ke,Ys=x(()=>{fe();Rt();dt();Gs();vt();me();Dt();vd();rv=[{offset:0,color:"white"},{offset:1,color:"black"}],Bf=class Mf{constructor(...t){this.uid=nt("fillGradient"),this.type="linear",this.colorStops=[];let e=NM(t);e={...e.type==="radial"?Mf.defaultRadialOptions:Mf.defaultLinearOptions,...al(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:et.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=r,r=g,o*=-1}if(n<0){let g=e;e=s,s=g,n*=-1}}let h=this.colorStops.length?this.colorStops:rv,l=this._textureSize,{canvas:c,context:u}=sv(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);iv(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new E({source:new Ge({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new B;m.scale(f/l,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(l,l),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:rv,e=this._textureSize,{canvas:r,context:s}=sv(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,d=h-c,f=e/(c*2),p=(o-u)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,l*f,(a-u)*f,(h-d)*f,c*f);iv(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new E({source:new Ge({resource:r,addressMode:this._wrapMode})});let b=new B;b.scale(1/f,1/f),b.translate(u,d),this.textureSpace==="local"&&b.scale(e,e),this.transform=b}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Bf.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Bf.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ke=Bf});function ov(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(VM);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,c=1/n.height,u=-a*l,d=-h*c,f=s.a,p=s.b,m=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*g+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof ke)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(HM.copyFrom(r).invert()),s}var HM,VM,nv=x(()=>{dt();he();Ys();HM=new B,VM=new it});function hv(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")$M(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,h=o.data.style,l=o.data.hole;n&&l&&av(l.shapePath,h,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),av(a,h,n,r,e)}}}function $M(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=zl.rectangle,c=WM,u=i.image;c.x=i.dx,c.y=i.dy,c.width=i.dw,c.height=i.dh;let d=i.transform;l.build(c,h),d&&Sf(h,d),l.triangulate(h,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=J.get(qi);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=r.length/2-a,p.baseColor=i.style,p.alpha=i.alpha,p.texture=u,p.geometryData=e,t.push(p)}function av(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=zl[h.type],m="triangle-list";if(p.build(h,f),l&&Sf(f,l),e){let v=h.closePath??!0,T=t;T.pixelLine?(Wb(f,v,o,a),m="line-list"):Hb(f,T,!1,v,o,a)}else if(c){let v=[],T=f.slice();XM(c).forEach(S=>{v.push(T.length/2),T.push(...S)}),Wl(T,v,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let g=n.length/2,b=t.texture;if(b!==E.WHITE){let v=ov(zM,t,h,l);Bb(o,2,d,n,g,2,o.length/2-d,v)}else Ib(n,g,2,o.length/2-d);let _=J.get(qi);_.indexOffset=u,_.indexSize=a.length-u,_.attributeOffset=d,_.attributeSize=o.length/2-d,_.baseColor=t.color,_.alpha=t.alpha,_.texture=b,_.geometryData=s,_.topology=m,r.push(_)})}function XM(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];zl[r.type].build(r,s),t.push(s)}return t}var zl,WM,zM,lv=x(()=>{C();dt();he();Fb();Gb();vt();Te();Ef();Ob();Vb();zb();Zb();Jb();ev();nv();Rf();zl={};F.handleByMap(y.ShapeBuilder,zl);F.add(Qb,Kb,tv,Xs,Ub,kb);WM=new it,zM=new B});var If,Ff,Uf,qs,$l=x(()=>{C();Ml();Tf();yd();Dt();Te();lv();If=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Ff=class{constructor(){this.batcher=new Un,this.instructions=new Cs}init(){this.instructions.reset()}get geometry(){return W(Rx,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Uf=class Gf{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Gf.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Gf.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),hv(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=J.get(Ff),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<r.length;c++)r[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<r.length;c++){let u=r[c];a.add(u)}a.finish(e.instructions);let h=a.geometry;h.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),h.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let c=0;c<l.length;c++){let u=l[c];u.bindGroup=Os(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new If;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(J.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{J.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Uf.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"graphicsContext"};Uf.defaultOptions={bezierSmoothness:.5};qs=Uf});var jM,kf,Of,Lf,Df,Nf,Hf,Vf,$t,mr=x(()=>{"use strict";jM={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},kf=0,Of=1,Lf=2,Df=3,Nf=4,Hf=5,Vf=class cv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<kf)}set blend(t){!!(this.data&1<<kf)!==t&&(this.data^=1<<kf)}get offsets(){return!!(this.data&1<<Of)}set offsets(t){!!(this.data&1<<Of)!==t&&(this.data^=1<<Of)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Lf)}set culling(t){!!(this.data&1<<Lf)!==t&&(this.data^=1<<Lf)}get depthTest(){return!!(this.data&1<<Df)}set depthTest(t){!!(this.data&1<<Df)!==t&&(this.data^=1<<Df)}get depthMask(){return!!(this.data&1<<Hf)}set depthMask(t){!!(this.data&1<<Hf)!==t&&(this.data^=1<<Hf)}get clockwiseFrontFace(){return!!(this.data&1<<Nf)}set clockwiseFrontFace(t){!!(this.data&1<<Nf)!==t&&(this.data^=1<<Nf)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=jM[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new cv;return t.depthTest=!1,t.blend=!0,t}};Vf.default2d=Vf.for2d();$t=Vf});function Br(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var Ks=x(()=>{"use strict"});var Dn,uv=x(()=>{C();mr();Te();Ks();Ef();Dn=class{constructor(t,e){this.state=$t.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Br(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=J.get(qi);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{J.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};Dn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"graphics"}});var Wf=x(()=>{C();$l();uv();F.add(Dn);F.add(qs)});var Ti,Xl=x(()=>{"use strict";Ti=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var Nn,dv=x(()=>{C();dt();xi();Ae();Mn();Te();Ks();Xl();Nn=class{constructor(t,e){this.localUniforms=new wt({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new ce({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(J.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=qr(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Br(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=J.get(Ti);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&J.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};Nn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"mesh"}});var zf=x(()=>{C();dv();F.add(Nn)});var jl,fv=x(()=>{"use strict";jl=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function $f(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var pv=x(()=>{"use strict"});function gv(i){return{dynamicUpdate:mv(i,!0),staticUpdate:mv(i,!1)}}function mv(i,t){let e=[];e.push(`
|
|
253
|
+
`}}});var vf,bb,vb=x(()=>{"use strict";vf=["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>"],bb=vf.reduce((i,t)=>(i[t]=!0,i),{})});function Tb(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Sb=x(()=>{"use strict"});var Eb,wt,Ae=x(()=>{me();In();vb();Sb();Eb=class Ab{constructor(t,e){this._touched=0,this.uid=nt("uniform"),this._resourceType="uniformGroup",this._resourceId=nt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Ab.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!bb[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${vf.join(", ")}`);o.value??(o.value=Tb(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Zr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Eb.defaultOptions={ubo:!1,isStatic:!1};wt=Eb});function $s(i){let t=wb[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=wb[i]=new wt({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var wb,kl=x(()=>{Ae();wb={}});var Qt,Mr=x(()=>{"use strict";Qt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(Qt||{})});var Wt,pr=x(()=>{_e();me();ji();xi();Ns();Mr();Ae();Wt=class i extends Pt{constructor(t){super(),this.uid=nt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=Qt.WEBGPU),r&&(n|=Qt.WEBGL)),this.compatibleRenderers=n;let h={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(let l in a)for(let c in a[l]){let u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u});let l=0;for(let c in o)h[c]||(s[99]||(s[99]=new ce,this._ownedBindGroups.push(s[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new wt(d));let f=h[u];f&&(s[f.group]||(s[f.group]=new ce,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,h)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new ce,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=rr.from(e)),r&&(n=er.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Ol,Cb=x(()=>{bi();Fn();Gn();vi();kl();pr();Ol=class extends Wt{constructor(t){let e=Cr({name:"batch",bits:[Vs,zs(t),Rr]}),r=wr({name:"batch",bits:[Hs,Ws(t),Pr]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:$s(t)}})}}});var Pb,Rb,Un,Tf=x(()=>{C();Sy();Cy();Cb();Pb=null,Rb=class Mb extends Ty{constructor(){super(...arguments),this.geometry=new Fl,this.shader=Pb||(Pb=new Ol(this.maxTextures)),this.name=Mb.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=t,g=t.color,b=t.attributeOffset,_=b+t.attributeSize;for(let v=b;v<_;v++){let T=v*2,A=p[T],S=p[T+1];e[s++]=h*A+c*S+d,e[s++]=u*S+l*A+f,e[s++]=m[T],e[s++]=m[T+1],r[s++]=g,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,m=p.maxX,g=p.minX,b=p.maxY,_=p.minY,v=n.uvs,T=t.color,A=o<<16|t.roundPixels&65535;e[s+0]=h*g+c*_+d,e[s+1]=u*_+l*g+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=T,r[s+5]=A,e[s+6]=h*m+c*_+d,e[s+7]=u*_+l*m+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=T,r[s+11]=A,e[s+12]=h*m+c*b+d,e[s+13]=u*b+l*m+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=T,r[s+17]=A,e[s+18]=h*g+c*b+d,e[s+19]=u*b+l*g+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=T,r[s+23]=A}};Rb.extension={type:[y.Batcher],name:"default"};Un=Rb});function Bb(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;h<n;){let m=i[e],g=i[e+1];r[s]=l*m+u*g+f,r[s+1]=c*m+d*g+p,s+=o,e+=t,h++}}function Ib(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var Fb=x(()=>{"use strict"});function Sf(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],p=i[u+1];i[u]=o*f+a*p+l,i[u+1]=n*f+h*p+c,u+=r}}var Gb=x(()=>{"use strict"});var vM,qi,Ef=x(()=>{dt();md();vM=new I,qi=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?ol(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||vM}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var Xs,Ub,kb,Ob=x(()=>{C();Xs={extension:{type:y.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,A=T.width/2,S=T.height/2;e=T.x+A,r=T.y+S,n=a=Math.max(0,Math.min(T.radius,Math.min(A,S))),s=A-n,o=S-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return t;if(h===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let c=0,u=h*4+(s?2:0)+2,d=u,f=l,p=s+n,m=o,g=e+p,b=e-p,_=r+m;if(t[c++]=g,t[c++]=_,t[--u]=_,t[--u]=b,o){let T=r-m;t[d++]=b,t[d++]=T,t[--f]=T,t[--f]=g}for(let T=1;T<h;T++){let A=Math.PI/2*(T/h),S=s+Math.cos(A)*n,w=o+Math.sin(A)*a,M=e+S,P=e-S,R=r+w,B=r-w;t[c++]=M,t[c++]=R,t[--u]=R,t[--u]=P,t[d++]=P,t[d++]=B,t[--f]=B,t[--f]=M}p=s,m=o+a,g=e+p,b=e-p,_=r+m;let v=r-m;return t[c++]=g,t[c++]=_,t[--f]=v,t[--f]=g,s&&(t[c++]=b,t[c++]=_,t[--f]=v,t[--f]=b),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let c=0;c<i.length;c+=2)n+=i[c],a+=i[c+1];n/=i.length/2,a/=i.length/2;let h=r;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let c=0;c<i.length;c+=2)t[h*e]=i[c],t[h*e+1]=i[c+1],c>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1}},Ub={...Xs,extension:{...Xs.extension,name:"ellipse"}},kb={...Xs,extension:{...Xs.extension,name:"roundedRectangle"}}});function Lb(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Db=x(()=>{"use strict"});function Nb(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,c=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let p=h+d,m=l+f,g=c+d,b=u+f;return a.push(p,m),a.push(g,b),2}function Ki(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,c=Math.atan2(h,l),u=Math.atan2(s-i,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,b=f/g;if(d+=b,a){n.push(i,t),n.push(e,r);for(let _=1,v=d;_<g;_++,v+=b)n.push(i,t),n.push(i+Math.sin(v)*m,t+Math.cos(v)*m);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let _=1,v=d;_<g;_++,v+=b)n.push(i+Math.sin(v)*m,t+Math.cos(v)*m),n.push(i,t);n.push(s,o),n.push(i,t)}return g*2}function Hb(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let k=Lb(i);e&&(k*=-1),h=(h-.5)*k+.5}let l=new at(i[0],i[1]),c=new at(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),c.set(i[i.length-2],i[i.length-1]));let k=(l.x+c.x)*.5,tt=(c.y+l.y)*.5;i.unshift(k,tt),i.push(k,tt)}let f=s,p=i.length/2,m=i.length,g=f.length/2,b=a.width/2,_=b*b,v=a.miterLimit*a.miterLimit,T=i[0],A=i[1],S=i[2],w=i[3],M=0,P=0,R=-(A-w),B=T-S,F=0,W=0,D=Math.sqrt(R*R+B*B);R/=D,B/=D,R*=b,B*=b;let it=h,L=(1-it)*2,X=it*2;u||(a.cap==="round"?m+=Ki(T-R*(L-X)*.5,A-B*(L-X)*.5,T-R*L,A-B*L,T+R*X,A+B*X,f,!0)+2:a.cap==="square"&&(m+=Nb(T,A,R,B,L,X,!0,f))),f.push(T-R*L,A-B*L),f.push(T+R*X,A+B*X);for(let k=1;k<p-1;++k){T=i[(k-1)*2],A=i[(k-1)*2+1],S=i[k*2],w=i[k*2+1],M=i[(k+1)*2],P=i[(k+1)*2+1],R=-(A-w),B=T-S,D=Math.sqrt(R*R+B*B),R/=D,B/=D,R*=b,B*=b,F=-(w-P),W=S-M,D=Math.sqrt(F*F+W*W),F/=D,W/=D,F*=b,W*=b;let tt=S-T,yt=A-w,mt=S-M,Ot=P-w,Lt=tt*mt+yt*Ot,Yt=yt*mt-Ot*tt,re=Yt<0;if(Math.abs(Yt)<.001*Math.abs(Lt)){f.push(S-R*L,w-B*L),f.push(S+R*X,w+B*X),Lt>=0&&(a.join==="round"?m+=Ki(S,w,S-R*L,w-B*L,S-F*L,w-W*L,f,!1)+4:m+=2,f.push(S-F*X,w-W*X),f.push(S+F*L,w+W*L));continue}let ge=(-R+T)*(-B+w)-(-R+S)*(-B+A),Tt=(-F+M)*(-W+w)-(-F+S)*(-W+P),ct=(tt*Tt-mt*ge)/Yt,gt=(Ot*ge-yt*Tt)/Yt,Ft=(ct-S)*(ct-S)+(gt-w)*(gt-w),qt=S+(ct-S)*L,Kt=w+(gt-w)*L,Me=S-(ct-S)*X,Fi=w-(gt-w)*X,pR=Math.min(tt*tt+yt*yt,mt*mt+Ot*Ot),hx=re?L:X,mR=pR+hx*hx*_;Ft<=mR?a.join==="bevel"||Ft/_>v?(re?(f.push(qt,Kt),f.push(S+R*X,w+B*X),f.push(qt,Kt),f.push(S+F*X,w+W*X)):(f.push(S-R*L,w-B*L),f.push(Me,Fi),f.push(S-F*L,w-W*L),f.push(Me,Fi)),m+=2):a.join==="round"?re?(f.push(qt,Kt),f.push(S+R*X,w+B*X),m+=Ki(S,w,S+R*X,w+B*X,S+F*X,w+W*X,f,!0)+4,f.push(qt,Kt),f.push(S+F*X,w+W*X)):(f.push(S-R*L,w-B*L),f.push(Me,Fi),m+=Ki(S,w,S-R*L,w-B*L,S-F*L,w-W*L,f,!1)+4,f.push(S-F*L,w-W*L),f.push(Me,Fi)):(f.push(qt,Kt),f.push(Me,Fi)):(f.push(S-R*L,w-B*L),f.push(S+R*X,w+B*X),a.join==="round"?re?m+=Ki(S,w,S+R*X,w+B*X,S+F*X,w+W*X,f,!0)+2:m+=Ki(S,w,S-R*L,w-B*L,S-F*L,w-W*L,f,!1)+2:a.join==="miter"&&Ft/_<=v&&(re?(f.push(Me,Fi),f.push(Me,Fi)):(f.push(qt,Kt),f.push(qt,Kt)),m+=2),f.push(S-F*L,w-W*L),f.push(S+F*X,w+W*X),m+=2)}T=i[(p-2)*2],A=i[(p-2)*2+1],S=i[(p-1)*2],w=i[(p-1)*2+1],R=-(A-w),B=T-S,D=Math.sqrt(R*R+B*B),R/=D,B/=D,R*=b,B*=b,f.push(S-R*L,w-B*L),f.push(S+R*X,w+B*X),u||(a.cap==="round"?m+=Ki(S-R*(L-X)*.5,w-B*(L-X)*.5,S-R*L,w-B*L,S+R*X,w+B*X,f,!1)+2:a.cap==="square"&&(m+=Nb(S,w,R,B,L,X,!1,f)));let H=1e-4*1e-4;for(let k=g;k<m+g-2;++k)T=f[k*2],A=f[k*2+1],S=f[(k+1)*2],w=f[(k+1)*2+1],M=f[(k+2)*2],P=f[(k+2)*2+1],!(Math.abs(T*(w-P)+S*(P-A)+M*(A-w))<H)&&o.push(k,k+1,k+2)}var Vb=x(()=>{Qe();Db()});function Wb(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],h=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,c=e,u=i.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(i[f*2]),c.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var zb=x(()=>{});var Vl=K((W4,Pf)=>{"use strict";Pf.exports=Nl;Pf.exports.default=Nl;function Nl(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Xb(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,d,f;if(r&&(o=PM(i,t,o,e)),i.length>80*e){a=l=i[0],h=c=i[1];for(var p=e;p<s;p+=e)u=i[p],d=i[p+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return kn(o,n,e,a,h,f,0),n}function Xb(i,t,e,r,s){var o,n;if(s===Cf(i,t,e,r)>0)for(o=t;o<e;o+=r)n=$b(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=$b(o,i[o],i[o+1],n);return n&&Hl(n,n.next)&&(Ln(n),n=n.next),n}function Zi(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(Hl(e,e.next)||Ht(e.prev,e,e.next)===0)){if(Ln(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function kn(i,t,e,r,s,o,n){if(i){!n&&o&&FM(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?AM(i,r,s,o):EM(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Ln(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=wM(Zi(i),t,e),kn(i,t,e,r,s,o,2)):n===2&&CM(i,t,e,r,s,o):kn(Zi(i),t,e,r,s,o,1);break}}}}function EM(i){var t=i.prev,e=i,r=i.next;if(Ht(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,c=s<o?s<n?s:n:o<n?o:n,u=a<h?a<l?a:l:h<l?h:l,d=s>o?s>n?s:n:o>n?o:n,f=a>h?a>l?a:l:h>l?h:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&js(s,a,o,h,n,l,p.x,p.y)&&Ht(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function AM(i,t,e,r){var s=i.prev,o=i,n=i.next;if(Ht(s,o,n)>=0)return!1;for(var a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,d=n.y,f=a<h?a<l?a:l:h<l?h:l,p=c<u?c<d?c:d:u<d?u:d,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,b=Af(f,p,t,e,r),_=Af(m,g,t,e,r),v=i.prevZ,T=i.nextZ;v&&v.z>=b&&T&&T.z<=_;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==n&&js(a,c,h,u,l,d,v.x,v.y)&&Ht(v.prev,v,v.next)>=0||(v=v.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&js(a,c,h,u,l,d,T.x,T.y)&&Ht(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;v&&v.z>=b;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==n&&js(a,c,h,u,l,d,v.x,v.y)&&Ht(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;T&&T.z<=_;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&js(a,c,h,u,l,d,T.x,T.y)&&Ht(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function wM(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!Hl(s,o)&&jb(s,r,r.next,o)&&On(s,o)&&On(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Ln(r),Ln(r.next),r=i=o),r=r.next}while(r!==i);return Zi(r)}function CM(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&kM(n,a)){var h=Yb(n,a);n=Zi(n,n.next),h=Zi(h,h.next),kn(n,t,e,r,s,o,0),kn(h,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function PM(i,t,e,r){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=Xb(i,a,h,r,!1),l===l.next&&(l.steiner=!0),s.push(UM(l));for(s.sort(RM),o=0;o<s.length;o++)e=MM(s[o],e);return e}function RM(i,t){return i.x-t.x}function MM(i,t){var e=BM(i,t);if(!e)return t;var r=Yb(e,i);return Zi(r,r.next),Zi(e,e.next)}function BM(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var h=n,l=n.x,c=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&js(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),On(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&IM(n,e)))&&(n=e,u=d)),e=e.next;while(e!==h);return n}function IM(i,t){return Ht(i.prev,i,t.prev)<0&&Ht(t.next,i,i.next)<0}function FM(i,t,e,r){var s=i;do s.z===0&&(s.z=Af(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,GM(s)}function GM(i){var t,e,r,s,o,n,a,h,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(h=l;a>0||h>0&&r;)a!==0&&(h===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function Af(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function UM(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function js(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function kM(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!OM(i,t)&&(On(i,t)&&On(t,i)&&LM(i,t)&&(Ht(i.prev,i,t.prev)||Ht(i,t.prev,t))||Hl(i,t)&&Ht(i.prev,i,i.next)>0&&Ht(t.prev,t,t.next)>0)}function Ht(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Hl(i,t){return i.x===t.x&&i.y===t.y}function jb(i,t,e,r){var s=Dl(Ht(i,t,e)),o=Dl(Ht(i,t,r)),n=Dl(Ht(e,r,i)),a=Dl(Ht(e,r,t));return!!(s!==o&&n!==a||s===0&&Ll(i,e,t)||o===0&&Ll(i,r,t)||n===0&&Ll(e,i,r)||a===0&&Ll(e,t,r))}function Ll(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Dl(i){return i>0?1:i<0?-1:0}function OM(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&jb(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function On(i,t){return Ht(i.prev,i,i.next)<0?Ht(i,t,i.next)>=0&&Ht(i,i.prev,t)>=0:Ht(i,t,i.prev)<0||Ht(i,i.next,t)<0}function LM(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function Yb(i,t){var e=new wf(i.i,i.x,i.y),r=new wf(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function $b(i,t,e,r){var s=new wf(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Ln(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function wf(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Nl.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(Cf(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:i.length;n-=Math.abs(Cf(i,l,c,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function Cf(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Nl.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function Wl(i,t,e,r,s,o,n){let a=(0,qb.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let h=s*r;for(let l=0;l<i.length;l+=2)e[h]=i[l],e[h+1]=i[l+1],h+=r}var qb,Rf=x(()=>{qb=Gi(Vl(),1)});var DM,Kb,Zb=x(()=>{C();Rf();DM=[],Kb={extension:{type:y.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Wl(i,DM,t,e,r,s,o)}}});var Qb,Jb=x(()=>{C();Qb={extension:{type:y.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var tv,ev=x(()=>{C();tv={extension:{type:y.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function iv(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function sv(i,t){let e=$.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function NM(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(z("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??ke.defaultLinearOptions.textureSize}),t}var rv,Bf,ke,Ys=x(()=>{fe();Rt();dt();Gs();vt();me();Dt();vd();rv=[{offset:0,color:"white"},{offset:1,color:"black"}],Bf=class Mf{constructor(...t){this.uid=nt("fillGradient"),this.type="linear",this.colorStops=[];let e=NM(t);e={...e.type==="radial"?Mf.defaultRadialOptions:Mf.defaultLinearOptions,...al(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:et.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=t;t=r,r=g,o*=-1}if(n<0){let g=e;e=s,s=g,n*=-1}}let h=this.colorStops.length?this.colorStops:rv,l=this._textureSize,{canvas:c,context:u}=sv(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);iv(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new E({source:new Ge({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new I;m.scale(f/l,1),m.rotate(p),m.translate(t,e),this.textureSpace==="local"&&m.scale(l,l),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:rv,e=this._textureSize,{canvas:r,context:s}=sv(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,d=h-c,f=e/(c*2),p=(o-u)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,l*f,(a-u)*f,(h-d)*f,c*f);iv(g,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,e,e),this.texture=new E({source:new Ge({resource:r,addressMode:this._wrapMode})});let b=new I;b.scale(1/f,1/f),b.translate(u,d),this.textureSpace==="local"&&b.scale(e,e),this.transform=b}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Bf.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Bf.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};ke=Bf});function ov(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(VM);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,c=1/n.height,u=-a*l,d=-h*c,f=s.a,p=s.b,m=s.c,g=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*f+d*m+s.tx,s.ty=u*p+d*g+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof ke)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(HM.copyFrom(r).invert()),s}var HM,VM,nv=x(()=>{dt();he();Ys();HM=new I,VM=new st});function hv(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")$M(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,h=o.data.style,l=o.data.hole;n&&l&&av(l.shapePath,h,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),av(a,h,n,r,e)}}}function $M(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=zl.rectangle,c=WM,u=i.image;c.x=i.dx,c.y=i.dy,c.width=i.dw,c.height=i.dh;let d=i.transform;l.build(c,h),d&&Sf(h,d),l.triangulate(h,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=J.get(qi);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=r.length/2-a,p.baseColor=i.style,p.alpha=i.alpha,p.texture=u,p.geometryData=e,t.push(p)}function av(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=zl[h.type],m="triangle-list";if(p.build(h,f),l&&Sf(f,l),e){let v=h.closePath??!0,T=t;T.pixelLine?(Wb(f,v,o,a),m="line-list"):Hb(f,T,!1,v,o,a)}else if(c){let v=[],T=f.slice();XM(c).forEach(S=>{v.push(T.length/2),T.push(...S)}),Wl(T,v,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let g=n.length/2,b=t.texture;if(b!==E.WHITE){let v=ov(zM,t,h,l);Bb(o,2,d,n,g,2,o.length/2-d,v)}else Ib(n,g,2,o.length/2-d);let _=J.get(qi);_.indexOffset=u,_.indexSize=a.length-u,_.attributeOffset=d,_.attributeSize=o.length/2-d,_.baseColor=t.color,_.alpha=t.alpha,_.texture=b,_.geometryData=s,_.topology=m,r.push(_)})}function XM(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];zl[r.type].build(r,s),t.push(s)}return t}var zl,WM,zM,lv=x(()=>{C();dt();he();Fb();Gb();vt();Te();Ef();Ob();Vb();zb();Zb();Jb();ev();nv();Rf();zl={};G.handleByMap(y.ShapeBuilder,zl);G.add(Qb,Kb,tv,Xs,Ub,kb);WM=new st,zM=new I});var If,Ff,Uf,qs,$l=x(()=>{C();Ml();Tf();yd();Dt();Te();lv();If=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Ff=class{constructor(){this.batcher=new Un,this.instructions=new Cs}init(){this.instructions.reset()}get geometry(){return z(Rx,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Uf=class Gf{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Gf.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Gf.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),hv(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=J.get(Ff),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<r.length;c++)r[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<r.length;c++){let u=r[c];a.add(u)}a.finish(e.instructions);let h=a.geometry;h.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),h.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let c=0;c<l.length;c++){let u=l[c];u.bindGroup=Os(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new If;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(J.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{J.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Uf.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"graphicsContext"};Uf.defaultOptions={bezierSmoothness:.5};qs=Uf});var jM,kf,Of,Lf,Df,Nf,Hf,Vf,$t,mr=x(()=>{"use strict";jM={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},kf=0,Of=1,Lf=2,Df=3,Nf=4,Hf=5,Vf=class cv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<kf)}set blend(t){!!(this.data&1<<kf)!==t&&(this.data^=1<<kf)}get offsets(){return!!(this.data&1<<Of)}set offsets(t){!!(this.data&1<<Of)!==t&&(this.data^=1<<Of)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Lf)}set culling(t){!!(this.data&1<<Lf)!==t&&(this.data^=1<<Lf)}get depthTest(){return!!(this.data&1<<Df)}set depthTest(t){!!(this.data&1<<Df)!==t&&(this.data^=1<<Df)}get depthMask(){return!!(this.data&1<<Hf)}set depthMask(t){!!(this.data&1<<Hf)!==t&&(this.data^=1<<Hf)}get clockwiseFrontFace(){return!!(this.data&1<<Nf)}set clockwiseFrontFace(t){!!(this.data&1<<Nf)!==t&&(this.data^=1<<Nf)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=jM[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new cv;return t.depthTest=!1,t.blend=!0,t}};Vf.default2d=Vf.for2d();$t=Vf});function Br(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var Ks=x(()=>{"use strict"});var Dn,uv=x(()=>{C();mr();Te();Ks();Ef();Dn=class{constructor(t,e){this.state=$t.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Br(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=J.get(qi);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{J.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};Dn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"graphics"}});var Wf=x(()=>{C();$l();uv();G.add(Dn);G.add(qs)});var Ti,Xl=x(()=>{"use strict";Ti=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var Nn,dv=x(()=>{C();dt();xi();Ae();Mn();Te();Ks();Xl();Nn=class{constructor(t,e){this.localUniforms=new wt({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new ce({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(J.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=qr(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Br(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=J.get(Ti);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&J.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};Nn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"mesh"}});var zf=x(()=>{C();dv();G.add(Nn)});var jl,fv=x(()=>{"use strict";jl=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function $f(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var pv=x(()=>{"use strict"});function gv(i){return{dynamicUpdate:mv(i,!0),staticUpdate:mv(i,!1)}}function mv(i,t){let e=[];e.push(`
|
|
254
254
|
|
|
255
255
|
var index = 0;
|
|
256
256
|
|
|
@@ -264,7 +264,7 @@ ${s.join(`
|
|
|
264
264
|
`),e.unshift(`
|
|
265
265
|
var stride = ${r};
|
|
266
266
|
`);let s=e.join(`
|
|
267
|
-
`);return new Function("ps","f32v","u32v",s)}var xv=x(()=>{Yi()});function YM(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}var Yl,_v=x(()=>{_i();Kr();Ls();Yi();sf();pv();xv();Yl=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let c in r){let u=r[c],d=Ue(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Ar(e*4*s),this.dynamicAttributeBuffer=new Ar(e*4*o),this.indexBuffer=$f(e);let n=new tr,a=0,h=0;this._staticBuffer=new Vt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:
|
|
267
|
+
`);return new Function("ps","f32v","u32v",s)}var xv=x(()=>{Yi()});function YM(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}var Yl,_v=x(()=>{_i();Kr();Ls();Yi();sf();pv();xv();Yl=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let c in r){let u=r[c],d=Ue(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Ar(e*4*s),this.dynamicAttributeBuffer=new Ar(e*4*o),this.indexBuffer=$f(e);let n=new tr,a=0,h=0;this._staticBuffer=new Vt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:ot.VERTEX|ot.COPY_DST}),this._dynamicBuffer=new Vt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:ot.VERTEX|ot.COPY_DST});for(let c in r){let u=r[c],d=Ue(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:h*4,format:u.format}),h+=d.size)}n.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=YM(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return gv(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Ar(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Ar(this._size*this._dynamicStride*4*4),this.indexBuffer=$f(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var yv,bv=x(()=>{yv=`varying vec2 vUV;
|
|
268
268
|
varying vec4 vColor;
|
|
269
269
|
|
|
270
270
|
uniform sampler2D uTexture;
|
|
@@ -364,8 +364,8 @@ fn mainFragment(
|
|
|
364
364
|
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
365
365
|
|
|
366
366
|
return sample;
|
|
367
|
-
}`});var ql,Ev=x(()=>{fe();dt();ji();Ns();pr();vt();Td();bv();Tv();Sv();ql=class extends Wt{constructor(){let t=er.from({vertex:vv,fragment:yv}),e=rr.from({fragment:{source:Xf,entryPoint:"mainFragment"},vertex:{source:Xf,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:E.WHITE.source,uSampler:new hl({}),uniforms:{uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new et(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Zs,jf=x(()=>{dt();Ae();Mn();mr();Ks();_v();Ev();Zs=class{constructor(t,e){this.state=$t.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new wt({uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new ql,this.state=$t.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Yl({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=qr(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Br(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Hn,Av=x(()=>{C();fv();jf();Hn=class extends Zs{constructor(t){super(t,new jl)}};Hn.extension={type:[y.WebGLPipes],name:"particle"}});var Kl,wv=x(()=>{"use strict";Kl=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Vn,Cv=x(()=>{C();wv();jf();Vn=class extends Zs{constructor(t){super(t,new Kl)}};Vn.extension={type:[y.WebGPUPipes],name:"particle"}});var Yf=x(()=>{C();Av();Cv();F.add(Hn);F.add(Vn)});var Ir,Wn=x(()=>{"use strict";Ir=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function zn(i,t){let{texture:e,bounds:r}=i;vl(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var qf=x(()=>{Xd()});var $n,Pv=x(()=>{C();Te();Wn();qf();$n=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,zn(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:J.get(Ir)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};$n.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"text"}});var Kf,Oe,Qs=x(()=>{Rt();mn();Kf=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=z.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=$r(t),e=$r(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Oe=new Kf});function Rv(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function Mv(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function Bv(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,h=0,l=e-1,c=r-1;for(;h<r&&Rv(n,e,h);)++h;if(h===r)return it.EMPTY;for(;Rv(n,e,c);)--c;for(;Mv(n,e,a,h,c);)++a;for(;Mv(n,e,l,h,c);)--l;return++l,++c,new it(a/t,h/t,(l-a)/t,(c-h)/t)}var Iv=x(()=>{he()});var Fv,Qr,Zl=x(()=>{dt();me();Fv={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Qr=class{constructor(t,e){this.uid=nt("fillPattern"),this.transform=new B,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Fv[e].addressModeU,t.source.style.addressModeV=Fv[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var Uv=K((fz,Gv)=>{Gv.exports=KM;var Zf={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},qM=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function KM(i){var t=[];return i.replace(qM,function(e,r,s){var o=r.toLowerCase();for(s=QM(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Zf[o])return s.unshift(r),t.push(s);if(s.length<Zf[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Zf[o])))}}),t}var ZM=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function QM(i){var t=i.match(ZM);return t?t.map(Number):[]}});function Ov(i,t){let e=(0,kv.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){case"M":o=c[1],n=c[2],t.moveTo(o,n);break;case"m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case"H":o=c[1],t.lineTo(o,n);break;case"h":o+=c[1],t.lineTo(o,n);break;case"V":n=c[1],t.lineTo(o,n);break;case"v":n+=c[1],t.lineTo(o,n);break;case"L":o=c[1],n=c[2],t.lineTo(o,n);break;case"l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case"C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case"c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case"S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case"s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case"q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case"t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case"A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:O(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var kv,Lv=x(()=>{kv=Gi(Uv(),1);At()});var Ql,Dv=x(()=>{he();Ql=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(r-h)}getBounds(t){return t||(t=new it),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Jl,Nv=x(()=>{he();Jl=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),h=r-a,l=o-h,c=n-h,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(l*l)+p*p/(c*c),g=f*f/(u*u)+p*p/(d*d);return m>1&&g<=1}getBounds(t){return t||(t=new it),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Hv(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,c=n*h+a*l,u=h*h+l*l,d=-1;u!==0&&(d=c/u);let f,p;d<0?(f=e,p=r):d>1?(f=s,p=o):(f=e+d*h,p=r+d*l);let m=i-f,g=t-p;return m*m+g*g}var Vv=x(()=>{"use strict"});var JM,tB,Js,Wv=x(()=>{Vv();he();Js=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],h=e[(s+3)%r];t+=(a-o)*(h+n)}return t<0}containsPolygon(t){let e=this.getBounds(JM),r=t.getBounds(tB);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){let u=h[c],d=h[c+1],f=h[(c+2)%h.length],p=h[(c+3)%h.length],m=Hv(t,e,u,d,f,p),g=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(g<0?a:n))return!0}return!1}getBounds(t){t||(t=new it);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],c=e[a+1];r=l<r?l:r,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var tc,ec,zv=x(()=>{he();tc=(i,t,e,r,s,o,n)=>{let a=i-e,h=t-r,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},ec=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new it),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=r*(1-s),u=r-c,d=o+l,f=n+l,p=a-l*2,m=h-l*2,g=o+a,b=n+h;return(t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=f&&e<=f+m||(e>=n-c&&e<=n+u||e>=b-u&&e<=b+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&tc(t,e,d,f,l,u,c)||t>g-l&&e<f&&tc(t,e,g-l,f,l,u,c)||t>g-l&&e>b-l&&tc(t,e,g-l,b-l,l,u,c)||t<d&&e>b-l&&tc(t,e,d,b-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function ic(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??qs.defaultOptions.bezierSmoothness)),d=(rB-u)/1;return d*=d,iB(t,e,r,s,o,n,a,h,i,d),i}function iB(i,t,e,r,s,o,n,a,h,l){Jf(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a)}function Jf(i,t,e,r,s,o,n,a,h,l,c){if(c>eB)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,p=(e+s)/2,m=(r+o)/2,g=(s+n)/2,b=(o+a)/2,_=(d+p)/2,v=(f+m)/2,T=(p+g)/2,w=(m+b)/2,S=(_+T)/2,A=(v+w)/2;if(c>0){let M=n-i,P=a-t,R=Math.abs((e-n)*P-(r-a)*M),I=Math.abs((s-n)*P-(o-a)*M),k,j;if(R>rc&&I>rc){if((R+I)*(R+I)<=l*(M*M+P*P)){if(to<Qf){h.push(S,A);return}let N=Math.atan2(o-r,s-e);if(k=Math.abs(N-Math.atan2(r-t,e-i)),j=Math.abs(Math.atan2(a-o,n-s)-N),k>=u&&(k=2*u-k),j>=u&&(j=2*u-j),k+j<to){h.push(S,A);return}if(Qi!==0){if(k>Qi){h.push(e,r);return}if(j>Qi){h.push(s,o);return}}}}else if(R>rc){if(R*R<=l*(M*M+P*P)){if(to<Qf){h.push(S,A);return}if(k=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),k>=u&&(k=2*u-k),k<to){h.push(e,r),h.push(s,o);return}if(Qi!==0&&k>Qi){h.push(e,r);return}}}else if(I>rc){if(I*I<=l*(M*M+P*P)){if(to<Qf){h.push(S,A);return}if(k=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),k>=u&&(k=2*u-k),k<to){h.push(e,r),h.push(s,o);return}if(Qi!==0&&k>Qi){h.push(s,o);return}}}else if(M=S-(i+n)/2,P=A-(t+a)/2,M*M+P*P<=l){h.push(S,A);return}}Jf(i,t,d,f,_,v,S,A,h,l,c+1),Jf(S,A,T,w,g,b,n,a,h,l,c+1)}var eB,rc,rB,Qf,to,Qi,tp=x(()=>{$l();eB=8,rc=11920929e-14,rB=1,Qf=.01,to=0,Qi=0});function Xv(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??qs.defaultOptions.bezierSmoothness)),c=(nB-l)/1;return c*=c,hB(t,e,r,s,o,n,i,c),i}function hB(i,t,e,r,s,o,n,a){ep(n,i,t,e,r,s,o,a,0),n.push(s,o)}function ep(i,t,e,r,s,o,n,a,h){if(h>sB)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,p=(c+d)/2,m=(u+f)/2,g=o-t,b=n-e,_=Math.abs((r-o)*b-(s-n)*g);if(_>oB){if(_*_<=a*(g*g+b*b)){if($v<aB){i.push(p,m);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=l&&(v=2*l-v),v<$v){i.push(p,m);return}}}else if(g=p-(t+o)/2,b=m-(e+n)/2,g*g+b*b<=a){i.push(p,m);return}ep(i,t,e,c,u,p,m,a,h+1),ep(i,p,m,d,f,o,n,a,h+1)}var sB,oB,nB,aB,$v,jv=x(()=>{$l();sB=8,oB=11920929e-14,nB=1,aB=.01,$v=0});function sc(i,t,e,r,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),p=t+d*r,m=e+f*r;i.push(p,m),c+=l}}var rp=x(()=>{"use strict"});function Yv(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,c=s-e,u=r-t,d=Math.abs(h*u-l*c);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=h*h+l*l,p=c*c+u*u,m=h*c+l*u,g=o*Math.sqrt(f)/d,b=o*Math.sqrt(p)/d,_=g*m/f,v=b*m/p,T=g*u+b*l,w=g*c+b*h,S=l*(b+_),A=h*(b+_),M=u*(g+v),P=c*(g+v),R=Math.atan2(A-w,S-T),I=Math.atan2(P-w,M-T);sc(i,T+t,w+e,o,R,I,l*c>u*h)}var qv=x(()=>{rp()});function lB(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function Zv(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*Xn/360),u=Math.cos(a*Xn/360),d=u*(t-r)/2+c*(e-s)/2,f=-c*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),cB(t,e,r,s,o,n,h,l,c,u,d,f,ip);let{ang1:m,ang2:g}=ip,{centerX:b,centerY:_}=ip,v=Math.abs(g)/(Xn/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);g/=T;let w=i[i.length-2],S=i[i.length-1],A={x:0,y:0};for(let M=0;M<T;M++){let P=lB(m,g),{x:R,y:I}=sp(P[0],o,n,u,c,b,_,A),{x:k,y:j}=sp(P[1],o,n,u,c,b,_,A),{x:N,y:ot}=sp(P[2],o,n,u,c,b,_,A);ic(i,w,S,R,I,k,j,N,ot),w=N,S=ot,m+=g}}var Xn,ip,sp,Kv,cB,Qv=x(()=>{tp();Xn=Math.PI*2,ip={centerX:0,centerY:0,ang1:0,ang2:0},sp=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,c=o*i+s*t;return h.x=l+n,h.y=c+a,h};Kv=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},cB=(i,t,e,r,s,o,n,a,h,l,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(c,2),g=Math.pow(u,2),b=f*p-f*g-p*m;b<0&&(b=0),b/=f*g+p*m,b=Math.sqrt(b)*(n===a?-1:1);let _=b*s/o*u,v=b*-o/s*c,T=l*_-h*v+(i+e)/2,w=h*_+l*v+(t+r)/2,S=(c-_)/s,A=(u-v)/o,M=(-c-_)/s,P=(-u-v)/o,R=Kv(1,0,S,A),I=Kv(S,A,M,P);a===0&&I>0&&(I-=Xn),a===1&&I<0&&(I+=Xn),d.centerX=T,d.centerY=w,d.ang1=R,d.ang2=I}});function Jv(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,d=l/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],c=r(a,o),u=r(a,l);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let m=d/2,g,b=Math.abs(Math.cos(m)*h/Math.sin(m));b>Math.min(c.len/2,u.len/2)?(b=Math.min(c.len/2,u.len/2),g=Math.abs(b*Math.sin(m)/Math.cos(m))):g=h;let _=a.x+u.nx*b+-u.ny*g*f,v=a.y+u.ny*b+u.nx*g*f,T=Math.atan2(c.ny,c.nx)+Math.PI/2*f,w=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(_+Math.cos(T)*g,v+Math.sin(T)*g),i.arc(_,v,g,T,w,p),o=a}}function t0(i,t,e,r){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?i.moveTo(h.x,h.y):i.lineTo(h.x,h.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,h),f;if(d<1e-4)f=h;else{let g=Math.min(d/2,l);f=o(h,c,g/d)}let p=s(u,h),m;if(p<1e-4)m=h;else{let g=Math.min(p/2,l);m=o(h,u,g/p)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(h.x,h.y,m.x,m.y,r)}}var e0=x(()=>{"use strict"});var uB,oc,r0=x(()=>{Dv();Nv();Wv();he();zv();Be();tp();jv();rp();qv();Qv();e0();uB=new it,oc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Et,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return sc(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Yv(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return Zv(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return ic(this._currentPoly.points,h.lastX,h.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Xv(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new it(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Ql(t,e,r),s),this}poly(t,e,r){let s=new Js(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let c=0;c<s;c++){let u=a-c*h;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let h=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*c+l,p=t+r*Math.cos(f),m=e+r*Math.sin(f),g=f+Math.PI+u,b=f-Math.PI-u,_=p+o*Math.cos(g),v=m+o*Math.sin(g),T=p+o*Math.cos(b),w=m+o*Math.sin(b);d===0?this.moveTo(_,v):this.lineTo(_,v),this.quadraticCurveTo(p,m,T,w,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?t0(this,t,e,s):Jv(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+r,l=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+r-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),h=t+r,l=e+s,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new Jl(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new ec(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new Js,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Js,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(uB);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function jn(i,t){return i?i.prepend(t):t.clone()}var Si,op=x(()=>{Qe();me();At();Lv();r0();Si=class i{constructor(t,e=!1){this.instructions=[],this.uid=nt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Ov(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new oc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(at.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=n.data[2],l=n.data[3];let c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(at.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let h=o.x,l=o.y;n=h+(h-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=r*2,c=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,p=d*c+h;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0;for(let g=0;g<this.instructions.length;g++){let b=this.instructions[g],_=b.data;switch(b.action){case"moveTo":case"lineTo":h=_[0],l=_[1],_[0]=e*h+s*l+n,_[1]=r*h+o*l+a;break;case"bezierCurveTo":c=_[0],u=_[1],d=_[2],f=_[3],h=_[4],l=_[5],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*d+s*f+n,_[3]=r*d+o*f+a,_[4]=e*h+s*l+n,_[5]=r*h+o*l+a;break;case"quadraticCurveTo":c=_[0],u=_[1],h=_[2],l=_[3],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*h+s*l+n,_[3]=r*h+o*l+a;break;case"arcToSvg":h=_[5],l=_[6],p=_[0],m=_[1],_[0]=e*p+s*m,_[1]=r*p+o*m,_[5]=e*h+s*l+n,_[6]=r*h+o*l+a;break;case"circle":_[4]=jn(_[3],t);break;case"rect":_[4]=jn(_[4],t);break;case"ellipse":_[8]=jn(_[8],t);break;case"roundRect":_[5]=jn(_[5],t);break;case"addPath":_[0].transform(t);break;case"poly":_[2]=jn(_[2],t);break;default:O("unknown transform action",b.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function kt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var np=x(()=>{"use strict"});function i0(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=dB(n);break;case"radialgradient":t.defs[n.id]=fB(n);break;default:break}}}}function dB(i){let t=kt(i,"x1",0),e=kt(i,"y1",0),r=kt(i,"x2",1),s=kt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new ke(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=kt(h,"offset",0),c=et.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c)}return n}function fB(i){return O("[SVG Parser] Radial gradients are not yet supported"),new ke(0,0,1,0)}var s0=x(()=>{fe();At();Ys();np()});function ap(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var o0=x(()=>{"use strict"});function hp(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in n0){let a=i.getAttribute(n);a&&a0(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,c]=h.split(":");n0[l]&&a0(t,o,l,c.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function a0(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=ap(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=et.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=ap(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=et.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var n0,h0=x(()=>{fe();o0();n0={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function l0(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new Si};i0(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=hp(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&c0(a,e,s,o)}return t}function c0(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=hp(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let h,l,c,u,d,f,p,m,g,b,_,v,T,w,S,A,M;switch(i.nodeName.toLowerCase()){case"path":w=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&O("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Si(w,!0),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":p=kt(i,"cx",0),m=kt(i,"cy",0),g=kt(i,"r",0),t.context.ellipse(p,m,g,g),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":h=kt(i,"x",0),l=kt(i,"y",0),A=kt(i,"width",0),M=kt(i,"height",0),b=kt(i,"rx",0),_=kt(i,"ry",0),b||_?t.context.roundRect(h,l,A,M,b||_):t.context.rect(h,l,A,M),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":p=kt(i,"cx",0),m=kt(i,"cy",0),b=kt(i,"rx",0),_=kt(i,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,b,_),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":c=kt(i,"x1",0),u=kt(i,"y1",0),d=kt(i,"x2",0),f=kt(i,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),v=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),v=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{O(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<s.length;P++)c0(s[P],t,e,r)}var u0=x(()=>{At();op();s0();np();h0()});function pB(i){return et.isColorLike(i)}function d0(i){return i instanceof Qr}function f0(i){return i instanceof ke}function mB(i){return i instanceof E}function gB(i,t,e){let r=et.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=E.WHITE,{...e,...i}}function xB(i,t,e){return i.texture=t,{...e,...i}}function p0(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function m0(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function _B(i,t){let e={...t,...i},r=et.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Jr(i,t){if(i==null)return null;let e={},r=i;return pB(i)?gB(e,i,t):mB(i)?xB(e,i,t):d0(i)?p0(e,i,t):f0(i)?m0(e,i,t):r.fill&&d0(r.fill)?p0(r,r.fill,t):r.fill&&f0(r.fill)?m0(r,r.fill,t):_B(r,t)}function eo(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=Jr(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var lp=x(()=>{fe();vt();Ys();Zl()});var yB,g0,cp,we,nc=x(()=>{_e();fe();dt();Qe();vt();me();Dt();Be();op();u0();lp();yB=new at,g0=new B,cp=class Fr extends Pt{constructor(){super(...arguments),this.uid=nt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Si,this._transform=new B,this._fillStyle={...Fr.defaultFillStyle},this._strokeStyle={...Fr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Et,this._boundsDirty=!0}clone(){let t=new Fr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=Jr(t,Fr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=eo(t,Fr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Jr(t,Fr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Jr(t,Fr.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?et.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Si,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(W(Q,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Jr(t,Fr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(at.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=eo(t,Fr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*r+h.c*s+h.tx,h.b*r+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,l0(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof B?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof B?(this._transform.append(t),this):(g0.set(t,e,r,s,o,n),this._transform.append(g0),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let d=l[c].transform,f=d?d.applyInverse(t,yB):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let m=h;r=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let g=0;g<m.length;g++)m[g].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};cp.defaultFillStyle={color:16777215,alpha:1,texture:E.WHITE,matrix:null,fill:null,textureSpace:"local"};cp.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:E.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};we=cp});function ac(i){let t=[],e=0;for(let r=0;r<x0.length;r++){let s=`_${x0[r]}`;t[e++]=i[s]}return e=_0(i._fill,t,e),e=bB(i._stroke,t,e),e=vB(i.dropShadow,t,e),t.join("-")}function _0(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function bB(i,t,e){return i&&(e=_0(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function vB(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=et.shared.setValue(i.color).toNumber()),e}var x0,up=x(()=>{fe();x0=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function TB(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Mt.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){W(Q,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(et.isColorLike(e))r.color=e;else if(e instanceof ke||e instanceof Qr)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){W(Q,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Mt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new ke({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>et.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var dp,Mt,Ji=x(()=>{_e();fe();Dt();Ys();Zl();nc();lp();up();dp=class ro extends Pt{constructor(t={}){super(),TB(t);let e={...ro.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...ro.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ro.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...we.defaultFillStyle,...t},()=>{this._fill=Jr({...this._originalFill},we.defaultFillStyle)})),this._fill=Jr(t===0?"black":t,we.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...we.defaultStrokeStyle,...t},()=>{this._stroke=eo({...this._originalStroke},we.defaultStrokeStyle)})),this._stroke=eo(t,we.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ac(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=ro.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ro({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(et.isColorLike(t)||t instanceof ke||t instanceof Qr)}};dp.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};dp.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};Mt=dp});function hc(i,t,e,r){let s=SB;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=Nt.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var SB,fp=x(()=>{ui();Be();SB=new Et});function ts(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!EB.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var EB,lc=x(()=>{"use strict";EB=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var pp,gr,Xt,Yn=x(()=>{Rt();lc();pp={willReadFrequently:!0},gr=class X{static get experimentalLetterSpacingSupported(){let t=X._experimentalLetterSpacingSupported;if(t!==void 0){let e=z.get().getCanvasRenderingContext2D().prototype;t=X._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,h,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,r=X._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(X._measurementCache[o])return X._measurementCache[o];let n=ts(e),a=X.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=X.__context;h.font=n;let c=(s?X._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let _=0;_<c.length;_++){let v=X._measureText(c[_],e.letterSpacing,h);u[_]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,g=Math.max(m,a.fontSize+f)+(c.length-1)*(m+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new X(t,e,p,g,c,u,m+e.leading,d,a)}static _measureText(t,e,r){let s=!1;X.experimentalLetterSpacingSupported&&(X.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let c=(X.graphemeSegmenter(t).length-1)*e;n+=c,l+=c}return Math.max(n,l)}static _wordWrap(t,e,r=X._canvas){let s=r.getContext("2d",pp),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=X._collapseSpaces(c),d=X._collapseNewlines(c),f=!u,p=e.wordWrapWidth+l,m=X._tokenize(t);for(let g=0;g<m.length;g++){let b=m[g];if(X._isNewline(b)){if(!d){a+=X._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let v=X.isBreakingSpace(b),T=X.isBreakingSpace(n[n.length-1]);if(v&&T)continue}let _=X._getFromCache(b,l,h,s);if(_>p)if(n!==""&&(a+=X._addLine(n),n="",o=0),X.canBreakWords(b,e.breakWords)){let v=X.wordWrapSplit(b);for(let T=0;T<v.length;T++){let w=v[T],S=w,A=1;for(;v[T+A];){let P=v[T+A];if(!X.canBreakChars(S,P,b,T,e.breakWords))w+=P;else break;S=P,A++}T+=A-1;let M=X._getFromCache(w,l,h,s);M+o>p&&(a+=X._addLine(n),f=!1,n="",o=0),n+=w,o+=M}}else{n.length>0&&(a+=X._addLine(n),n="",o=0);let v=g===m.length-1;a+=X._addLine(b,!v),f=!1,n="",o=0}else _+o>p&&(f=!1,a+=X._addLine(n),n="",o=0),(n.length>0||!X.isBreakingSpace(b)||f)&&(n+=b,o+=_)}return a+=X._addLine(n,!1),a}static _addLine(t,e=!0){return t=X._trimRight(t),t=e?`${t}
|
|
368
|
-
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=X._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!X.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:X._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:X._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(X.isBreakingSpace(o,n)||X._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return X.graphemeSegmenter(t)}static measureFont(t){if(X._fonts[t])return X._fonts[t];let e=X._context;e.font=t;let r=e.measureText(X.METRICS_STRING+X.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return X._fonts[t]=s,s}static clearMetrics(t=""){t?delete X._fonts[t]:X._fonts={}}static get _canvas(){if(!X.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",pp)?.measureText)return X.__canvas=e,e;t=z.get().createCanvas()}catch{t=z.get().createCanvas()}t.width=t.height=10,X.__canvas=t}return X.__canvas}static get _context(){return X.__context||(X.__context=X._canvas.getContext("2d",pp)),X.__context}};gr.METRICS_STRING="|\xC9q\xC5";gr.BASELINE_SYMBOL="M";gr.BASELINE_MULTIPLIER=1.4;gr.HEIGHT_MULTIPLIER=2;gr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();gr.experimentalLetterSpacing=!1;gr._fonts={};gr._newlines=[10,13];gr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];gr._measurementCache={};Xt=gr});function io(i,t,e,r=0){if(i.texture===E.WHITE&&!i.fill)return et.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Qr){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(B.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof ke){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+r,h=e.height+r);let l,c=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*h,d.x*a,d.y*h),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*h,d*a,f.x*a,f.y*h,p*a)}if(c&&n&&e){let u=e.lineHeight/h;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/h;s.colorStops.forEach(p=>{let m=f+p.offset*u;l.addColorStop(Math.floor(m*y0)/y0,et.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,et.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(B.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return O("FillStyle not recognised",i),"red"}var y0,mp=x(()=>{fe();dt();vt();At();Ys();Zl();y0=1e5});var qn,b0=x(()=>{fe();C();mn();Qs();ui();Iv();Dt();Ji();fp();Yn();lc();mp();qn=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=Xt.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=$r(o),n=$r(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(W("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Mt||(t.style=new Mt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Oe.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=Xt.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),h=Oe.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let c=hc(l,n,a,s);if(r.trim){let u=Bv(l,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Nt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Oe.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=ts(e),h=Xt.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=h.lineWidths,d=h.maxLineWidth,f=h.fontProperties,p=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let _=e._stroke;n.lineWidth=_.width,n.miterLimit=_.miterLimit,n.lineJoin=_.join,n.lineCap=_.cap}n.font=a;let m,g,b=e.dropShadow?2:1;for(let _=0;_<b;++_){let v=e.dropShadow&&_===0,T=v?Math.ceil(Math.max(1,p)+e.padding*2):0,w=T*r;if(v){n.fillStyle="black",n.strokeStyle="black";let M=e.dropShadow,P=M.color,R=M.alpha;n.shadowColor=et.shared.setValue(P).setAlpha(R).toRgbaString();let I=M.blur*r,k=M.distance*r;n.shadowBlur=I,n.shadowOffsetX=Math.cos(M.angle)*k,n.shadowOffsetY=Math.sin(M.angle)*k+w}else{if(n.fillStyle=e._fill?io(e._fill,n,h):null,e._stroke?.width){let M=e._stroke.width*e._stroke.alignment;n.strokeStyle=io(e._stroke,n,h,M)}n.shadowColor="black"}let S=(c-f.fontSize)/2;c-f.fontSize<0&&(S=0);let A=e._stroke?.width??0;for(let M=0;M<l.length;M++)m=A/2,g=A/2+M*c+f.ascent+S,e.align==="right"?m+=d-u[M]:e.align==="center"&&(m+=(d-u[M])/2),e._stroke?.width&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,h=e.letterSpacing,l=!1;if(Xt.experimentalLetterSpacingSupported&&(Xt.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=Xt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,c,o):a.fillText(m,c,o);let g="";for(let b=p+1;b<u.length;++b)g+=u[b];f=a.measureText(g).width,c+=d-f+h,d=f}}destroy(){this._activeTextures=null}};qn.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"canvasText"}});var gp=x(()=>{C();Pv();b0();F.add(qn);F.add($n)});var xr,xp=x(()=>{Dt();_l();nc();xr=class i extends mi{constructor(t){t instanceof we&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new we,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){W(Q,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){W(Q,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){W(Q,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==we.defaultStrokeStyle.width||t.color!==we.defaultStrokeStyle.color||t.alpha!==we.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return W(Q,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return W(Q,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return W(Q,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return W(Q,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return W(Q,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return W(Q,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var v0,T0,S0=x(()=>{"use strict";v0={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
367
|
+
}`});var ql,Ev=x(()=>{fe();dt();ji();Ns();pr();vt();Td();bv();Tv();Sv();ql=class extends Wt{constructor(){let t=er.from({vertex:vv,fragment:yv}),e=rr.from({fragment:{source:Xf,entryPoint:"mainFragment"},vertex:{source:Xf,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:E.WHITE.source,uSampler:new hl({}),uniforms:{uTranslationMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new et(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Zs,jf=x(()=>{dt();Ae();Mn();mr();Ks();_v();Ev();Zs=class{constructor(t,e){this.state=$t.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new wt({uTranslationMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new ql,this.state=$t.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new Yl({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=qr(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Br(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Hn,Av=x(()=>{C();fv();jf();Hn=class extends Zs{constructor(t){super(t,new jl)}};Hn.extension={type:[y.WebGLPipes],name:"particle"}});var Kl,wv=x(()=>{"use strict";Kl=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Vn,Cv=x(()=>{C();wv();jf();Vn=class extends Zs{constructor(t){super(t,new Kl)}};Vn.extension={type:[y.WebGPUPipes],name:"particle"}});var Yf=x(()=>{C();Av();Cv();G.add(Hn);G.add(Vn)});var Ir,Wn=x(()=>{"use strict";Ir=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function zn(i,t){let{texture:e,bounds:r}=i;vl(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var qf=x(()=>{Xd()});var $n,Pv=x(()=>{C();Te();Wn();qf();$n=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,zn(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:J.get(Ir)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};$n.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"text"}});var Kf,Oe,Qs=x(()=>{Rt();mn();Kf=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=$.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=$r(t),e=$r(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Oe=new Kf});function Rv(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function Mv(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function Bv(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,h=0,l=e-1,c=r-1;for(;h<r&&Rv(n,e,h);)++h;if(h===r)return st.EMPTY;for(;Rv(n,e,c);)--c;for(;Mv(n,e,a,h,c);)++a;for(;Mv(n,e,l,h,c);)--l;return++l,++c,new st(a/t,h/t,(l-a)/t,(c-h)/t)}var Iv=x(()=>{he()});var Fv,Qr,Zl=x(()=>{dt();me();Fv={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Qr=class{constructor(t,e){this.uid=nt("fillPattern"),this.transform=new I,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Fv[e].addressModeU,t.source.style.addressModeV=Fv[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var Uv=K((fz,Gv)=>{Gv.exports=KM;var Zf={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},qM=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function KM(i){var t=[];return i.replace(qM,function(e,r,s){var o=r.toLowerCase();for(s=QM(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Zf[o])return s.unshift(r),t.push(s);if(s.length<Zf[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Zf[o])))}}),t}var ZM=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function QM(i){var t=i.match(ZM);return t?t.map(Number):[]}});function Ov(i,t){let e=(0,kv.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){case"M":o=c[1],n=c[2],t.moveTo(o,n);break;case"m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case"H":o=c[1],t.lineTo(o,n);break;case"h":o+=c[1],t.lineTo(o,n);break;case"V":n=c[1],t.lineTo(o,n);break;case"v":n+=c[1],t.lineTo(o,n);break;case"L":o=c[1],n=c[2],t.lineTo(o,n);break;case"l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case"C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case"c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case"S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case"s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case"q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case"t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case"A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:O(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var kv,Lv=x(()=>{kv=Gi(Uv(),1);At()});var Ql,Dv=x(()=>{he();Ql=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(r-h)}getBounds(t){return t||(t=new st),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Jl,Nv=x(()=>{he();Jl=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),h=r-a,l=o-h,c=n-h,u=o+a,d=n+a,f=t-this.x,p=e-this.y,m=f*f/(l*l)+p*p/(c*c),g=f*f/(u*u)+p*p/(d*d);return m>1&&g<=1}getBounds(t){return t||(t=new st),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Hv(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,c=n*h+a*l,u=h*h+l*l,d=-1;u!==0&&(d=c/u);let f,p;d<0?(f=e,p=r):d>1?(f=s,p=o):(f=e+d*h,p=r+d*l);let m=i-f,g=t-p;return m*m+g*g}var Vv=x(()=>{"use strict"});var JM,tB,Js,Wv=x(()=>{Vv();he();Js=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],h=e[(s+3)%r];t+=(a-o)*(h+n)}return t<0}containsPolygon(t){let e=this.getBounds(JM),r=t.getBounds(tB);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){let u=h[c],d=h[c+1],f=h[(c+2)%h.length],p=h[(c+3)%h.length],m=Hv(t,e,u,d,f,p),g=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(m<=(g<0?a:n))return!0}return!1}getBounds(t){t||(t=new st);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],c=e[a+1];r=l<r?l:r,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var tc,ec,zv=x(()=>{he();tc=(i,t,e,r,s,o,n)=>{let a=i-e,h=t-r,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},ec=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new st),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=r*(1-s),u=r-c,d=o+l,f=n+l,p=a-l*2,m=h-l*2,g=o+a,b=n+h;return(t>=o-c&&t<=o+u||t>=g-u&&t<=g+c)&&e>=f&&e<=f+m||(e>=n-c&&e<=n+u||e>=b-u&&e<=b+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&tc(t,e,d,f,l,u,c)||t>g-l&&e<f&&tc(t,e,g-l,f,l,u,c)||t>g-l&&e>b-l&&tc(t,e,g-l,b-l,l,u,c)||t<d&&e>b-l&&tc(t,e,d,b-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function ic(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??qs.defaultOptions.bezierSmoothness)),d=(rB-u)/1;return d*=d,iB(t,e,r,s,o,n,a,h,i,d),i}function iB(i,t,e,r,s,o,n,a,h,l){Jf(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a)}function Jf(i,t,e,r,s,o,n,a,h,l,c){if(c>eB)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,p=(e+s)/2,m=(r+o)/2,g=(s+n)/2,b=(o+a)/2,_=(d+p)/2,v=(f+m)/2,T=(p+g)/2,A=(m+b)/2,S=(_+T)/2,w=(v+A)/2;if(c>0){let M=n-i,P=a-t,R=Math.abs((e-n)*P-(r-a)*M),B=Math.abs((s-n)*P-(o-a)*M),F,W;if(R>rc&&B>rc){if((R+B)*(R+B)<=l*(M*M+P*P)){if(to<Qf){h.push(S,w);return}let D=Math.atan2(o-r,s-e);if(F=Math.abs(D-Math.atan2(r-t,e-i)),W=Math.abs(Math.atan2(a-o,n-s)-D),F>=u&&(F=2*u-F),W>=u&&(W=2*u-W),F+W<to){h.push(S,w);return}if(Qi!==0){if(F>Qi){h.push(e,r);return}if(W>Qi){h.push(s,o);return}}}}else if(R>rc){if(R*R<=l*(M*M+P*P)){if(to<Qf){h.push(S,w);return}if(F=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),F>=u&&(F=2*u-F),F<to){h.push(e,r),h.push(s,o);return}if(Qi!==0&&F>Qi){h.push(e,r);return}}}else if(B>rc){if(B*B<=l*(M*M+P*P)){if(to<Qf){h.push(S,w);return}if(F=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),F>=u&&(F=2*u-F),F<to){h.push(e,r),h.push(s,o);return}if(Qi!==0&&F>Qi){h.push(s,o);return}}}else if(M=S-(i+n)/2,P=w-(t+a)/2,M*M+P*P<=l){h.push(S,w);return}}Jf(i,t,d,f,_,v,S,w,h,l,c+1),Jf(S,w,T,A,g,b,n,a,h,l,c+1)}var eB,rc,rB,Qf,to,Qi,tp=x(()=>{$l();eB=8,rc=11920929e-14,rB=1,Qf=.01,to=0,Qi=0});function Xv(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??qs.defaultOptions.bezierSmoothness)),c=(nB-l)/1;return c*=c,hB(t,e,r,s,o,n,i,c),i}function hB(i,t,e,r,s,o,n,a){ep(n,i,t,e,r,s,o,a,0),n.push(s,o)}function ep(i,t,e,r,s,o,n,a,h){if(h>sB)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,p=(c+d)/2,m=(u+f)/2,g=o-t,b=n-e,_=Math.abs((r-o)*b-(s-n)*g);if(_>oB){if(_*_<=a*(g*g+b*b)){if($v<aB){i.push(p,m);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=l&&(v=2*l-v),v<$v){i.push(p,m);return}}}else if(g=p-(t+o)/2,b=m-(e+n)/2,g*g+b*b<=a){i.push(p,m);return}ep(i,t,e,c,u,p,m,a,h+1),ep(i,p,m,d,f,o,n,a,h+1)}var sB,oB,nB,aB,$v,jv=x(()=>{$l();sB=8,oB=11920929e-14,nB=1,aB=.01,$v=0});function sc(i,t,e,r,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),p=t+d*r,m=e+f*r;i.push(p,m),c+=l}}var rp=x(()=>{"use strict"});function Yv(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,c=s-e,u=r-t,d=Math.abs(h*u-l*c);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=h*h+l*l,p=c*c+u*u,m=h*c+l*u,g=o*Math.sqrt(f)/d,b=o*Math.sqrt(p)/d,_=g*m/f,v=b*m/p,T=g*u+b*l,A=g*c+b*h,S=l*(b+_),w=h*(b+_),M=u*(g+v),P=c*(g+v),R=Math.atan2(w-A,S-T),B=Math.atan2(P-A,M-T);sc(i,T+t,A+e,o,R,B,l*c>u*h)}var qv=x(()=>{rp()});function lB(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function Zv(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*Xn/360),u=Math.cos(a*Xn/360),d=u*(t-r)/2+c*(e-s)/2,f=-c*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),cB(t,e,r,s,o,n,h,l,c,u,d,f,ip);let{ang1:m,ang2:g}=ip,{centerX:b,centerY:_}=ip,v=Math.abs(g)/(Xn/4);Math.abs(1-v)<1e-7&&(v=1);let T=Math.max(Math.ceil(v),1);g/=T;let A=i[i.length-2],S=i[i.length-1],w={x:0,y:0};for(let M=0;M<T;M++){let P=lB(m,g),{x:R,y:B}=sp(P[0],o,n,u,c,b,_,w),{x:F,y:W}=sp(P[1],o,n,u,c,b,_,w),{x:D,y:it}=sp(P[2],o,n,u,c,b,_,w);ic(i,A,S,R,B,F,W,D,it),A=D,S=it,m+=g}}var Xn,ip,sp,Kv,cB,Qv=x(()=>{tp();Xn=Math.PI*2,ip={centerX:0,centerY:0,ang1:0,ang2:0},sp=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,c=o*i+s*t;return h.x=l+n,h.y=c+a,h};Kv=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},cB=(i,t,e,r,s,o,n,a,h,l,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(c,2),g=Math.pow(u,2),b=f*p-f*g-p*m;b<0&&(b=0),b/=f*g+p*m,b=Math.sqrt(b)*(n===a?-1:1);let _=b*s/o*u,v=b*-o/s*c,T=l*_-h*v+(i+e)/2,A=h*_+l*v+(t+r)/2,S=(c-_)/s,w=(u-v)/o,M=(-c-_)/s,P=(-u-v)/o,R=Kv(1,0,S,w),B=Kv(S,w,M,P);a===0&&B>0&&(B-=Xn),a===1&&B<0&&(B+=Xn),d.centerX=T,d.centerY=A,d.ang1=R,d.ang2=B}});function Jv(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,d=l/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],c=r(a,o),u=r(a,l);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let m=d/2,g,b=Math.abs(Math.cos(m)*h/Math.sin(m));b>Math.min(c.len/2,u.len/2)?(b=Math.min(c.len/2,u.len/2),g=Math.abs(b*Math.sin(m)/Math.cos(m))):g=h;let _=a.x+u.nx*b+-u.ny*g*f,v=a.y+u.ny*b+u.nx*g*f,T=Math.atan2(c.ny,c.nx)+Math.PI/2*f,A=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(_+Math.cos(T)*g,v+Math.sin(T)*g),i.arc(_,v,g,T,A,p),o=a}}function t0(i,t,e,r){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?i.moveTo(h.x,h.y):i.lineTo(h.x,h.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,h),f;if(d<1e-4)f=h;else{let g=Math.min(d/2,l);f=o(h,c,g/d)}let p=s(u,h),m;if(p<1e-4)m=h;else{let g=Math.min(p/2,l);m=o(h,u,g/p)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(h.x,h.y,m.x,m.y,r)}}var e0=x(()=>{"use strict"});var uB,oc,r0=x(()=>{Dv();Nv();Wv();he();zv();Be();tp();jv();rp();qv();Qv();e0();uB=new st,oc=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Et,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return sc(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Yv(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return Zv(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return ic(this._currentPoly.points,h.lastX,h.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Xv(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new st(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Ql(t,e,r),s),this}poly(t,e,r){let s=new Js(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let c=0;c<s;c++){let u=a-c*h;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let h=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*c+l,p=t+r*Math.cos(f),m=e+r*Math.sin(f),g=f+Math.PI+u,b=f-Math.PI-u,_=p+o*Math.cos(g),v=m+o*Math.sin(g),T=p+o*Math.cos(b),A=m+o*Math.sin(b);d===0?this.moveTo(_,v):this.lineTo(_,v),this.quadraticCurveTo(p,m,T,A,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?t0(this,t,e,s):Jv(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+r,l=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+r-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),h=t+r,l=e+s,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new Jl(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new ec(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new Js,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Js,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(uB);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function jn(i,t){return i?i.prepend(t):t.clone()}var Si,op=x(()=>{Qe();me();At();Lv();r0();Si=class i{constructor(t,e=!1){this.instructions=[],this.uid=nt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Ov(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new oc(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(at.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=n.data[2],l=n.data[3];let c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(at.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let h=o.x,l=o.y;n=h+(h-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=r*2,c=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,p=d*c+h;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0;for(let g=0;g<this.instructions.length;g++){let b=this.instructions[g],_=b.data;switch(b.action){case"moveTo":case"lineTo":h=_[0],l=_[1],_[0]=e*h+s*l+n,_[1]=r*h+o*l+a;break;case"bezierCurveTo":c=_[0],u=_[1],d=_[2],f=_[3],h=_[4],l=_[5],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*d+s*f+n,_[3]=r*d+o*f+a,_[4]=e*h+s*l+n,_[5]=r*h+o*l+a;break;case"quadraticCurveTo":c=_[0],u=_[1],h=_[2],l=_[3],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*h+s*l+n,_[3]=r*h+o*l+a;break;case"arcToSvg":h=_[5],l=_[6],p=_[0],m=_[1],_[0]=e*p+s*m,_[1]=r*p+o*m,_[5]=e*h+s*l+n,_[6]=r*h+o*l+a;break;case"circle":_[4]=jn(_[3],t);break;case"rect":_[4]=jn(_[4],t);break;case"ellipse":_[8]=jn(_[8],t);break;case"roundRect":_[5]=jn(_[5],t);break;case"addPath":_[0].transform(t);break;case"poly":_[2]=jn(_[2],t);break;default:O("unknown transform action",b.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function kt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var np=x(()=>{"use strict"});function i0(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=dB(n);break;case"radialgradient":t.defs[n.id]=fB(n);break;default:break}}}}function dB(i){let t=kt(i,"x1",0),e=kt(i,"y1",0),r=kt(i,"x2",1),s=kt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new ke(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=kt(h,"offset",0),c=et.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c)}return n}function fB(i){return O("[SVG Parser] Radial gradients are not yet supported"),new ke(0,0,1,0)}var s0=x(()=>{fe();At();Ys();np()});function ap(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var o0=x(()=>{"use strict"});function hp(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in n0){let a=i.getAttribute(n);a&&a0(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,c]=h.split(":");n0[l]&&a0(t,o,l,c.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function a0(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=ap(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=et.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=ap(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=et.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var n0,h0=x(()=>{fe();o0();n0={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function l0(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new Si};i0(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=hp(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&c0(a,e,s,o)}return t}function c0(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=hp(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let h,l,c,u,d,f,p,m,g,b,_,v,T,A,S,w,M;switch(i.nodeName.toLowerCase()){case"path":A=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&O("SVG Evenodd fill rule not supported, your svg may render incorrectly"),S=new Si(A,!0),t.context.path(S),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":p=kt(i,"cx",0),m=kt(i,"cy",0),g=kt(i,"r",0),t.context.ellipse(p,m,g,g),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":h=kt(i,"x",0),l=kt(i,"y",0),w=kt(i,"width",0),M=kt(i,"height",0),b=kt(i,"rx",0),_=kt(i,"ry",0),b||_?t.context.roundRect(h,l,w,M,b||_):t.context.rect(h,l,w,M),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":p=kt(i,"cx",0),m=kt(i,"cy",0),b=kt(i,"rx",0),_=kt(i,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,b,_),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":c=kt(i,"x1",0),u=kt(i,"y1",0),d=kt(i,"x2",0),f=kt(i,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),v=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),v=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{O(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<s.length;P++)c0(s[P],t,e,r)}var u0=x(()=>{At();op();s0();np();h0()});function pB(i){return et.isColorLike(i)}function d0(i){return i instanceof Qr}function f0(i){return i instanceof ke}function mB(i){return i instanceof E}function gB(i,t,e){let r=et.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=E.WHITE,{...e,...i}}function xB(i,t,e){return i.texture=t,{...e,...i}}function p0(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function m0(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function _B(i,t){let e={...t,...i},r=et.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Jr(i,t){if(i==null)return null;let e={},r=i;return pB(i)?gB(e,i,t):mB(i)?xB(e,i,t):d0(i)?p0(e,i,t):f0(i)?m0(e,i,t):r.fill&&d0(r.fill)?p0(r,r.fill,t):r.fill&&f0(r.fill)?m0(r,r.fill,t):_B(r,t)}function eo(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=Jr(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var lp=x(()=>{fe();vt();Ys();Zl()});var yB,g0,cp,we,nc=x(()=>{_e();fe();dt();Qe();vt();me();Dt();Be();op();u0();lp();yB=new at,g0=new I,cp=class Fr extends Pt{constructor(){super(...arguments),this.uid=nt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Si,this._transform=new I,this._fillStyle={...Fr.defaultFillStyle},this._strokeStyle={...Fr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Et,this._boundsDirty=!0}clone(){let t=new Fr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=Jr(t,Fr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=eo(t,Fr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Jr(t,Fr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Jr(t,Fr.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?et.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Si,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(z(Q,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Jr(t,Fr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(at.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=eo(t,Fr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*r+h.c*s+h.tx,h.b*r+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,l0(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof I?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof I?(this._transform.append(t),this):(g0.set(t,e,r,s,o,n),this._transform.append(g0),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let d=l[c].transform,f=d?d.applyInverse(t,yB):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let m=h;r=u.strokeContains(f.x,f.y,m.width,m.alignment)}let p=n.hole;if(p){let m=p.shapePath?.shapePrimitives;if(m)for(let g=0;g<m.length;g++)m[g].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};cp.defaultFillStyle={color:16777215,alpha:1,texture:E.WHITE,matrix:null,fill:null,textureSpace:"local"};cp.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:E.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};we=cp});function ac(i){let t=[],e=0;for(let r=0;r<x0.length;r++){let s=`_${x0[r]}`;t[e++]=i[s]}return e=_0(i._fill,t,e),e=bB(i._stroke,t,e),e=vB(i.dropShadow,t,e),t.join("-")}function _0(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function bB(i,t,e){return i&&(e=_0(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function vB(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=et.shared.setValue(i.color).toNumber()),e}var x0,up=x(()=>{fe();x0=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function TB(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Mt.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){z(Q,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(et.isColorLike(e))r.color=e;else if(e instanceof ke||e instanceof Qr)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){z(Q,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Mt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new ke({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>et.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var dp,Mt,Ji=x(()=>{_e();fe();Dt();Ys();Zl();nc();lp();up();dp=class ro extends Pt{constructor(t={}){super(),TB(t);let e={...ro.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...ro.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ro.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...we.defaultFillStyle,...t},()=>{this._fill=Jr({...this._originalFill},we.defaultFillStyle)})),this._fill=Jr(t===0?"black":t,we.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...we.defaultStrokeStyle,...t},()=>{this._stroke=eo({...this._originalStroke},we.defaultStrokeStyle)})),this._stroke=eo(t,we.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ac(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=ro.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ro({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(et.isColorLike(t)||t instanceof ke||t instanceof Qr)}};dp.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};dp.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};Mt=dp});function hc(i,t,e,r){let s=SB;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=Nt.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var SB,fp=x(()=>{ui();Be();SB=new Et});function ts(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!EB.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var EB,lc=x(()=>{"use strict";EB=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var pp,gr,Xt,Yn=x(()=>{Rt();lc();pp={willReadFrequently:!0},gr=class j{static get experimentalLetterSpacingSupported(){let t=j._experimentalLetterSpacingSupported;if(t!==void 0){let e=$.get().getCanvasRenderingContext2D().prototype;t=j._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,h,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,r=j._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(j._measurementCache[o])return j._measurementCache[o];let n=ts(e),a=j.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=j.__context;h.font=n;let c=(s?j._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let _=0;_<c.length;_++){let v=j._measureText(c[_],e.letterSpacing,h);u[_]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let m=e.lineHeight||a.fontSize,g=Math.max(m,a.fontSize+f)+(c.length-1)*(m+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new j(t,e,p,g,c,u,m+e.leading,d,a)}static _measureText(t,e,r){let s=!1;j.experimentalLetterSpacingSupported&&(j.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let c=(j.graphemeSegmenter(t).length-1)*e;n+=c,l+=c}return Math.max(n,l)}static _wordWrap(t,e,r=j._canvas){let s=r.getContext("2d",pp),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=j._collapseSpaces(c),d=j._collapseNewlines(c),f=!u,p=e.wordWrapWidth+l,m=j._tokenize(t);for(let g=0;g<m.length;g++){let b=m[g];if(j._isNewline(b)){if(!d){a+=j._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let v=j.isBreakingSpace(b),T=j.isBreakingSpace(n[n.length-1]);if(v&&T)continue}let _=j._getFromCache(b,l,h,s);if(_>p)if(n!==""&&(a+=j._addLine(n),n="",o=0),j.canBreakWords(b,e.breakWords)){let v=j.wordWrapSplit(b);for(let T=0;T<v.length;T++){let A=v[T],S=A,w=1;for(;v[T+w];){let P=v[T+w];if(!j.canBreakChars(S,P,b,T,e.breakWords))A+=P;else break;S=P,w++}T+=w-1;let M=j._getFromCache(A,l,h,s);M+o>p&&(a+=j._addLine(n),f=!1,n="",o=0),n+=A,o+=M}}else{n.length>0&&(a+=j._addLine(n),n="",o=0);let v=g===m.length-1;a+=j._addLine(b,!v),f=!1,n="",o=0}else _+o>p&&(f=!1,a+=j._addLine(n),n="",o=0),(n.length>0||!j.isBreakingSpace(b)||f)&&(n+=b,o+=_)}return a+=j._addLine(n,!1),a}static _addLine(t,e=!0){return t=j._trimRight(t),t=e?`${t}
|
|
368
|
+
`:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=j._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!j.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:j._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:j._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(j.isBreakingSpace(o,n)||j._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return j.graphemeSegmenter(t)}static measureFont(t){if(j._fonts[t])return j._fonts[t];let e=j._context;e.font=t;let r=e.measureText(j.METRICS_STRING+j.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return j._fonts[t]=s,s}static clearMetrics(t=""){t?delete j._fonts[t]:j._fonts={}}static get _canvas(){if(!j.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",pp)?.measureText)return j.__canvas=e,e;t=$.get().createCanvas()}catch{t=$.get().createCanvas()}t.width=t.height=10,j.__canvas=t}return j.__canvas}static get _context(){return j.__context||(j.__context=j._canvas.getContext("2d",pp)),j.__context}};gr.METRICS_STRING="|\xC9q\xC5";gr.BASELINE_SYMBOL="M";gr.BASELINE_MULTIPLIER=1.4;gr.HEIGHT_MULTIPLIER=2;gr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();gr.experimentalLetterSpacing=!1;gr._fonts={};gr._newlines=[10,13];gr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];gr._measurementCache={};Xt=gr});function io(i,t,e,r=0){if(i.texture===E.WHITE&&!i.fill)return et.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof Qr){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(I.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof ke){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+r,h=e.height+r);let l,c=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*h,d.x*a,d.y*h),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*h,d*a,f.x*a,f.y*h,p*a)}if(c&&n&&e){let u=e.lineHeight/h;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/h;s.colorStops.forEach(p=>{let m=f+p.offset*u;l.addColorStop(Math.floor(m*y0)/y0,et.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,et.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(I.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return O("FillStyle not recognised",i),"red"}var y0,mp=x(()=>{fe();dt();vt();At();Ys();Zl();y0=1e5});var qn,b0=x(()=>{fe();C();mn();Qs();ui();Iv();Dt();Ji();fp();Yn();lc();mp();qn=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=Xt.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=$r(o),n=$r(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(z("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Mt||(t.style=new Mt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Oe.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=Xt.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),h=Oe.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let c=hc(l,n,a,s);if(r.trim){let u=Bv(l,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Nt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Oe.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=ts(e),h=Xt.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=h.lineWidths,d=h.maxLineWidth,f=h.fontProperties,p=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let _=e._stroke;n.lineWidth=_.width,n.miterLimit=_.miterLimit,n.lineJoin=_.join,n.lineCap=_.cap}n.font=a;let m,g,b=e.dropShadow?2:1;for(let _=0;_<b;++_){let v=e.dropShadow&&_===0,T=v?Math.ceil(Math.max(1,p)+e.padding*2):0,A=T*r;if(v){n.fillStyle="black",n.strokeStyle="black";let M=e.dropShadow,P=M.color,R=M.alpha;n.shadowColor=et.shared.setValue(P).setAlpha(R).toRgbaString();let B=M.blur*r,F=M.distance*r;n.shadowBlur=B,n.shadowOffsetX=Math.cos(M.angle)*F,n.shadowOffsetY=Math.sin(M.angle)*F+A}else{if(n.fillStyle=e._fill?io(e._fill,n,h):null,e._stroke?.width){let M=e._stroke.width*e._stroke.alignment;n.strokeStyle=io(e._stroke,n,h,M)}n.shadowColor="black"}let S=(c-f.fontSize)/2;c-f.fontSize<0&&(S=0);let w=e._stroke?.width??0;for(let M=0;M<l.length;M++)m=w/2,g=w/2+M*c+f.ascent+S,e.align==="right"?m+=d-u[M]:e.align==="center"&&(m+=(d-u[M])/2),e._stroke?.width&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[M],e,s,m+e.padding,g+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,h=e.letterSpacing,l=!1;if(Xt.experimentalLetterSpacingSupported&&(Xt.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=Xt.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let m=u[p];n?a.strokeText(m,c,o):a.fillText(m,c,o);let g="";for(let b=p+1;b<u.length;++b)g+=u[b];f=a.measureText(g).width,c+=d-f+h,d=f}}destroy(){this._activeTextures=null}};qn.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"canvasText"}});var gp=x(()=>{C();Pv();b0();G.add(qn);G.add($n)});var xr,xp=x(()=>{Dt();_l();nc();xr=class i extends mi{constructor(t){t instanceof we&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new we,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){z(Q,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){z(Q,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){z(Q,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==we.defaultStrokeStyle.width||t.color!==we.defaultStrokeStyle.color||t.alpha!==we.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return z(Q,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return z(Q,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return z(Q,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return z(Q,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return z(Q,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return z(Q,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var v0,T0,S0=x(()=>{"use strict";v0={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
369
369
|
struct LocalUniforms {
|
|
370
370
|
uColor:vec4<f32>,
|
|
371
371
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -462,16 +462,16 @@ fn mainFragment(
|
|
|
462
462
|
|
|
463
463
|
return coverage;
|
|
464
464
|
}
|
|
465
|
-
`}}});var _p,yp,cc,C0=x(()=>{dt();$i();bi();Fn();Gn();vi();kl();pr();Ae();S0();w0();cc=class extends Wt{constructor(){let t=new wt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new
|
|
466
|
-
`&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(
|
|
465
|
+
`}}});var _p,yp,cc,C0=x(()=>{dt();$i();bi();Fn();Gn();vi();kl();pr();Ae();S0();w0();cc=class extends Wt{constructor(){let t=new wt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=Je();_p??(_p=wr({name:"sdf-shader",bits:[Hs,Ws(e),v0,E0,Pr]})),yp??(yp=Cr({name:"sdf-shader",bits:[Vs,zs(e),T0,A0,Rr]})),super({glProgram:yp,gpuProgram:_p,resources:{localUniforms:t,batchSamplers:$s(e)}})}}});var so,bp=x(()=>{_e();Dt();so=class extends Pt{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 z(Q,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return z(Q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return z(Q,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return z(Q,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return z(Q,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function uc(i){if(i==="")return[];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,h=n;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var vp=x(()=>{"use strict"});var P0,Tp,M0=x(()=>{fe();he();Qs();Gs();vt();Dt();Yn();lc();mp();Ji();bp();vp();P0=class R0 extends so{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let e={...R0.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=E.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=ts(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=Xt.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=uc(t).filter(g=>!this._currentChars.includes(g)).filter((g,b,_)=>_.indexOf(g)===b);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,h=this._currentX,l=this._currentY,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let g=0;g<e.length;g++){let b=e[g],_=Xt.measureText(b,a,s,!1);_.lineHeight=_.height;let v=_.width*c,T=Math.ceil((a.fontStyle==="italic"?2:1)*v),A=_.height*c,S=T+u*2,w=A+u*2;if(f=!1,b!==`
|
|
466
|
+
`&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(w,d))),h+S>p&&(l+=d,d=w,h=0,l+d>m)){n.update();let P=this._nextPage();s=P.canvasAndContext.canvas,o=P.canvasAndContext.context,n=P.texture.source,l=0}let M=v/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:M,kerning:{}},f){this._drawGlyph(o,_,h+u,l+u,c,a);let P=n.width*c,R=n.height*c,B=new st(h/P*n.width,l/R*n.height,S/P*n.width,w/R*n.height);this.chars[b].texture=new E({source:n,frame:B}),h+=Math.ceil(S)}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return z(Q,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],h=r[o];h||(h=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let c=e.measureText(o+a).width,u=c-(h+l);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(h+l),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Oe.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new E({source:new Ge({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=ts(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;let s=e._stroke,o=s?.width??0;if(s&&(t.lineWidth=o,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=io(s,t)),e._fill&&(t.fillStyle=io(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=et.shared.setValue(n.color).toArray(),h=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=h,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,r,s,o,n){let a=e.text,h=e.fontProperties,c=(n._stroke?.width??0)*o,u=r+c/2,d=s-c/2,f=h.descent*o,p=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,d+p-f),n._fill&&t.fillText(a,u,d+p-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Oe.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};P0.defaultOptions={textureSize:512,style:new Mt,mipmap:!0};Tp=P0});function dc(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,h={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=p=>{let m=o.width;for(let g=0;g<h.index;g++){let b=p.positions[g];o.chars.push(p.chars[g]),o.charPositions.push(b+m)}o.width+=p.width,a=!1,h.width=0,h.index=0,h.chars.length=0},c=()=>{let p=o.chars.length-1;if(r){let m=o.chars[p];for(;m===" ";)o.width-=e.chars[m].xAdvance,m=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let p=0;p<i.length+1;p++){let m,g=p===i.length;g||(m=i[p]);let b=e.chars[m]||e.chars[" "];if(/(?:\s)/.test(m)||m==="\r"||m===`
|
|
467
467
|
`||g){if(!a&&t.wordWrap&&o.width+h.width-d>f?(c(),l(h),g||o.charPositions.push(0)):(h.start=o.width,l(h),g||o.charPositions.push(0)),m==="\r"||m===`
|
|
468
|
-
`)o.width!==0&&c();else if(!g){let w=b.xAdvance+(b.kerning[n]||0)+d;o.width+=w,o.spaceWidth=w,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=b.kerning[n]||0,w=b.xAdvance+T+d;h.positions[h.index++]=h.width+T,h.chars.push(m),h.width+=w}n=m}return c(),t.align==="center"?AB(s):t.align==="right"?wB(s):t.align==="justify"&&CB(s),s}function AB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function wB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function CB(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let c=0;c<r.charPositions.length;c++)c===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[c]+=n}}var Sp=x(()=>{"use strict"});var fc,Ep,Kn,Ap=x(()=>{gi();Dt();At();Ji();M0();Sp();vp();fc=0,Ep=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!xt.has(r)){let n=new Tp({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});fc++,fc>50&&O("BitmapText",`You have dynamically created ${fc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{fc--,xt.remove(r)}),xt.set(r,n)}let o=xt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return dc([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},W(Q,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Mt?s:new Mt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Tp({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=uc(e.chars);return a.ensureCharacters(h.join("")),xt.set(`${r}-bitmap`,a),a.once("destroy",()=>xt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=xt.get(e);r&&r.destroy()}},Kn=new Ep});function B0(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var Zn,I0=x(()=>{gi();C();Te();xp();C0();Ap();Sp();Zn=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);B0(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(J.return(e.customShader),e.customShader=null),J.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);B0(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Kn.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=J.get(cc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=dc(o,n,s,!0),l=0,c=n.padding,u=h.scale,d=h.width,f=h.height+h.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<h.lines.length;m++){let g=h.lines[m];for(let b=0;b<g.charPositions.length;b++){let _=o[l++],v=s.chars[_];v?.texture&&r.texture(v.texture,p||"black",Math.round(g.charPositions[b]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=J.get(xr);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=xt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};Zn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"bitmapText"}});var wp=x(()=>{C();I0();F.add(Zn)});var Qn,F0=x(()=>{C();vt();Te();Wn();qf();Qn=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,zn(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),zn(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:E.EMPTY,currentKey:"--",batchableSprite:J.get(Ir),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=E.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Qn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"htmlText"}});function G0(){let{userAgent:i}=z.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var U0=x(()=>{Rt()});var k0,O0,oo,Cp=x(()=>{"use strict";k0="http://www.w3.org/2000/svg",O0="http://www.w3.org/1999/xhtml",oo=class{constructor(){this.svgRoot=document.createElementNS(k0,"svg"),this.foreignObject=document.createElementNS(k0,"foreignObject"),this.domElement=document.createElementNS(O0,"div"),this.styleElement=document.createElementNS(O0,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function N0(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${et.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[V0(t)]:[],...i.dropShadow?[H0(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return PB(i.tagStyles,s),s.join(" ")}function H0(i){let t=et.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function V0(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${et.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${et.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function PB(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)D0[o]?s.push(D0[o](r[o])):L0[o]&&s.push(L0[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var L0,D0,W0=x(()=>{fe();L0={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},D0={fill:i=>`color: ${et.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:V0,dropShadow:H0}});var pc,z0=x(()=>{At();Ji();up();W0();pc=class i extends Mt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=ac(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=N0(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function $0(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(h){s[h]||(r.push(h),s[h]=!0)}if(Array.isArray(e))for(let h=0;h<e.length;h++)a(e[h]);else a(e);n&&n.forEach(h=>{let l=h.split(":")[1].trim();a(l)});for(let h in t.tagStyles){let l=t.tagStyles[h].fontFamily;a(l)}return r}var X0=x(()=>{"use strict"});async function j0(i){let e=await(await z.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var Y0=x(()=>{Rt()});async function Pp(i,t){let e=await j0(t);return`@font-face {
|
|
468
|
+
`)o.width!==0&&c();else if(!g){let A=b.xAdvance+(b.kerning[n]||0)+d;o.width+=A,o.spaceWidth=A,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=b.kerning[n]||0,A=b.xAdvance+T+d;h.positions[h.index++]=h.width+T,h.chars.push(m),h.width+=A}n=m}return c(),t.align==="center"?AB(s):t.align==="right"?wB(s):t.align==="justify"&&CB(s),s}function AB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function wB(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function CB(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let c=0;c<r.charPositions.length;c++)c===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[c]+=n}}var Sp=x(()=>{"use strict"});var fc,Ep,Kn,Ap=x(()=>{gi();Dt();At();Ji();M0();Sp();vp();fc=0,Ep=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!xt.has(r)){let n=new Tp({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});fc++,fc>50&&O("BitmapText",`You have dynamically created ${fc} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{fc--,xt.remove(r)}),xt.set(r,n)}let o=xt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return dc([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},z(Q,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Mt?s:new Mt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Tp({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=uc(e.chars);return a.ensureCharacters(h.join("")),xt.set(`${r}-bitmap`,a),a.once("destroy",()=>xt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=xt.get(e);r&&r.destroy()}},Kn=new Ep});function B0(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var Zn,I0=x(()=>{gi();C();Te();xp();C0();Ap();Sp();Zn=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);B0(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(J.return(e.customShader),e.customShader=null),J.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);B0(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Kn.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=J.get(cc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=dc(o,n,s,!0),l=0,c=n.padding,u=h.scale,d=h.width,f=h.height+h.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m<h.lines.length;m++){let g=h.lines[m];for(let b=0;b<g.charPositions.length;b++){let _=o[l++],v=s.chars[_];v?.texture&&r.texture(v.texture,p||"black",Math.round(g.charPositions[b]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=J.get(xr);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=xt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};Zn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"bitmapText"}});var wp=x(()=>{C();I0();G.add(Zn)});var Qn,F0=x(()=>{C();vt();Te();Wn();qf();Qn=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),J.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,zn(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),zn(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:E.EMPTY,currentKey:"--",batchableSprite:J.get(Ir),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=E.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Qn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"htmlText"}});function G0(){let{userAgent:i}=$.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var U0=x(()=>{Rt()});var k0,O0,oo,Cp=x(()=>{"use strict";k0="http://www.w3.org/2000/svg",O0="http://www.w3.org/1999/xhtml",oo=class{constructor(){this.svgRoot=document.createElementNS(k0,"svg"),this.foreignObject=document.createElementNS(k0,"foreignObject"),this.domElement=document.createElementNS(O0,"div"),this.styleElement=document.createElementNS(O0,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function N0(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${et.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[V0(t)]:[],...i.dropShadow?[H0(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return PB(i.tagStyles,s),s.join(" ")}function H0(i){let t=et.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function V0(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${et.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${et.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function PB(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)D0[o]?s.push(D0[o](r[o])):L0[o]&&s.push(L0[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var L0,D0,W0=x(()=>{fe();L0={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},D0={fill:i=>`color: ${et.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:V0,dropShadow:H0}});var pc,z0=x(()=>{At();Ji();up();W0();pc=class i extends Mt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=ac(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=N0(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function $0(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(h){s[h]||(r.push(h),s[h]=!0)}if(Array.isArray(e))for(let h=0;h<e.length;h++)a(e[h]);else a(e);n&&n.forEach(h=>{let l=h.split(":")[1].trim();a(l)});for(let h in t.tagStyles){let l=t.tagStyles[h].fontFamily;a(l)}return r}var X0=x(()=>{"use strict"});async function j0(i){let e=await(await $.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var Y0=x(()=>{Rt()});async function Pp(i,t){let e=await j0(t);return`@font-face {
|
|
469
469
|
font-family: "${i.fontFamily}";
|
|
470
470
|
src: url('${e}');
|
|
471
471
|
font-weight: ${i.fontWeight};
|
|
472
472
|
font-style: ${i.fontStyle};
|
|
473
473
|
}`}var q0=x(()=>{Y0()});async function K0(i,t,e){let r=i.filter(s=>xt.has(`${s}-and-url`)).map((s,o)=>{if(!mc.has(s)){let{url:n}=xt.get(`${s}-and-url`);o===0?mc.set(s,Pp({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):mc.set(s,Pp({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return mc.get(s)});return(await Promise.all(r)).join(`
|
|
474
|
-
`)}var mc,Z0=x(()=>{gi();q0();mc=new Map});function Q0(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:h,height:l}=s.image;return a.setAttribute("width",h.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var J0=x(()=>{"use strict"});function tT(i,t){let e=Oe.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var eT=x(()=>{Qs()});function rT(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r()},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous"})}var iT=x(()=>{"use strict"});function oT(i,t,e,r){r||(r=sT||(sT=new oo));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let h=t.padding*2;return{width:a.width-h,height:a.height-h}}var sT,nT=x(()=>{Cp()});var no,aT=x(()=>{C();Qs();ui();Mr();U0();At();Te();fp();Cp();z0();X0();Z0();J0();eT();iT();nT();no=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Qt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=J.get(oo),o=$0(t,r),n=await K0(o,r,pc.defaultTextStyle),a=oT(t,r,n,s),h=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let d=Q0(t,r,e,n,s);await rT(c,d,G0()&&o.length>0);let f=c,p;this._createCanvas&&(p=tT(c,e));let m=hc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(m.source),Oe.returnCanvasAndContext(p)),J.return(s),m}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{O("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){Nt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};no.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"htmlText"};no.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var Rp=x(()=>{C();F0();aT();
|
|
474
|
+
`)}var mc,Z0=x(()=>{gi();q0();mc=new Map});function Q0(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:h,height:l}=s.image;return a.setAttribute("width",h.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var J0=x(()=>{"use strict"});function tT(i,t){let e=Oe.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var eT=x(()=>{Qs()});function rT(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r()},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous"})}var iT=x(()=>{"use strict"});function oT(i,t,e,r){r||(r=sT||(sT=new oo));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let h=t.padding*2;return{width:a.width-h,height:a.height-h}}var sT,nT=x(()=>{Cp()});var no,aT=x(()=>{C();Qs();ui();Mr();U0();At();Te();fp();Cp();z0();X0();Z0();J0();eT();iT();nT();no=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Qt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=J.get(oo),o=$0(t,r),n=await K0(o,r,pc.defaultTextStyle),a=oT(t,r,n,s),h=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let d=Q0(t,r,e,n,s);await rT(c,d,G0()&&o.length>0);let f=c,p;this._createCanvas&&(p=tT(c,e));let m=hc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(m.source),Oe.returnCanvasAndContext(p)),J.return(s),m}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{O("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){Nt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};no.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"htmlText"};no.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var Rp=x(()=>{C();F0();aT();G.add(no);G.add(Qn)});var hT,ao,gc=x(()=>{_i();Kr();Ls();Dt();hT=class lT extends tr{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(z(Q,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...lT.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new Vt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),h=new Vt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),l=new Vt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:ot.INDEX|ot.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:h,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};hT.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};ao=hT});var es,cT,ho,lo=x(()=>{"use strict";es={name:"local-uniform-bit",vertex:{header:`
|
|
475
475
|
|
|
476
476
|
struct LocalUniforms {
|
|
477
477
|
uTransformMatrix:mat3x3<f32>,
|
|
@@ -566,7 +566,7 @@ fn mainFragment(
|
|
|
566
566
|
|
|
567
567
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
568
568
|
|
|
569
|
-
`}}});var Mp,Bp,xc,pT=x(()=>{dt();bi();lo();vi();pr();Ae();vt();fT();xc=class extends Wt{constructor(){Mp??(Mp=wr({name:"tiling-sprite-shader",bits:[es,uT,Pr]})),Bp??(Bp=Cr({name:"tiling-sprite-shader",bits:[ho,dT,Rr]}));let t=new wt({uMapCoord:{value:new B,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new B,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Bp,gpuProgram:Mp,resources:{localUniforms:new wt({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:E.EMPTY.source,uSampler:E.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var _c,mT=x(()=>{gc();_c=class extends ao{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function gT(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var xT=x(()=>{"use strict"});function _T(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+h*f+c,i[e+1]=a*d+l*f+u,e+=t,s++}}var yT=x(()=>{"use strict"});function bT(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=B.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),_T(t,2,0,a)}var vT=x(()=>{dt();yT()});var yc,Jn,TT=x(()=>{C();Mn();mr();Mr();Ks();Xl();gc();pT();mT();xT();vT();yc=new _c,Jn=class{constructor(t){this._state=$t.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Ti);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new xc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Br(t.groupColorAlpha,r.uColor,0),this._state.blendMode=qr(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:yc,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new ao({indices:yc.indices,positions:yc.positions.slice(),uvs:yc.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),bT(t,r.uvs),gT(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===Qt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Jn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"tilingSprite"}});var Ip=x(()=>{C();TT();F.add(Jn)});var ST,AT,wT=x(()=>{Dt();gc();ST=class ET extends ao{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(W(Q,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...ET.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*h,f*l),s.push(d/n,f/a)}let c=n*a;for(let u=0;u<c;u++){let d=u%n,f=u/n|0,p=f*this.verticesX+d,m=f*this.verticesX+d+1,g=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(p,m,g,m,b,g)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};ST.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};AT=ST});var CT,RT,MT=x(()=>{wT();CT=class PT extends AT{constructor(t={}){t={...PT.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=r>d?1:r/d,p=Math.min(u,f),m=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*p-g,t[17]=t[19]=t[21]=t[23]=r-a*p-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};CT.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};RT=CT});var ta,BT=x(()=>{C();Te();Xl();MT();ta=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];J.return(e.geometry),J.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=J.get(Ti);return e.geometry=J.get(RT),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};ta.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"nineSliceSprite"}});var Fp=x(()=>{C();BT();F.add(ta)});var ea,IT=x(()=>{C();ea=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ea.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"filter"}});function FT(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var GT=x(()=>{"use strict"});var RB,ra,UT=x(()=>{C();dt();Qe();xi();Ls();Ae();vt();ui();Mr();Be();GT();At();RB=new tr({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),ra=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new wt({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 ce({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?FT(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=!0,c=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let p=r[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),h+=p.padding,p.antialias==="off"?l=!1:p.antialias==="inherit"&&l&&(l=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,c||(c=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=Nt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=E.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),Nt.returnTexture(r);else{let a=e.inputTexture,h=Nt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,!0);let u=a;a=h,h=u}n[l].apply(this,a,e.previousRenderSurface,!1),Nt.returnTexture(a),Nt.returnTexture(h)}e.blendRequired&&Nt.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Nt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=at.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,g=p.uInputSize,b=p.uInputPixel,_=p.uInputClamp,v=p.uGlobalFrame,T=p.uOutputTexture;if(c){let A=this._filterStackIndex;for(;A>0;){A--;let M=this._filterStack[this._filterStackIndex-1];if(!M.skip){h.x=M.bounds.minX,h.y=M.bounds.minY;break}}m[0]=a.minX-h.x,m[1]=a.minY-h.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],b[0]=e.source.pixelWidth,b[1]=e.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],_[0]=.5*b[2],_[1]=.5*b[3],_[2]=e.frame.width*g[2]-.5*b[2],_[3]=e.frame.height*g[3]-.5*b[3];let w=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=h.x*u,v[1]=h.y*u,v[2]=w.source.width*u,v[3]=w.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof E?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let A=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(A,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:RB,shader:t,state:t._state,topology:"triangle-list"}),o.type===Qt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Et,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(B.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};ra.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"filter"}});var Gp=x(()=>{C();IT();UT();F.add(ra);F.add(ea)});var MB={};var kT=x(()=>{O_();kd();$_();j_();bl();Cl();Wf();zf();Yf();gp();wp();Rp();Ip();Fp();Gp()});var BB={};var LT=x(()=>{kd();bl();Cl();Wf();zf();Yf();gp();wp();Rp();Ip();Fp();Gp()});var NT,HT,VT=x(()=>{ji();Ns();pr();mr();NT=class Up extends Wt{constructor(t){t={...Up.defaultOptions,...t},super(t),this.enabled=!0,this._state=$t.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=rr.from(e)),r&&(n=er.from(r)),new Up({gpuProgram:o,glProgram:n,...s})}};NT.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};HT=NT});async function WT(i){if(!i)for(let t=0;t<kp.length;t++){let e=kp[t];if(e.value.test()){await e.value.load();return}}}var kp,zT=x(()=>{C();kp=[];F.handleByNamedList(y.Environment,kp)});function bc(){if(typeof ia=="boolean")return ia;try{ia=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ia=!1}return ia}var ia,Op=x(()=>{"use strict"});var ue,co=x(()=>{"use strict";ue=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(ue||{})});var uo,Lp=x(()=>{"use strict";uo=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,h){let{name:l,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var IB,$T,Ei,sa=x(()=>{fe();zT();dr();Op();Dt();co();Lp();_e();IB=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],$T=class XT extends Pt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...IB,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await WT(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...XT.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof St&&(r={container:r},e&&(W(Q,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:et.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ue.ALL);let{clear:r,clearColor:s,target:o}=t;et.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,et.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new uo(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!bc())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};$T.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Ei=$T});var oa,qT=x(()=>{C();dt();$i();Ml();bi();Fn();Gn();lo();vi();pr();Ae();oa=class{init(){let t=new wt({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=wr({name:"graphics",bits:[Hs,Ws(Je()),cT,Pr]});this.shader=new Wt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;l.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=h.instructions,f=null;for(let p=0;p<h.instructionSize;p++){let m=d[p];if(m.topology!==f&&(f=m.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let g=m.textures;m.bindGroup=Os(g.textures,g.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,m.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};oa.extension={type:[y.WebGPUPipesAdaptor],name:"graphics"}});var KT,ZT,Dp=x(()=>{"use strict";KT={name:"texture-bit",vertex:{header:`
|
|
569
|
+
`}}});var Mp,Bp,xc,pT=x(()=>{dt();bi();lo();vi();pr();Ae();vt();fT();xc=class extends Wt{constructor(){Mp??(Mp=wr({name:"tiling-sprite-shader",bits:[es,uT,Pr]})),Bp??(Bp=Cr({name:"tiling-sprite-shader",bits:[ho,dT,Rr]}));let t=new wt({uMapCoord:{value:new I,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new I,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Bp,gpuProgram:Mp,resources:{localUniforms:new wt({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:E.EMPTY.source,uSampler:E.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var _c,mT=x(()=>{gc();_c=class extends ao{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function gT(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var xT=x(()=>{"use strict"});function _T(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+h*f+c,i[e+1]=a*d+l*f+u,e+=t,s++}}var yT=x(()=>{"use strict"});function bT(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=I.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),_T(t,2,0,a)}var vT=x(()=>{dt();yT()});var yc,Jn,TT=x(()=>{C();Mn();mr();Mr();Ks();Xl();gc();pT();mT();xT();vT();yc=new _c,Jn=class{constructor(t){this._state=$t.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new Ti);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new xc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Br(t.groupColorAlpha,r.uColor,0),this._state.blendMode=qr(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:yc,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new ao({indices:yc.indices,positions:yc.positions.slice(),uvs:yc.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),bT(t,r.uvs),gT(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===Qt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Jn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"tilingSprite"}});var Ip=x(()=>{C();TT();G.add(Jn)});var ST,AT,wT=x(()=>{Dt();gc();ST=class ET extends ao{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(z(Q,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...ET.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*h,f*l),s.push(d/n,f/a)}let c=n*a;for(let u=0;u<c;u++){let d=u%n,f=u/n|0,p=f*this.verticesX+d,m=f*this.verticesX+d+1,g=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(p,m,g,m,b,g)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};ST.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};AT=ST});var CT,RT,MT=x(()=>{wT();CT=class PT extends AT{constructor(t={}){t={...PT.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=r>d?1:r/d,p=Math.min(u,f),m=h*e,g=l*r;t[0]=t[8]=t[16]=t[24]=-m,t[2]=t[10]=t[18]=t[26]=s*p-m,t[4]=t[12]=t[20]=t[28]=e-o*p-m,t[6]=t[14]=t[22]=t[30]=e-m,t[1]=t[3]=t[5]=t[7]=-g,t[9]=t[11]=t[13]=t[15]=n*p-g,t[17]=t[19]=t[21]=t[23]=r-a*p-g,t[25]=t[27]=t[29]=t[31]=r-g,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};CT.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};RT=CT});var ta,BT=x(()=>{C();Te();Xl();MT();ta=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];J.return(e.geometry),J.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=J.get(Ti);return e.geometry=J.get(RT),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};ta.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"nineSliceSprite"}});var Fp=x(()=>{C();BT();G.add(ta)});var ea,IT=x(()=>{C();ea=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ea.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"filter"}});function FT(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var GT=x(()=>{"use strict"});var RB,ra,UT=x(()=>{C();dt();Qe();xi();Ls();Ae();vt();ui();Mr();Be();GT();At();RB=new tr({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),ra=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new wt({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 ce({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?FT(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=!0,c=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let p=r[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),h+=p.padding,p.antialias==="off"?l=!1:p.antialias==="inherit"&&l&&(l=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,c||(c=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=Nt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=E.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),Nt.returnTexture(r);else{let a=e.inputTexture,h=Nt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,!0);let u=a;a=h,h=u}n[l].apply(this,a,e.previousRenderSurface,!1),Nt.returnTexture(a),Nt.returnTexture(h)}e.blendRequired&&Nt.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Nt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=at.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,g=p.uInputSize,b=p.uInputPixel,_=p.uInputClamp,v=p.uGlobalFrame,T=p.uOutputTexture;if(c){let w=this._filterStackIndex;for(;w>0;){w--;let M=this._filterStack[this._filterStackIndex-1];if(!M.skip){h.x=M.bounds.minX,h.y=M.bounds.minY;break}}m[0]=a.minX-h.x,m[1]=a.minY-h.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],b[0]=e.source.pixelWidth,b[1]=e.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],_[0]=.5*b[2],_[1]=.5*b[3],_[2]=e.frame.width*g[2]-.5*b[2],_[3]=e.frame.height*g[3]-.5*b[3];let A=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=h.x*u,v[1]=h.y*u,v[2]=A.source.width*u,v[3]=A.source.height*u;let S=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof E?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=S.width,T[1]=S.height),T[2]=S.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(w,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:RB,shader:t,state:t._state,topology:"triangle-list"}),o.type===Qt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Et,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(I.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};ra.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"filter"}});var Gp=x(()=>{C();IT();UT();G.add(ra);G.add(ea)});var MB={};var kT=x(()=>{O_();kd();$_();j_();bl();Cl();Wf();zf();Yf();gp();wp();Rp();Ip();Fp();Gp()});var BB={};var LT=x(()=>{kd();bl();Cl();Wf();zf();Yf();gp();wp();Rp();Ip();Fp();Gp()});var NT,HT,VT=x(()=>{ji();Ns();pr();mr();NT=class Up extends Wt{constructor(t){t={...Up.defaultOptions,...t},super(t),this.enabled=!0,this._state=$t.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=rr.from(e)),r&&(n=er.from(r)),new Up({gpuProgram:o,glProgram:n,...s})}};NT.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};HT=NT});async function WT(i){if(!i)for(let t=0;t<kp.length;t++){let e=kp[t];if(e.value.test()){await e.value.load();return}}}var kp,zT=x(()=>{C();kp=[];G.handleByNamedList(y.Environment,kp)});function bc(){if(typeof ia=="boolean")return ia;try{ia=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ia=!1}return ia}var ia,Op=x(()=>{"use strict"});var ue,co=x(()=>{"use strict";ue=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(ue||{})});var uo,Lp=x(()=>{"use strict";uo=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,h){let{name:l,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var IB,$T,Ei,sa=x(()=>{fe();zT();dr();Op();Dt();co();Lp();_e();IB=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],$T=class XT extends Pt{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let e=[...IB,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await WT(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...XT.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof St&&(r={container:r},e&&(z(Q,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:et.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=ue.ALL);let{clear:r,clearColor:s,target:o}=t;et.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,et.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new uo(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!bc())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};$T.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Ei=$T});var oa,qT=x(()=>{C();dt();$i();Ml();bi();Fn();Gn();lo();vi();pr();Ae();oa=class{init(){let t=new wt({uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=wr({name:"graphics",bits:[Hs,Ws(Je()),cT,Pr]});this.shader=new Wt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;l.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=h.instructions,f=null;for(let p=0;p<h.instructionSize;p++){let m=d[p];if(m.topology!==f&&(f=m.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,m.topology)),s.groups[1]=m.bindGroup,!m.gpuBindGroup){let g=m.textures;m.bindGroup=Os(g.textures,g.count),m.gpuBindGroup=o.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,m.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};oa.extension={type:[y.WebGPUPipesAdaptor],name:"graphics"}});var KT,ZT,Dp=x(()=>{"use strict";KT={name:"texture-bit",vertex:{header:`
|
|
570
570
|
|
|
571
571
|
struct TextureUniforms {
|
|
572
572
|
uTextureMatrix:mat3x3<f32>,
|
|
@@ -592,7 +592,7 @@ fn mainFragment(
|
|
|
592
592
|
|
|
593
593
|
`,main:`
|
|
594
594
|
outColor = texture(uTexture, vUV);
|
|
595
|
-
`}}});var na,QT=x(()=>{C();dt();bi();lo();vi();Dp();pr();vt();At();na=class{init(){let t=wr({name:"mesh",bits:[es,KT,Pr]});this._shader=new Wt({gpuProgram:t,resources:{uTexture:E.EMPTY._source,uSampler:E.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){O("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};na.extension={type:[y.WebGPUPipesAdaptor],name:"mesh"}});var Sc,aa,JT=x(()=>{C();mr();Ml();Sc=$t.for2d(),aa=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),Sc.blendMode="normal",s.pipeline.getPipeline(e,n,Sc);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let h=e.textures;e.bindGroup=Os(h.textures,h.count)}Sc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Sc,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};aa.extension={type:[y.WebGPUPipesAdaptor],name:"batch"}});var ha,tS=x(()=>{C();ha=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};ha.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"customRender"}});function la(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var Np=x(()=>{"use strict"});var FB,ca,eS=x(()=>{C();dt();Te();Wn();Np();FB=new B,ca=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(J.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=J.get(Ir));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=FB.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),la(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),la(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};ca.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"renderGroup"}});function ua(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var Hp=x(()=>{"use strict"});function Vp(i,t=!1){UB(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,h=n.index;for(let l=0;l<h;l++){let c=a[l];c.parentRenderGroup===i&&c.relativeRenderGroupDepth===o&&sS(c,r,0)}ua(a,h),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Vp(i.renderGroupChildren[s],t)}function UB(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=As(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function sS(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&rS&&iS(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&rS&&iS(i,GB,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)sS(o[l],t,e);let a=i.parentRenderGroup,h=i;h.renderPipeId&&!a.structureDidChange&&a.updateRenderable(h)}}function iS(i,t,e){if(e&Rs){i.groupColor=As(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&gn&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Vi&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var GB,rS,oS=x(()=>{dr();Hp();gd();GB=new St,rS=Vi|Rs|gn});function nS(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var aS=x(()=>{"use strict"});var kB,da,hS=x(()=>{C();dt();ui();Be();Hp();Np();oS();aS();kB=new B,da=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=kB;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),la(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&Nt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Nt.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new Et),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Nt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?ua(t.childrenRenderablesToUpdate.list,0):nS(t,r),Vp(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}ua(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};da.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"renderGroup"}});var fa,lS=x(()=>{C();Te();Wn();fa=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];J.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=J.get(Ir);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)J.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};fa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"sprite"}});var fo,Wp=x(()=>{_e();fo="8.9.2"});var pa,ma,zp=x(()=>{C();Wp();pa=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,fo)}static destroy(){}};pa.extension=y.Application;ma=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,fo)}destroy(){this._renderer=null}};ma.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"initHook",priority:-10}});var $p,Xp,uS=x(()=>{C();mr();Tf();$p=class cS{constructor(t,e){this.state=$t.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new Un)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=cS.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};$p.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"batch"};$p._availableBatchers=Object.create(null);Xp=$p;F.handleByMap(y.Batcher,Xp._availableBatchers);F.add(Un)});var dS,fS=x(()=>{dS=`in vec2 vMaskCoord;
|
|
595
|
+
`}}});var na,QT=x(()=>{C();dt();bi();lo();vi();Dp();pr();vt();At();na=class{init(){let t=wr({name:"mesh",bits:[es,KT,Pr]});this._shader=new Wt({gpuProgram:t,resources:{uTexture:E.EMPTY._source,uSampler:E.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new I}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){O("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};na.extension={type:[y.WebGPUPipesAdaptor],name:"mesh"}});var Sc,aa,JT=x(()=>{C();mr();Ml();Sc=$t.for2d(),aa=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),Sc.blendMode="normal",s.pipeline.getPipeline(e,n,Sc);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let h=e.textures;e.bindGroup=Os(h.textures,h.count)}Sc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Sc,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};aa.extension={type:[y.WebGPUPipesAdaptor],name:"batch"}});var ha,tS=x(()=>{C();ha=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}};ha.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"customRender"}});function la(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var Np=x(()=>{"use strict"});var FB,ca,eS=x(()=>{C();dt();Te();Wn();Np();FB=new I,ca=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(J.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=J.get(Ir));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=FB.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),la(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),la(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};ca.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"renderGroup"}});function ua(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var Hp=x(()=>{"use strict"});function Vp(i,t=!1){UB(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,h=n.index;for(let l=0;l<h;l++){let c=a[l];c.parentRenderGroup===i&&c.relativeRenderGroupDepth===o&&sS(c,r,0)}ua(a,h),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Vp(i.renderGroupChildren[s],t)}function UB(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=As(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function sS(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&rS&&iS(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&rS&&iS(i,GB,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)sS(o[l],t,e);let a=i.parentRenderGroup,h=i;h.renderPipeId&&!a.structureDidChange&&a.updateRenderable(h)}}function iS(i,t,e){if(e&Rs){i.groupColor=As(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&gn&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Vi&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var GB,rS,oS=x(()=>{dr();Hp();gd();GB=new St,rS=Vi|Rs|gn});function nS(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var aS=x(()=>{"use strict"});var kB,da,hS=x(()=>{C();dt();ui();Be();Hp();Np();oS();aS();kB=new I,da=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=kB;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),la(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&Nt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Nt.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new Et),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Nt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?ua(t.childrenRenderablesToUpdate.list,0):nS(t,r),Vp(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}ua(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};da.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"renderGroup"}});var fa,lS=x(()=>{C();Te();Wn();fa=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];J.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=J.get(Ir);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)J.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};fa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"sprite"}});var fo,Wp=x(()=>{_e();fo="8.9.2"});var pa,ma,zp=x(()=>{C();Wp();pa=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,fo)}static destroy(){}};pa.extension=y.Application;ma=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,fo)}destroy(){this._renderer=null}};ma.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"initHook",priority:-10}});var $p,Xp,uS=x(()=>{C();mr();Tf();$p=class cS{constructor(t,e){this.state=$t.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new Un)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=cS.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};$p.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"batch"};$p._availableBatchers=Object.create(null);Xp=$p;G.handleByMap(y.Batcher,Xp._availableBatchers);G.add(Un)});var dS,fS=x(()=>{dS=`in vec2 vMaskCoord;
|
|
596
596
|
in vec2 vTextureCoord;
|
|
597
597
|
|
|
598
598
|
uniform sampler2D uTexture;
|
|
@@ -761,9 +761,9 @@ fn mainFragment(
|
|
|
761
761
|
|
|
762
762
|
return source * a;
|
|
763
763
|
}
|
|
764
|
-
`});var Ec,xS=x(()=>{dt();ji();Ns();Ae();wd();VT();fS();mS();gS();Ec=class extends HT{constructor(t){let{sprite:e,...r}=t,s=new Ps(e.texture),o=new wt({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=rr.from({vertex:{source:jp,entryPoint:"mainVertex"},fragment:{source:jp,entryPoint:"mainFragment"}}),a=er.from({vertex:pS,fragment:dS,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,s)}}});var OB,Yp,ga,_S=x(()=>{C();el();xS();Be();fn();Tl();Te();vt();ui();Mr();OB=new Et,Yp=class extends zr{constructor(){super(),this.filters=[new Ec({sprite:new se(E.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},ga=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=J.get(Yp);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=Es(t.mask.mask,!0,OB);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Nt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let h=s.sprite;h.texture=a,h.worldTransform.tx=o.minX,h.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===Qt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&Nt.returnTexture(s.filterTexture),J.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};ga.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"alphaMask"}});var xa,yS=x(()=>{C();xa=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};xa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"colorMask"}});var _a,bS=x(()=>{C();co();Xi();_a=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let h=this._maskHash.get(o);h.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-h.instructionsStart-1;h.instructionsLength=l;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(It.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(It.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(It.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,ue.STENCIL),r.stencil.setStencilMode(It.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(It.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};_a.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"stencilMask"}});var qp,TS,SS=x(()=>{fe();C();qp=class vS{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new et(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...vS.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};qp.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"background",priority:0};qp.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};TS=qp});var ya,ba,ES=x(()=>{C();el();At();ya={};F.handle(y.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");ya[i.name]=i.ref},i=>{delete ya[i.name]});ba=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!ya[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ya[e]){O(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new zr,r.filters=[new ya[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};ba.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"blendMode"}});var Kp,Zp,wS,CS=x(()=>{C();dr();vt();Kp={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Zp=class AS{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof St||t instanceof E?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,AS.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let h=new FileReader;h.onload=()=>o(h.result),h.onerror=n,h.readAsDataURL(a)},Kp[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Kp[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Kp[e],quality:r});return new Promise((n,a)=>{let h=new FileReader;h.onload=()=>n(h.result),h.onerror=a,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof E)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof E?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof St&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof E?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Zp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"extract"};Zp.defaultImageOptions={format:"png",quality:1};wS=Zp});var Ac,PS=x(()=>{Ie();vt();Ac=class i extends E{static create(t){return new i({source:new bt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var LB,DB,NB,va,RS=x(()=>{fe();C();dt();he();Be();nl();dr();PS();LB=new it,DB=new Et,NB=[0,0,0,0],va=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof St&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:et.shared.setValue(o).toArray():o=NB;let n=t.frame?.copyTo(LB)||ws(s,DB).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Ac.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),h=B.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:h,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};va.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGenerator"}});var Ta,MS=x(()=>{C();dt();Qe();Ks();xi();Mr();Ae();Ta=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new B,worldColor:4294967295,offset:new at},h={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let c=l.uniforms;c.uProjectionMatrix=h.projectionMatrix,c.uResolution=h.resolution,c.uWorldTransformMatrix.copyFrom(h.worldTransformMatrix),c.uWorldTransformMatrix.tx-=h.offset.x,c.uWorldTransformMatrix.ty-=h.offset.y,Br(h.worldColor,c.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new ce,this._activeBindGroups.push(u),u.setResource(l,0)),h.bindGroup=u,this._currentGlobalUniformData=h}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Qt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new wt({uProjectionMatrix:{value:new B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Ta.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"globalUniforms"}});var HB,Sa,BS=x(()=>{C();_n();HB=1,Sa=class{constructor(){this._tasks=[],this._offset=0}init(){Fe.system.add(this._update,this)}repeat(t,e,r=!0){let s=HB++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Fe.system.remove(this._update,this),this._tasks.length=0}};Sa.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"scheduler",priority:0}});function FS(i){if(!IS){if(z.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${fo} (${i}) http://www.pixijs.com/
|
|
764
|
+
`});var Ec,xS=x(()=>{dt();ji();Ns();Ae();wd();VT();fS();mS();gS();Ec=class extends HT{constructor(t){let{sprite:e,...r}=t,s=new Ps(e.texture),o=new wt({uFilterMatrix:{value:new I,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=rr.from({vertex:{source:jp,entryPoint:"mainVertex"},fragment:{source:jp,entryPoint:"mainFragment"}}),a=er.from({vertex:pS,fragment:dS,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,s)}}});var OB,Yp,ga,_S=x(()=>{C();el();xS();Be();fn();Tl();Te();vt();ui();Mr();OB=new Et,Yp=class extends zr{constructor(){super(),this.filters=[new Ec({sprite:new se(E.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},ga=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=J.get(Yp);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=Es(t.mask.mask,!0,OB);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Nt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let h=s.sprite;h.texture=a,h.worldTransform.tx=o.minX,h.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===Qt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&Nt.returnTexture(s.filterTexture),J.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};ga.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"alphaMask"}});var xa,yS=x(()=>{C();xa=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};xa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"colorMask"}});var _a,bS=x(()=>{C();co();Xi();_a=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let h=this._maskHash.get(o);h.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-h.instructionsStart-1;h.instructionsLength=l;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(It.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(It.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(It.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,ue.STENCIL),r.stencil.setStencilMode(It.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(It.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(It.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};_a.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"stencilMask"}});var qp,TS,SS=x(()=>{fe();C();qp=class vS{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new et(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...vS.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};qp.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"background",priority:0};qp.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};TS=qp});var ya,ba,ES=x(()=>{C();el();At();ya={};G.handle(y.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");ya[i.name]=i.ref},i=>{delete ya[i.name]});ba=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!ya[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ya[e]){O(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new zr,r.filters=[new ya[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};ba.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"blendMode"}});var Kp,Zp,wS,CS=x(()=>{C();dr();vt();Kp={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Zp=class AS{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof St||t instanceof E?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,AS.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let h=new FileReader;h.onload=()=>o(h.result),h.onerror=n,h.readAsDataURL(a)},Kp[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Kp[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Kp[e],quality:r});return new Promise((n,a)=>{let h=new FileReader;h.onload=()=>n(h.result),h.onerror=a,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof E)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof E?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof St&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof E?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Zp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"extract"};Zp.defaultImageOptions={format:"png",quality:1};wS=Zp});var Ac,PS=x(()=>{Ie();vt();Ac=class i extends E{static create(t){return new i({source:new bt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var LB,DB,NB,va,RS=x(()=>{fe();C();dt();he();Be();nl();dr();PS();LB=new st,DB=new Et,NB=[0,0,0,0],va=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof St&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:et.shared.setValue(o).toArray():o=NB;let n=t.frame?.copyTo(LB)||ws(s,DB).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Ac.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),h=I.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:h,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};va.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGenerator"}});var Ta,MS=x(()=>{C();dt();Qe();Ks();xi();Mr();Ae();Ta=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new I,worldColor:4294967295,offset:new at},h={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let c=l.uniforms;c.uProjectionMatrix=h.projectionMatrix,c.uResolution=h.resolution,c.uWorldTransformMatrix.copyFrom(h.worldTransformMatrix),c.uWorldTransformMatrix.tx-=h.offset.x,c.uWorldTransformMatrix.ty-=h.offset.y,Br(h.worldColor,c.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new ce,this._activeBindGroups.push(u),u.setResource(l,0)),h.bindGroup=u,this._currentGlobalUniformData=h}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Qt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new wt({uProjectionMatrix:{value:new I,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new I,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};Ta.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"globalUniforms"}});var HB,Sa,BS=x(()=>{C();_n();HB=1,Sa=class{constructor(){this._tasks=[],this._offset=0}init(){Fe.system.add(this._update,this)}repeat(t,e,r=!0){let s=HB++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Fe.system.remove(this._update,this),this._tasks.length=0}};Sa.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"scheduler",priority:0}});function FS(i){if(!IS){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${fo} (${i}) http://www.pixijs.com/
|
|
765
765
|
|
|
766
|
-
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${fo} - ${i} - http://www.pixijs.com/`);IS=!0}}var IS,GS=x(()=>{Rt();Wp();IS=!1});var po,US=x(()=>{C();GS();Mr();po=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Qt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),FS(e)}}};po.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"hello",priority:-2};po.defaultOptions={hello:!1}});function kS(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function OS(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var LS=x(()=>{"use strict"});var VB,Qp,NS,HS=x(()=>{C();LS();VB=0,Qp=class DS{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...DS.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=kS(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)OS(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=VB++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,h=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===h&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Qp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"renderableGC",priority:0};Qp.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};NS=Qp});var Jp,WS,zS=x(()=>{C();Jp=class VS{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...VS.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Jp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGC"};Jp.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};WS=Jp});var $S,Ea,tm=x(()=>{me();Ie();vt();$S=class XS{constructor(t={}){if(this.uid=nt("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...XS.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new bt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof E||t.depthStencilTexture instanceof bt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new bt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};$S.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Ea=$S});function wc(i,t){if(!Aa.has(i)){let e=new E({source:new ye({resource:i,...t})}),r=()=>{Aa.get(i)===e&&Aa.delete(i)};e.once("destroy",r),e.source.once("destroy",r),Aa.set(i,e)}return Aa.get(i)}var Aa,em=x(()=>{Fs();vt();Aa=new Map});var rm,YS,qS=x(()=>{Rt();C();he();Dt();tm();em();rm=class jS{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...jS.defaultOptions,...t},t.view&&(W(Q,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new it(0,0,t.width,t.height),this.canvas=t.canvas||z.get().createCanvas(),this.antialias=!!t.antialias,this.texture=wc(this.canvas,t),this.renderTarget=new Ea({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};rm.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"view",priority:0};rm.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};YS=rm});var Cc,Pc,im=x(()=>{tS();eS();hS();lS();zp();uS();_S();yS();bS();SS();ES();CS();RS();MS();BS();US();HS();zS();qS();Cc=[TS,Ta,po,YS,da,WS,va,wS,ma,NS,Sa],Pc=[ba,Xp,fa,ca,ga,_a,xa,ha]});var wa,KS=x(()=>{C();wa=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let h=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:h,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};wa.extension={type:[y.WebGPUSystem],name:"bindGroup"}});var Ca,ZS=x(()=>{C();of();Ca=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Rn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};Ca.extension={type:[y.WebGPUSystem],name:"buffer"}});var Pa,QS=x(()=>{C();Pa=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};Pa.extension={type:[y.WebGPUSystem],name:"colorMask"}});var mo,JS=x(()=>{Rt();C();mo=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await z.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};mo.extension={type:[y.WebGPUSystem],name:"device"};mo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Ra,tE=x(()=>{C();Ra=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:h,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,h??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),h??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};Ra.extension={type:[y.WebGPUSystem],name:"encoder",priority:1}});var Ma,eE=x(()=>{C();Xi();Ma=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:It.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Ma.extension={type:[y.WebGPUSystem],name:"stencil"}});var go,sm=x(()=>{Op();_i();Kr();go=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!bc())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new Vt({data:new Float32Array(e.layout.size/4),usage:st.UNIFORM|st.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new Vt({data:new Float32Array(s.layout.size/4),usage:st.UNIFORM|st.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function rE(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=Ba[s.data.type].size,n=Ba[s.data.type].align;if(!Ba[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Ba,om=x(()=>{"use strict";Ba={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var ti,nm=x(()=>{"use strict";ti=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
|
|
766
|
+
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${fo} - ${i} - http://www.pixijs.com/`);IS=!0}}var IS,GS=x(()=>{Rt();Wp();IS=!1});var po,US=x(()=>{C();GS();Mr();po=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Qt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),FS(e)}}};po.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"hello",priority:-2};po.defaultOptions={hello:!1}});function kS(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function OS(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var LS=x(()=>{"use strict"});var VB,Qp,NS,HS=x(()=>{C();LS();VB=0,Qp=class DS{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...DS.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=kS(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)OS(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=VB++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,h=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===h&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Qp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"renderableGC",priority:0};Qp.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};NS=Qp});var Jp,WS,zS=x(()=>{C();Jp=class VS{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...VS.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Jp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGC"};Jp.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};WS=Jp});var $S,Ea,tm=x(()=>{me();Ie();vt();$S=class XS{constructor(t={}){if(this.uid=nt("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...XS.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new bt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof E||t.depthStencilTexture instanceof bt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new bt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};$S.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};Ea=$S});function wc(i,t){if(!Aa.has(i)){let e=new E({source:new ye({resource:i,...t})}),r=()=>{Aa.get(i)===e&&Aa.delete(i)};e.once("destroy",r),e.source.once("destroy",r),Aa.set(i,e)}return Aa.get(i)}var Aa,em=x(()=>{Fs();vt();Aa=new Map});var rm,YS,qS=x(()=>{Rt();C();he();Dt();tm();em();rm=class jS{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...jS.defaultOptions,...t},t.view&&(z(Q,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new st(0,0,t.width,t.height),this.canvas=t.canvas||$.get().createCanvas(),this.antialias=!!t.antialias,this.texture=wc(this.canvas,t),this.renderTarget=new Ea({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};rm.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"view",priority:0};rm.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};YS=rm});var Cc,Pc,im=x(()=>{tS();eS();hS();lS();zp();uS();_S();yS();bS();SS();ES();CS();RS();MS();BS();US();HS();zS();qS();Cc=[TS,Ta,po,YS,da,WS,va,wS,ma,NS,Sa],Pc=[ba,Xp,fa,ca,ga,_a,xa,ha]});var wa,KS=x(()=>{C();wa=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let h=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:h,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};wa.extension={type:[y.WebGPUSystem],name:"bindGroup"}});var Ca,ZS=x(()=>{C();of();Ca=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Rn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};Ca.extension={type:[y.WebGPUSystem],name:"buffer"}});var Pa,QS=x(()=>{C();Pa=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};Pa.extension={type:[y.WebGPUSystem],name:"colorMask"}});var mo,JS=x(()=>{Rt();C();mo=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await $.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};mo.extension={type:[y.WebGPUSystem],name:"device"};mo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var Ra,tE=x(()=>{C();Ra=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:h,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,h??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),h??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}};Ra.extension={type:[y.WebGPUSystem],name:"encoder",priority:1}});var Ma,eE=x(()=>{C();Xi();Ma=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:It.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Ma.extension={type:[y.WebGPUSystem],name:"stencil"}});var go,sm=x(()=>{Op();_i();Kr();go=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!bc())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new Vt({data:new Float32Array(e.layout.size/4),usage:ot.UNIFORM|ot.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new Vt({data:new Float32Array(s.layout.size/4),usage:ot.UNIFORM|ot.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function rE(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=Ba[s.data.type].size,n=Ba[s.data.type].align;if(!Ba[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Ba,om=x(()=>{"use strict";Ba={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var ti,nm=x(()=>{"use strict";ti=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
|
|
767
767
|
var matrix = uv[name].toArray(true);
|
|
768
768
|
data[offset] = matrix[0];
|
|
769
769
|
data[offset + 1] = matrix[1];
|
|
@@ -907,7 +907,7 @@ fn mainFragment(
|
|
|
907
907
|
}
|
|
908
908
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
909
909
|
}
|
|
910
|
-
`}var oE=x(()=>{om()});function nE(i){return Rc(i,"uboWgsl",sE,iE)}var aE=x(()=>{am();lm();oE()});var Ia,hE=x(()=>{C();sm();om();aE();Ia=class extends go{constructor(){super({createUboElements:rE,generateUboSync:nE})}};Ia.extension={type:[y.WebGPUSystem],name:"ubo"}});var Ai,Mc=x(()=>{_e();me();Ai=class extends Pt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=nt("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=nt("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=nt("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var Bc,lE=x(()=>{"use strict";Bc=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var wi,Fa,cE=x(()=>{C();_i();Mc();Kr();lE();xi();wi=128,Fa=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new Bc({minUniformOffsetAlignment:wi});let e=256/wi;for(let r=0;r<e;r++){let s=st.UNIFORM|st.COPY_DST;r===0&&(s|=st.COPY_SRC),this._buffers.push(new Vt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/wi),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/wi)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/wi)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/wi;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Ai({buffer:e,offset:(t/2|0)*256,size:wi})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new ce({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),wi,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Fa.extension={type:[y.WebGPUPipes],name:"uniformBatch"}});function Ic(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):O(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}WB(i)}function WB(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Ue(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Ue(n.format).stride}}var cm=x(()=>{At();Yi()});var Gr,um=x(()=>{Xi();Gr=[];Gr[It.NONE]=void 0;Gr[It.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Gr[It.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Gr[It.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Gr[It.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Gr[It.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function $B(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function XB(i,t,e,r){return e<<6|i<<3|r<<1|t}var zB,Ga,uE=x(()=>{C();At();cm();Xi();In();um();zB={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ga=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(It.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Gr[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(Ic(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=$B(t._layoutKey,e._layoutKey,r.data,r._blendModeId,zB[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===It.RENDERING_MASK_ADD?0:this._colorMask;let h=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:h,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Zr(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Zr(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===l){o[a]=c;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let h in e.attributeData){let l=t.attributes[h];(l.divisor??1)!==1&&O(`Attribute ${h} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[h].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=XB(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};Ga.extension={type:[y.WebGPUSystem],name:"pipeline"}});function dE(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var fE=x(()=>{"use strict"});function pE(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var mE=x(()=>{"use strict"});var _o,dm=x(()=>{dt();he();co();fE();Lp();Fs();Ie();vt();em();mE();tm();_o=class{constructor(t){this.rootViewPort=new it,this.viewport=new it,this.onRenderTargetChange=new uo("onRenderTargetChange"),this.projectionMatrix=new B,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=pE(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let h=o.colorTexture,l=this.viewport,c=h.pixelWidth,u=h.pixelHeight;if(!s&&t instanceof E&&(s=t.frame),s){let d=h._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=c,l.height=u;return dE(this.projectionMatrix,0,0,l.width/h.resolution,l.height/h.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ue.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ue.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return ye.test(t)&&(t=wc(t).source),t instanceof Ea?e=t:t instanceof bt&&(e=new Ea({colorTextures:[t]}),ye.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var Fc,gE=x(()=>{"use strict";Fc=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Gc,xE=x(()=>{co();Fs();Ie();gE();Gc=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),h=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:h,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?ue.ALL:ue.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let p=e&ue.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&ue.STENCIL?"clear":"load",c=e&ue.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),c=this.getDescriptor(t,e,r),u=l.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Fc;return t.colorTextures.forEach((r,s)=>{if(ye.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new bt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Ua,_E=x(()=>{C();dm();xE();Ua=class extends _o{constructor(t){super(t),this.adaptor=new Gc,this.adaptor.init(t,this)}};Ua.extension={type:[y.WebGPUSystem],name:"renderTarget"}});var ka,yE=x(()=>{C();ka=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};ka.extension={type:[y.WebGPUSystem],name:"shader"}});var Ce,bE=x(()=>{"use strict";Ce={};Ce.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ce.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ce["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ce["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ce.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ce.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ce.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Oa,vE=x(()=>{C();mr();bE();Oa=class{constructor(){this.defaultState=new $t,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ce[t.blendMode]||Ce.normal}]}destroy(){this.gpu=null}};Oa.extension={type:[y.WebGPUSystem],name:"state"}});var TE,SE=x(()=>{"use strict";TE={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var fm,jB,EE,AE=x(()=>{"use strict";fm={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},jB={blockBytes:4,blockWidth:1,blockHeight:1},EE={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=fm[i.format]||jB;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],h=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:h},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Uc,pm=x(()=>{"use strict";Uc={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var wE,CE=x(()=>{pm();wE={type:"video",upload(i,t,e){Uc.upload(i,t,e)}}});var kc,PE=x(()=>{"use strict";kc=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
910
|
+
`}var oE=x(()=>{om()});function nE(i){return Rc(i,"uboWgsl",sE,iE)}var aE=x(()=>{am();lm();oE()});var Ia,hE=x(()=>{C();sm();om();aE();Ia=class extends go{constructor(){super({createUboElements:rE,generateUboSync:nE})}};Ia.extension={type:[y.WebGPUSystem],name:"ubo"}});var Ai,Mc=x(()=>{_e();me();Ai=class extends Pt{constructor({buffer:t,offset:e,size:r}){super(),this.uid=nt("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=nt("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=nt("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var Bc,lE=x(()=>{"use strict";Bc=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var wi,Fa,cE=x(()=>{C();_i();Mc();Kr();lE();xi();wi=128,Fa=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new Bc({minUniformOffsetAlignment:wi});let e=256/wi;for(let r=0;r<e;r++){let s=ot.UNIFORM|ot.COPY_DST;r===0&&(s|=ot.COPY_SRC),this._buffers.push(new Vt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/wi),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/wi)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/wi)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/wi;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Ai({buffer:e,offset:(t/2|0)*256,size:wi})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new ce({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),wi,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Fa.extension={type:[y.WebGPUPipes],name:"uniformBatch"}});function Ic(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):O(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}WB(i)}function WB(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Ue(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Ue(n.format).stride}}var cm=x(()=>{At();Yi()});var Gr,um=x(()=>{Xi();Gr=[];Gr[It.NONE]=void 0;Gr[It.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Gr[It.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Gr[It.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Gr[It.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Gr[It.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function $B(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function XB(i,t,e,r){return e<<6|i<<3|r<<1|t}var zB,Ga,uE=x(()=>{C();At();cm();Xi();In();um();zB={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ga=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(It.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Gr[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(Ic(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=$B(t._layoutKey,e._layoutKey,r.data,r._blendModeId,zB[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===It.RENDERING_MASK_ADD?0:this._colorMask;let h=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:h,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Zr(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Zr(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===l){o[a]=c;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let h in e.attributeData){let l=t.attributes[h];(l.divisor??1)!==1&&O(`Attribute ${h} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[h].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=XB(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}};Ga.extension={type:[y.WebGPUSystem],name:"pipeline"}});function dE(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var fE=x(()=>{"use strict"});function pE(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var mE=x(()=>{"use strict"});var _o,dm=x(()=>{dt();he();co();fE();Lp();Fs();Ie();vt();em();mE();tm();_o=class{constructor(t){this.rootViewPort=new st,this.viewport=new st,this.onRenderTargetChange=new uo("onRenderTargetChange"),this.projectionMatrix=new I,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=pE(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let h=o.colorTexture,l=this.viewport,c=h.pixelWidth,u=h.pixelHeight;if(!s&&t instanceof E&&(s=t.frame),s){let d=h._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=c,l.height=u;return dE(this.projectionMatrix,0,0,l.width/h.resolution,l.height/h.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=ue.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=ue.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return ye.test(t)&&(t=wc(t).source),t instanceof Ea?e=t:t instanceof bt&&(e=new Ea({colorTextures:[t]}),ye.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}});var Fc,gE=x(()=>{"use strict";Fc=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Gc,xE=x(()=>{co();Fs();Ie();gE();Gc=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),h=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:h,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?ue.ALL:ue.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let p=e&ue.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&ue.STENCIL?"clear":"load",c=e&ue.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),c=this.getDescriptor(t,e,r),u=l.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Fc;return t.colorTextures.forEach((r,s)=>{if(ye.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new bt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Ua,_E=x(()=>{C();dm();xE();Ua=class extends _o{constructor(t){super(t),this.adaptor=new Gc,this.adaptor.init(t,this)}};Ua.extension={type:[y.WebGPUSystem],name:"renderTarget"}});var ka,yE=x(()=>{C();ka=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};ka.extension={type:[y.WebGPUSystem],name:"shader"}});var Ce,bE=x(()=>{"use strict";Ce={};Ce.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ce.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ce["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ce["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ce.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ce.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ce.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Oa,vE=x(()=>{C();mr();bE();Oa=class{constructor(){this.defaultState=new $t,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ce[t.blendMode]||Ce.normal}]}destroy(){this.gpu=null}};Oa.extension={type:[y.WebGPUSystem],name:"state"}});var TE,SE=x(()=>{"use strict";TE={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var fm,jB,EE,AE=x(()=>{"use strict";fm={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},jB={blockBytes:4,blockWidth:1,blockHeight:1},EE={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=fm[i.format]||jB;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],h=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:h},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Uc,pm=x(()=>{"use strict";Uc={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var wE,CE=x(()=>{pm();wE={type:"video",upload(i,t,e){Uc.upload(i,t,e)}}});var kc,PE=x(()=>{"use strict";kc=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
911
911
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
912
912
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
913
913
|
|
|
@@ -931,7 +931,7 @@ fn mainFragment(
|
|
|
931
931
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
932
932
|
return textureSample(img, imgSampler, texCoord);
|
|
933
933
|
}
|
|
934
|
-
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let h={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(h)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let h=0;h<s;++h){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let h={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},h),h.width=Math.ceil(h.width/2),h.height=Math.ceil(h.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var La,RE=x(()=>{Rt();C();Ae();Qs();xi();SE();AE();pm();CE();PE();La=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:Uc,buffer:TE,video:wE,compressed:EE},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let h=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(h))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=fm[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new kc(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new ce({0:e,1:e.style,2:new wt({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=z.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:z.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=Oe.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),h=new Uint8ClampedArray(a.data.buffer);return Oe.returnCanvasAndContext(r),{pixels:h,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};La.extension={type:[y.WebGPUSystem],name:"texture"}});var FE={};lx(FE,{WebGPURenderer:()=>mm});var YB,qB,KB,ME,BE,IE,mm,GE=x(()=>{C();qT();QT();JT();sa();im();Mr();KS();ZS();QS();JS();tE();eE();hE();cE();uE();_E();yE();vE();RE();YB=[...Cc,Ia,Ra,mo,Ca,La,Ua,ka,Oa,Ga,Pa,Ma,wa],qB=[...Pc,Fa],KB=[aa,na,oa],ME=[],BE=[],IE=[];F.handleByNamedList(y.WebGPUSystem,ME);F.handleByNamedList(y.WebGPUPipes,BE);F.handleByNamedList(y.WebGPUPipesAdaptor,IE);F.add(...YB,...qB,...KB);mm=class extends Ei{constructor(){let t={name:"webgpu",type:Qt.WEBGPU,systems:ME,renderPipes:BE,renderPipeAdaptors:IE};super(t)}}});var Da,UE=x(()=>{C();dt();$i();bi();Fn();Gn();lo();vi();kl();pr();Ae();Da=class{init(){let t=new wt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Je(),r=Cr({name:"graphics",bits:[Vs,zs(e),ho,Rr]});this.shader=new Wt({glProgram:r,resources:{localUniforms:t,batchSamplers:$s(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=h.instructions;for(let c=0;c<h.instructionSize;c++){let u=l[c];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};Da.extension={type:[y.WebGLPipesAdaptor],name:"graphics"}});var Na,kE=x(()=>{C();dt();bi();lo();vi();Dp();pr();vt();At();Na=class{init(){let t=Cr({name:"mesh",bits:[ho,ZT,Rr]});this._shader=new Wt({glProgram:t,resources:{uTexture:E.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){O("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Na.extension={type:[y.WebGLPipesAdaptor],name:"mesh"}});var Ha,OE=x(()=>{C();mr();Ha=class{constructor(){this._tempState=$t.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Ha.extension={type:[y.WebGLPipesAdaptor],name:"batch"}});var Va,LE=x(()=>{"use strict";Va=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Va||{})});var Oc,DE=x(()=>{"use strict";Oc=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Wa,NE=x(()=>{C();Kr();LE();DE();Wa=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&st.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=Va.ARRAY_BUFFER;t.descriptor.usage&st.INDEX?r=Va.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&st.UNIFORM&&(r=Va.UNIFORM_BUFFER);let s=new Oc(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Wa.extension={type:[y.WebGLSystem],name:"buffer"}});var gm,VE,WE=x(()=>{Rt();C();At();gm=class HE{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...HE.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(O("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=z.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&O("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof z.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&O("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||O("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};gm.extension={type:[y.WebGLSystem],name:"context"};gm.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};VE=gm});var Lc,xm,ft,_m=x(()=>{"use strict";Lc=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Lc||{}),xm=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(xm||{}),ft=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(ft||{})});function $E(i){return zE[i]??zE.float32}var zE,XE=x(()=>{_m();zE={uint8x2:ft.UNSIGNED_BYTE,uint8x4:ft.UNSIGNED_BYTE,sint8x2:ft.BYTE,sint8x4:ft.BYTE,unorm8x2:ft.UNSIGNED_BYTE,unorm8x4:ft.UNSIGNED_BYTE,snorm8x2:ft.BYTE,snorm8x4:ft.BYTE,uint16x2:ft.UNSIGNED_SHORT,uint16x4:ft.UNSIGNED_SHORT,sint16x2:ft.SHORT,sint16x4:ft.SHORT,unorm16x2:ft.UNSIGNED_SHORT,unorm16x4:ft.UNSIGNED_SHORT,snorm16x2:ft.SHORT,snorm16x4:ft.SHORT,float16x2:ft.HALF_FLOAT,float16x4:ft.HALF_FLOAT,float32:ft.FLOAT,float32x2:ft.FLOAT,float32x3:ft.FLOAT,float32x4:ft.FLOAT,uint32:ft.UNSIGNED_INT,uint32x2:ft.UNSIGNED_INT,uint32x3:ft.UNSIGNED_INT,uint32x4:ft.UNSIGNED_INT,sint32:ft.INT,sint32x2:ft.INT,sint32x3:ft.INT,sint32x4:ft.INT}});var ZB,za,jE=x(()=>{C();Yi();cm();XE();ZB={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},za=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,h)=>{r.drawElementsInstancedANGLE(s,o,n,a,h)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],h=a[n];if(h)return a[e._key]=h,h;Ic(t,e._attributeData);let l=t.buffers;h=s.createVertexArray(),s.bindVertexArray(h);for(let c=0;c<l.length;c++){let u=l[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=h,a[n]=h,s.bindVertexArray(null),h}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let h=o[a],l=h.buffer,c=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==c&&(s.bind(l),n=c);let d=u.location;r.enableVertexAttribArray(d);let f=Ue(h.format),p=$E(h.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,p,h.stride,h.offset):r.vertexAttribPointer(d,f.size,p,f.normalised,h.stride,h.offset),h.instance)if(this.hasInstance){let m=h.divisor??1;r.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=ZB[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let h=n.indexBuffer.data.BYTES_PER_ELEMENT,l=h===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*h,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*h)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};za.extension={type:[y.WebGLSystem],name:"geometry"}});var QB,ym,qE,KE=x(()=>{C();At();Ls();pr();mr();Ie();vt();ji();QB=new tr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ym=class YE{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...YE.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(O("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=$t.for2d();let s=new er({vertex:`
|
|
934
|
+
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let h={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(h)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let h=0;h<s;++h){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let h={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},h),h.width=Math.ceil(h.width/2),h.height=Math.ceil(h.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var La,RE=x(()=>{Rt();C();Ae();Qs();xi();SE();AE();pm();CE();PE();La=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:Uc,buffer:TE,video:wE,compressed:EE},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let h=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(h))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=fm[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new kc(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new ce({0:e,1:e.style,2:new wt({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=$.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:$.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=Oe.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),h=new Uint8ClampedArray(a.data.buffer);return Oe.returnCanvasAndContext(r),{pixels:h,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};La.extension={type:[y.WebGPUSystem],name:"texture"}});var FE={};lx(FE,{WebGPURenderer:()=>mm});var YB,qB,KB,ME,BE,IE,mm,GE=x(()=>{C();qT();QT();JT();sa();im();Mr();KS();ZS();QS();JS();tE();eE();hE();cE();uE();_E();yE();vE();RE();YB=[...Cc,Ia,Ra,mo,Ca,La,Ua,ka,Oa,Ga,Pa,Ma,wa],qB=[...Pc,Fa],KB=[aa,na,oa],ME=[],BE=[],IE=[];G.handleByNamedList(y.WebGPUSystem,ME);G.handleByNamedList(y.WebGPUPipes,BE);G.handleByNamedList(y.WebGPUPipesAdaptor,IE);G.add(...YB,...qB,...KB);mm=class extends Ei{constructor(){let t={name:"webgpu",type:Qt.WEBGPU,systems:ME,renderPipes:BE,renderPipeAdaptors:IE};super(t)}}});var Da,UE=x(()=>{C();dt();$i();bi();Fn();Gn();lo();vi();kl();pr();Ae();Da=class{init(){let t=new wt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new I,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Je(),r=Cr({name:"graphics",bits:[Vs,zs(e),ho,Rr]});this.shader=new Wt({glProgram:r,resources:{localUniforms:t,batchSamplers:$s(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=h.instructions;for(let c=0;c<h.instructionSize;c++){let u=l[c];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};Da.extension={type:[y.WebGLPipesAdaptor],name:"graphics"}});var Na,kE=x(()=>{C();dt();bi();lo();vi();Dp();pr();vt();At();Na=class{init(){let t=Cr({name:"mesh",bits:[ho,ZT,Rr]});this._shader=new Wt({glProgram:t,resources:{uTexture:E.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new I}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){O("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Na.extension={type:[y.WebGLPipesAdaptor],name:"mesh"}});var Ha,OE=x(()=>{C();mr();Ha=class{constructor(){this._tempState=$t.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Ha.extension={type:[y.WebGLPipesAdaptor],name:"batch"}});var Va,LE=x(()=>{"use strict";Va=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Va||{})});var Oc,DE=x(()=>{"use strict";Oc=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Wa,NE=x(()=>{C();Kr();LE();DE();Wa=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&ot.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=Va.ARRAY_BUFFER;t.descriptor.usage&ot.INDEX?r=Va.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ot.UNIFORM&&(r=Va.UNIFORM_BUFFER);let s=new Oc(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Wa.extension={type:[y.WebGLSystem],name:"buffer"}});var gm,VE,WE=x(()=>{Rt();C();At();gm=class HE{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...HE.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(O("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=$.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&O("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof $.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&O("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||O("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};gm.extension={type:[y.WebGLSystem],name:"context"};gm.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};VE=gm});var Lc,xm,ft,_m=x(()=>{"use strict";Lc=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Lc||{}),xm=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(xm||{}),ft=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(ft||{})});function $E(i){return zE[i]??zE.float32}var zE,XE=x(()=>{_m();zE={uint8x2:ft.UNSIGNED_BYTE,uint8x4:ft.UNSIGNED_BYTE,sint8x2:ft.BYTE,sint8x4:ft.BYTE,unorm8x2:ft.UNSIGNED_BYTE,unorm8x4:ft.UNSIGNED_BYTE,snorm8x2:ft.BYTE,snorm8x4:ft.BYTE,uint16x2:ft.UNSIGNED_SHORT,uint16x4:ft.UNSIGNED_SHORT,sint16x2:ft.SHORT,sint16x4:ft.SHORT,unorm16x2:ft.UNSIGNED_SHORT,unorm16x4:ft.UNSIGNED_SHORT,snorm16x2:ft.SHORT,snorm16x4:ft.SHORT,float16x2:ft.HALF_FLOAT,float16x4:ft.HALF_FLOAT,float32:ft.FLOAT,float32x2:ft.FLOAT,float32x3:ft.FLOAT,float32x4:ft.FLOAT,uint32:ft.UNSIGNED_INT,uint32x2:ft.UNSIGNED_INT,uint32x3:ft.UNSIGNED_INT,uint32x4:ft.UNSIGNED_INT,sint32:ft.INT,sint32x2:ft.INT,sint32x3:ft.INT,sint32x4:ft.INT}});var ZB,za,jE=x(()=>{C();Yi();cm();XE();ZB={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},za=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,h)=>{r.drawElementsInstancedANGLE(s,o,n,a,h)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],h=a[n];if(h)return a[e._key]=h,h;Ic(t,e._attributeData);let l=t.buffers;h=s.createVertexArray(),s.bindVertexArray(h);for(let c=0;c<l.length;c++){let u=l[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=h,a[n]=h,s.bindVertexArray(null),h}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let h=o[a],l=h.buffer,c=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==c&&(s.bind(l),n=c);let d=u.location;r.enableVertexAttribArray(d);let f=Ue(h.format),p=$E(h.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,p,h.stride,h.offset):r.vertexAttribPointer(d,f.size,p,f.normalised,h.stride,h.offset),h.instance)if(this.hasInstance){let m=h.divisor??1;r.vertexAttribDivisor(d,m)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=ZB[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let h=n.indexBuffer.data.BYTES_PER_ELEMENT,l=h===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*h,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*h)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};za.extension={type:[y.WebGLSystem],name:"geometry"}});var QB,ym,qE,KE=x(()=>{C();At();Ls();pr();mr();Ie();vt();ji();QB=new tr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ym=class YE{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...YE.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(O("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=$t.for2d();let s=new er({vertex:`
|
|
935
935
|
attribute vec2 aPosition;
|
|
936
936
|
out vec2 vUv;
|
|
937
937
|
|
|
@@ -966,7 +966,7 @@ fn mainFragment(
|
|
|
966
966
|
}
|
|
967
967
|
${s!==0?`arrayOffset += ${s};`:""}
|
|
968
968
|
}
|
|
969
|
-
`}var rA=x(()=>{vm()});function iA(i){return Rc(i,"uboStd40",eA,hm)}var sA=x(()=>{am();lm();rA()});var Ya,oA=x(()=>{C();sm();vm();sA();Ya=class extends go{constructor(){super({createUboElements:tA,generateUboSync:iA})}};Ya.extension={type:[y.WebGLSystem],name:"ubo"}});var Dc,nA=x(()=>{"use strict";Dc=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var Nc,aA=x(()=>{he();At();Fs();co();nA();Nc=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new
|
|
969
|
+
`}var rA=x(()=>{vm()});function iA(i){return Rc(i,"uboStd40",eA,hm)}var sA=x(()=>{am();lm();rA()});var Ya,oA=x(()=>{C();sm();vm();sA();Ya=class extends go{constructor(){super({createUboElements:tA,generateUboSync:iA})}};Ya.extension={type:[y.WebGLSystem],name:"ubo"}});var Dc,nA=x(()=>{"use strict";Dc=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var Nc,aA=x(()=>{he();At();Fs();co();nA();Nc=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new st}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new st}copyToTexture(t,e,r,s,o){let n=this._renderTargetSystem,a=this._renderer,h=n.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,h.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),h=s.y;t.isRoot&&(h=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let c=this._viewPortCache;(c.x!==s.x||c.y!==h||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=h,c.width=s.width,c.height=s.height,l.viewport(s.x,h,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Dc,o=t.colorTexture;return ye.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?ue.ALL:ue.NONE);let o=this._renderer.gl;if(e&ue.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let h=n.source;h.antialias&&(r.context.supports.msaa?e.msaa=!0:O("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(h,0);let c=r.texture.getGlSource(h).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,c,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,h)=>{let l=s.createRenderbuffer();e.msaaRenderBuffer[h]=l})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,h)=>{let l=a.source;s.texture.bindSource(l,0);let u=s.texture.getGlSource(l).internalFormat,d=e.msaaRenderBuffer[h];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+h,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&ye.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&ye.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var qa,hA=x(()=>{C();dm();aA();qa=class extends _o{constructor(t){super(t),this.adaptor=new Nc,this.adaptor.init(t,this)}};qa.extension={type:[y.WebGLSystem],name:"renderTarget"}});function lA(i,t){let e=[],r=[`
|
|
970
970
|
var g = s.groups;
|
|
971
971
|
var sS = r.shader;
|
|
972
972
|
var p = s.glProgram;
|
|
@@ -1086,12 +1086,12 @@ fn mainFragment(
|
|
|
1086
1086
|
cv = cu.value;
|
|
1087
1087
|
v = uv["${r}"];
|
|
1088
1088
|
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
1089
|
-
`))}var BA=x(()=>{Mc();Ae();nm();RA()});var Za,IA=x(()=>{C();BA();Za=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return MA(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Za.extension={type:[y.WebGLSystem],name:"uniformGroup"}});function FA(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof z.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var GA=x(()=>{Rt()});var tI,eI,rI,iI,sI,oI,UA,kA,OA=x(()=>{C();mr();GA();tI=0,eI=1,rI=2,iI=3,sI=4,oI=5,UA=class Cm{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[tI]=this.setBlend,this.map[eI]=this.setOffset,this.map[rI]=this.setCullFace,this.map[iI]=this.setDepthTest,this.map[sI]=this.setFrontFace,this.map[oI]=this.setDepthMask,this.checks=[],this.defaultState=$t.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=FA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Cm._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Cm._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};UA.extension={type:[y.WebGLSystem],name:"state"};kA=UA});var $c,LA=x(()=>{_m();$c=class{constructor(t){this.target=xm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=ft.UNSIGNED_BYTE,this.internalFormat=Lc.RGBA,this.format=Lc.RGBA,this.samplerType=0}}});var DA,NA=x(()=>{"use strict";DA={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var nI,HA,VA=x(()=>{"use strict";nI={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},HA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!nI[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Xc,Pm=x(()=>{"use strict";Xc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var WA,zA=x(()=>{Pm();WA={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Xc.upload(i,t,e,r)}}});var Rm,$A,jc,XA,jA=x(()=>{"use strict";Rm={linear:9729,nearest:9728},$A={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},jc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},XA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Mm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=jc[n?"clamp-to-edge":i.addressModeU],c=jc[n?"clamp-to-edge":i.addressModeV],u=jc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Rm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=$A[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Rm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,XA[i.compare])}var YA=x(()=>{jA()});function qA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var KA=x(()=>{"use strict"});function ZA(i,t){let e={},r=i.RGBA;return i instanceof z.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var QA=x(()=>{Rt()});function JA(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var tw=x(()=>{"use strict"});var aI,Qa,ew=x(()=>{Rt();C();vt();LA();NA();VA();Pm();zA();YA();KA();QA();tw();aI=4,Qa=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Xc,buffer:DA,video:WA,compressed:HA},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=ZA(t,this._renderer.context.extensions),this._mapFormatToType=JA(t),this._mapFormatToFormat=qA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new $c(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Mm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Mm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=z.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(aI*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Qa.extension={type:[y.WebGLSystem],name:"texture"}});var ow={};lx(ow,{WebGLRenderer:()=>Bm});var hI,lI,cI,rw,iw,sw,Bm,nw=x(()=>{C();UE();kE();OE();sa();im();Mr();NE();WE();jE();KE();ZE();QE();JE();oA();hA();wA();IA();OA();ew();hI=[...Cc,Ya,qE,VE,Wa,Qa,qa,za,Za,Ka,Xa,kA,ja,$a],lI=[...Pc],cI=[Ha,Na,Da],rw=[],iw=[],sw=[];F.handleByNamedList(y.WebGLSystem,rw);F.handleByNamedList(y.WebGLPipes,iw);F.handleByNamedList(y.WebGLPipesAdaptor,sw);F.add(...hI,...lI,...cI);Bm=class extends Ei{constructor(){let t={name:"webgl",type:Qt.WEBGL,systems:rw,renderPipes:iw,renderPipeAdaptors:sw};super(t)}}});var l1=K((Int,$m)=>{"use strict";var aF=Object.prototype.hasOwnProperty,Re="~";function sh(){}Object.create&&(sh.prototype=Object.create(null),new sh().__proto__||(Re=!1));function hF(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function h1(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new hF(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function ou(i,t){--i._eventsCount===0?i._events=new sh:delete i._events[t]}function be(){this._events=new sh,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)aF.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};be.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};be.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};be.prototype.on=function(t,e,r){return h1(this,t,e,r,!1)};be.prototype.once=function(t,e,r){return h1(this,t,e,r,!0)};be.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return ou(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&ou(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:ou(this,o)}return this};be.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&ou(this,e)):(this._events=new sh,this._eventsCount=0),this};be.prototype.off=be.prototype.removeListener;be.prototype.addListener=be.prototype.on;be.prefixed=Re;be.EventEmitter=be;typeof $m<"u"&&($m.exports=be)});var c1=K((Mo,Bo)=>{(function(i){var t=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,e=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=n-a,v=Math.floor,T=String.fromCharCode,w;function S(H){throw new RangeError(b[H])}function A(H,U){for(var tt=H.length,yt=[];tt--;)yt[tt]=U(H[tt]);return yt}function M(H,U){var tt=H.split("@"),yt="";tt.length>1&&(yt=tt[0]+"@",H=tt[1]),H=H.replace(g,".");var mt=H.split("."),Ot=A(mt,U).join(".");return yt+Ot}function P(H){for(var U=[],tt=0,yt=H.length,mt,Ot;tt<yt;)mt=H.charCodeAt(tt++),mt>=55296&&mt<=56319&&tt<yt?(Ot=H.charCodeAt(tt++),(Ot&64512)==56320?U.push(((mt&1023)<<10)+(Ot&1023)+65536):(U.push(mt),tt--)):U.push(mt);return U}function R(H){return A(H,function(U){var tt="";return U>65535&&(U-=65536,tt+=T(U>>>10&1023|55296),U=56320|U&1023),tt+=T(U),tt}).join("")}function I(H){return H-48<10?H-22:H-65<26?H-65:H-97<26?H-97:n}function k(H,U){return H+22+75*(H<26)-((U!=0)<<5)}function j(H,U,tt){var yt=0;for(H=tt?v(H/c):H>>1,H+=v(H/U);H>_*h>>1;yt+=n)H=v(H/_);return v(yt+(_+1)*H/(H+l))}function N(H){var U=[],tt=H.length,yt,mt=0,Ot=d,Lt=u,Yt,re,ge,Tt,ct,gt,Ft,qt,Kt;for(Yt=H.lastIndexOf(f),Yt<0&&(Yt=0),re=0;re<Yt;++re)H.charCodeAt(re)>=128&&S("not-basic"),U.push(H.charCodeAt(re));for(ge=Yt>0?Yt+1:0;ge<tt;){for(Tt=mt,ct=1,gt=n;ge>=tt&&S("invalid-input"),Ft=I(H.charCodeAt(ge++)),(Ft>=n||Ft>v((o-mt)/ct))&&S("overflow"),mt+=Ft*ct,qt=gt<=Lt?a:gt>=Lt+h?h:gt-Lt,!(Ft<qt);gt+=n)Kt=n-qt,ct>v(o/Kt)&&S("overflow"),ct*=Kt;yt=U.length+1,Lt=j(mt-Tt,yt,Tt==0),v(mt/yt)>o-Ot&&S("overflow"),Ot+=v(mt/yt),mt%=yt,U.splice(mt++,0,Ot)}return R(U)}function ot(H){var U,tt,yt,mt,Ot,Lt,Yt,re,ge,Tt,ct,gt=[],Ft,qt,Kt,Me;for(H=P(H),Ft=H.length,U=d,tt=0,Ot=u,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct<128&>.push(T(ct));for(yt=mt=gt.length,mt&>.push(f);yt<Ft;){for(Yt=o,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct>=U&&ct<Yt&&(Yt=ct);for(qt=yt+1,Yt-U>v((o-tt)/qt)&&S("overflow"),tt+=(Yt-U)*qt,U=Yt,Lt=0;Lt<Ft;++Lt)if(ct=H[Lt],ct<U&&++tt>o&&S("overflow"),ct==U){for(re=tt,ge=n;Tt=ge<=Ot?a:ge>=Ot+h?h:ge-Ot,!(re<Tt);ge+=n)Me=re-Tt,Kt=n-Tt,gt.push(T(k(Tt+Me%Kt,0))),re=v(Me/Kt);gt.push(T(k(re,0))),Ot=j(tt,qt,yt==mt),tt=0,++yt}++tt,++U}return gt.join("")}function L(H){return M(H,function(U){return p.test(U)?N(U.slice(4).toLowerCase()):U})}function $(H){return M(H,function(U){return m.test(U)?"xn--"+ot(U):U})}if(s={version:"1.4.1",ucs2:{decode:P,encode:R},decode:N,encode:ot,toASCII:$,toUnicode:L},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Bo.exports==t)e.exports=s;else for(w in s)s.hasOwnProperty(w)&&(t[w]=s[w]);else i.punycode=s})(Mo)});var rs=K((Fnt,u1)=>{"use strict";u1.exports=TypeError});var d1=K(()=>{});var lh=K((knt,I1)=>{var eg=typeof Map=="function"&&Map.prototype,Xm=Object.getOwnPropertyDescriptor&&eg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,au=eg&&Xm&&typeof Xm.get=="function"?Xm.get:null,f1=eg&&Map.prototype.forEach,rg=typeof Set=="function"&&Set.prototype,jm=Object.getOwnPropertyDescriptor&&rg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,hu=rg&&jm&&typeof jm.get=="function"?jm.get:null,p1=rg&&Set.prototype.forEach,lF=typeof WeakMap=="function"&&WeakMap.prototype,nh=lF?WeakMap.prototype.has:null,cF=typeof WeakSet=="function"&&WeakSet.prototype,ah=cF?WeakSet.prototype.has:null,uF=typeof WeakRef=="function"&&WeakRef.prototype,m1=uF?WeakRef.prototype.deref:null,dF=Boolean.prototype.valueOf,fF=Object.prototype.toString,pF=Function.prototype.toString,mF=String.prototype.match,ig=String.prototype.slice,Pi=String.prototype.replace,gF=String.prototype.toUpperCase,g1=String.prototype.toLowerCase,A1=RegExp.prototype.test,x1=Array.prototype.concat,Ur=Array.prototype.join,xF=Array.prototype.slice,_1=Math.floor,Km=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ym=Object.getOwnPropertySymbols,Zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Io=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Io||!0)?Symbol.toStringTag:null,w1=Object.prototype.propertyIsEnumerable,y1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function b1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||A1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-_1(-i):_1(i);if(r!==i){var s=String(r),o=ig.call(t,s.length+1);return Pi.call(s,e,"$&_")+"."+Pi.call(Pi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Pi.call(t,e,"$&_")}var Qm=d1(),v1=Qm.custom,T1=R1(v1)?v1:null,C1={__proto__:null,double:'"',single:"'"},_F={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};I1.exports=function i(t,e,r,s){var o=e||{};if(ri(o,"quoteStyle")&&!ri(C1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ri(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ri(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ri(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ri(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return B1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?b1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?b1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return Jm(t)?"[Array]":"[Object]";var u=kF(o,r);if(typeof s>"u")s=[];else if(M1(s,t)>=0)return"[Circular]";function d(j,N,ot){if(N&&(s=xF.call(s),s.push(N)),ot){var L={depth:o.depth};return ri(o,"quoteStyle")&&(L.quoteStyle=o.quoteStyle),i(j,L,r+1,s)}return i(j,o,r+1,s)}if(typeof t=="function"&&!S1(t)){var f=CF(t),p=nu(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ur.call(p,", ")+" }":"")}if(R1(t)){var m=Io?Pi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zm.call(t);return typeof t=="object"&&!Io?oh(m):m}if(FF(t)){for(var g="<"+g1.call(String(t.nodeName)),b=t.attributes||[],_=0;_<b.length;_++)g+=" "+b[_].name+"="+P1(yF(b[_].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+g1.call(String(t.nodeName))+">",g}if(Jm(t)){if(t.length===0)return"[]";var v=nu(t,d);return u&&!UF(v)?"["+tg(v,u)+"]":"[ "+Ur.call(v,", ")+" ]"}if(vF(t)){var T=nu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!w1.call(t,"cause")?"{ ["+String(t)+"] "+Ur.call(x1.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ur.call(T,", ")+" }"}if(typeof t=="object"&&n){if(T1&&typeof t[T1]=="function"&&Qm)return Qm(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(PF(t)){var w=[];return f1&&f1.call(t,function(j,N){w.push(d(N,t,!0)+" => "+d(j,t))}),E1("Map",au.call(t),w,u)}if(BF(t)){var S=[];return p1&&p1.call(t,function(j){S.push(d(j,t))}),E1("Set",hu.call(t),S,u)}if(RF(t))return qm("WeakMap");if(IF(t))return qm("WeakSet");if(MF(t))return qm("WeakRef");if(SF(t))return oh(d(Number(t)));if(AF(t))return oh(d(Km.call(t)));if(EF(t))return oh(dF.call(t));if(TF(t))return oh(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!bF(t)&&!S1(t)){var A=nu(t,d),M=y1?y1(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",R=!M&&hh&&Object(t)===t&&hh in t?ig.call(Ri(t),8,-1):P?"Object":"",I=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",k=I+(R||P?"["+Ur.call(x1.call([],R||[],P||[]),": ")+"] ":"");return A.length===0?k+"{}":u?k+"{"+tg(A,u)+"}":k+"{ "+Ur.call(A,", ")+" }"}return String(t)};function P1(i,t,e){var r=e.quoteStyle||t,s=C1[r];return s+i+s}function yF(i){return Pi.call(String(i),/"/g,""")}function is(i){return!hh||!(typeof i=="object"&&(hh in i||typeof i[hh]<"u"))}function Jm(i){return Ri(i)==="[object Array]"&&is(i)}function bF(i){return Ri(i)==="[object Date]"&&is(i)}function S1(i){return Ri(i)==="[object RegExp]"&&is(i)}function vF(i){return Ri(i)==="[object Error]"&&is(i)}function TF(i){return Ri(i)==="[object String]"&&is(i)}function SF(i){return Ri(i)==="[object Number]"&&is(i)}function EF(i){return Ri(i)==="[object Boolean]"&&is(i)}function R1(i){if(Io)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Zm)return!1;try{return Zm.call(i),!0}catch{}return!1}function AF(i){if(!i||typeof i!="object"||!Km)return!1;try{return Km.call(i),!0}catch{}return!1}var wF=Object.prototype.hasOwnProperty||function(i){return i in this};function ri(i,t){return wF.call(i,t)}function Ri(i){return fF.call(i)}function CF(i){if(i.name)return i.name;var t=mF.call(pF.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function M1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function PF(i){if(!au||!i||typeof i!="object")return!1;try{au.call(i);try{hu.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function RF(i){if(!nh||!i||typeof i!="object")return!1;try{nh.call(i,nh);try{ah.call(i,ah)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function MF(i){if(!m1||!i||typeof i!="object")return!1;try{return m1.call(i),!0}catch{}return!1}function BF(i){if(!hu||!i||typeof i!="object")return!1;try{hu.call(i);try{au.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function IF(i){if(!ah||!i||typeof i!="object")return!1;try{ah.call(i,ah);try{nh.call(i,nh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function FF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function B1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return B1(ig.call(i,0,t.maxStringLength),t)+r}var s=_F[t.quoteStyle||"single"];s.lastIndex=0;var o=Pi.call(Pi.call(i,s,"\\$1"),/[\x00-\x1f]/g,GF);return P1(o,"single",t)}function GF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+gF.call(t.toString(16))}function oh(i){return"Object("+i+")"}function qm(i){return i+" { ? }"}function E1(i,t,e,r){var s=r?tg(e,r):Ur.call(e,", ");return i+" ("+t+") {"+s+"}"}function UF(i){for(var t=0;t<i.length;t++)if(M1(i[t],`
|
|
1089
|
+
`))}var BA=x(()=>{Mc();Ae();nm();RA()});var Za,IA=x(()=>{C();BA();Za=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return MA(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Za.extension={type:[y.WebGLSystem],name:"uniformGroup"}});function FA(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof $.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var GA=x(()=>{Rt()});var tI,eI,rI,iI,sI,oI,UA,kA,OA=x(()=>{C();mr();GA();tI=0,eI=1,rI=2,iI=3,sI=4,oI=5,UA=class Cm{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[tI]=this.setBlend,this.map[eI]=this.setOffset,this.map[rI]=this.setCullFace,this.map[iI]=this.setDepthTest,this.map[sI]=this.setFrontFace,this.map[oI]=this.setDepthMask,this.checks=[],this.defaultState=$t.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=FA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Cm._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Cm._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};UA.extension={type:[y.WebGLSystem],name:"state"};kA=UA});var $c,LA=x(()=>{_m();$c=class{constructor(t){this.target=xm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=ft.UNSIGNED_BYTE,this.internalFormat=Lc.RGBA,this.format=Lc.RGBA,this.samplerType=0}}});var DA,NA=x(()=>{"use strict";DA={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var nI,HA,VA=x(()=>{"use strict";nI={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},HA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!nI[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Xc,Pm=x(()=>{"use strict";Xc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var WA,zA=x(()=>{Pm();WA={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Xc.upload(i,t,e,r)}}});var Rm,$A,jc,XA,jA=x(()=>{"use strict";Rm={linear:9729,nearest:9728},$A={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},jc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},XA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Mm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=jc[n?"clamp-to-edge":i.addressModeU],c=jc[n?"clamp-to-edge":i.addressModeV],u=jc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Rm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=$A[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Rm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,XA[i.compare])}var YA=x(()=>{jA()});function qA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var KA=x(()=>{"use strict"});function ZA(i,t){let e={},r=i.RGBA;return i instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var QA=x(()=>{Rt()});function JA(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var tw=x(()=>{"use strict"});var aI,Qa,ew=x(()=>{Rt();C();vt();LA();NA();VA();Pm();zA();YA();KA();QA();tw();aI=4,Qa=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Xc,buffer:DA,video:WA,compressed:HA},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=ZA(t,this._renderer.context.extensions),this._mapFormatToType=JA(t),this._mapFormatToFormat=qA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new $c(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Mm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Mm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=$.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(aI*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Qa.extension={type:[y.WebGLSystem],name:"texture"}});var ow={};lx(ow,{WebGLRenderer:()=>Bm});var hI,lI,cI,rw,iw,sw,Bm,nw=x(()=>{C();UE();kE();OE();sa();im();Mr();NE();WE();jE();KE();ZE();QE();JE();oA();hA();wA();IA();OA();ew();hI=[...Cc,Ya,qE,VE,Wa,Qa,qa,za,Za,Ka,Xa,kA,ja,$a],lI=[...Pc],cI=[Ha,Na,Da],rw=[],iw=[],sw=[];G.handleByNamedList(y.WebGLSystem,rw);G.handleByNamedList(y.WebGLPipes,iw);G.handleByNamedList(y.WebGLPipesAdaptor,sw);G.add(...hI,...lI,...cI);Bm=class extends Ei{constructor(){let t={name:"webgl",type:Qt.WEBGL,systems:rw,renderPipes:iw,renderPipeAdaptors:sw};super(t)}}});var l1=K((Int,$m)=>{"use strict";var aF=Object.prototype.hasOwnProperty,Re="~";function sh(){}Object.create&&(sh.prototype=Object.create(null),new sh().__proto__||(Re=!1));function hF(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function h1(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new hF(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function ou(i,t){--i._eventsCount===0?i._events=new sh:delete i._events[t]}function be(){this._events=new sh,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)aF.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};be.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};be.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};be.prototype.on=function(t,e,r){return h1(this,t,e,r,!1)};be.prototype.once=function(t,e,r){return h1(this,t,e,r,!0)};be.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return ou(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&ou(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:ou(this,o)}return this};be.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&ou(this,e)):(this._events=new sh,this._eventsCount=0),this};be.prototype.off=be.prototype.removeListener;be.prototype.addListener=be.prototype.on;be.prefixed=Re;be.EventEmitter=be;typeof $m<"u"&&($m.exports=be)});var c1=K((Mo,Bo)=>{(function(i){var t=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,e=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=n-a,v=Math.floor,T=String.fromCharCode,A;function S(H){throw new RangeError(b[H])}function w(H,k){for(var tt=H.length,yt=[];tt--;)yt[tt]=k(H[tt]);return yt}function M(H,k){var tt=H.split("@"),yt="";tt.length>1&&(yt=tt[0]+"@",H=tt[1]),H=H.replace(g,".");var mt=H.split("."),Ot=w(mt,k).join(".");return yt+Ot}function P(H){for(var k=[],tt=0,yt=H.length,mt,Ot;tt<yt;)mt=H.charCodeAt(tt++),mt>=55296&&mt<=56319&&tt<yt?(Ot=H.charCodeAt(tt++),(Ot&64512)==56320?k.push(((mt&1023)<<10)+(Ot&1023)+65536):(k.push(mt),tt--)):k.push(mt);return k}function R(H){return w(H,function(k){var tt="";return k>65535&&(k-=65536,tt+=T(k>>>10&1023|55296),k=56320|k&1023),tt+=T(k),tt}).join("")}function B(H){return H-48<10?H-22:H-65<26?H-65:H-97<26?H-97:n}function F(H,k){return H+22+75*(H<26)-((k!=0)<<5)}function W(H,k,tt){var yt=0;for(H=tt?v(H/c):H>>1,H+=v(H/k);H>_*h>>1;yt+=n)H=v(H/_);return v(yt+(_+1)*H/(H+l))}function D(H){var k=[],tt=H.length,yt,mt=0,Ot=d,Lt=u,Yt,re,ge,Tt,ct,gt,Ft,qt,Kt;for(Yt=H.lastIndexOf(f),Yt<0&&(Yt=0),re=0;re<Yt;++re)H.charCodeAt(re)>=128&&S("not-basic"),k.push(H.charCodeAt(re));for(ge=Yt>0?Yt+1:0;ge<tt;){for(Tt=mt,ct=1,gt=n;ge>=tt&&S("invalid-input"),Ft=B(H.charCodeAt(ge++)),(Ft>=n||Ft>v((o-mt)/ct))&&S("overflow"),mt+=Ft*ct,qt=gt<=Lt?a:gt>=Lt+h?h:gt-Lt,!(Ft<qt);gt+=n)Kt=n-qt,ct>v(o/Kt)&&S("overflow"),ct*=Kt;yt=k.length+1,Lt=W(mt-Tt,yt,Tt==0),v(mt/yt)>o-Ot&&S("overflow"),Ot+=v(mt/yt),mt%=yt,k.splice(mt++,0,Ot)}return R(k)}function it(H){var k,tt,yt,mt,Ot,Lt,Yt,re,ge,Tt,ct,gt=[],Ft,qt,Kt,Me;for(H=P(H),Ft=H.length,k=d,tt=0,Ot=u,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct<128&>.push(T(ct));for(yt=mt=gt.length,mt&>.push(f);yt<Ft;){for(Yt=o,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct>=k&&ct<Yt&&(Yt=ct);for(qt=yt+1,Yt-k>v((o-tt)/qt)&&S("overflow"),tt+=(Yt-k)*qt,k=Yt,Lt=0;Lt<Ft;++Lt)if(ct=H[Lt],ct<k&&++tt>o&&S("overflow"),ct==k){for(re=tt,ge=n;Tt=ge<=Ot?a:ge>=Ot+h?h:ge-Ot,!(re<Tt);ge+=n)Me=re-Tt,Kt=n-Tt,gt.push(T(F(Tt+Me%Kt,0))),re=v(Me/Kt);gt.push(T(F(re,0))),Ot=W(tt,qt,yt==mt),tt=0,++yt}++tt,++k}return gt.join("")}function L(H){return M(H,function(k){return p.test(k)?D(k.slice(4).toLowerCase()):k})}function X(H){return M(H,function(k){return m.test(k)?"xn--"+it(k):k})}if(s={version:"1.4.1",ucs2:{decode:P,encode:R},decode:D,encode:it,toASCII:X,toUnicode:L},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Bo.exports==t)e.exports=s;else for(A in s)s.hasOwnProperty(A)&&(t[A]=s[A]);else i.punycode=s})(Mo)});var rs=K((Fnt,u1)=>{"use strict";u1.exports=TypeError});var d1=K(()=>{});var lh=K((knt,I1)=>{var eg=typeof Map=="function"&&Map.prototype,Xm=Object.getOwnPropertyDescriptor&&eg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,au=eg&&Xm&&typeof Xm.get=="function"?Xm.get:null,f1=eg&&Map.prototype.forEach,rg=typeof Set=="function"&&Set.prototype,jm=Object.getOwnPropertyDescriptor&&rg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,hu=rg&&jm&&typeof jm.get=="function"?jm.get:null,p1=rg&&Set.prototype.forEach,lF=typeof WeakMap=="function"&&WeakMap.prototype,nh=lF?WeakMap.prototype.has:null,cF=typeof WeakSet=="function"&&WeakSet.prototype,ah=cF?WeakSet.prototype.has:null,uF=typeof WeakRef=="function"&&WeakRef.prototype,m1=uF?WeakRef.prototype.deref:null,dF=Boolean.prototype.valueOf,fF=Object.prototype.toString,pF=Function.prototype.toString,mF=String.prototype.match,ig=String.prototype.slice,Pi=String.prototype.replace,gF=String.prototype.toUpperCase,g1=String.prototype.toLowerCase,A1=RegExp.prototype.test,x1=Array.prototype.concat,Ur=Array.prototype.join,xF=Array.prototype.slice,_1=Math.floor,Km=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ym=Object.getOwnPropertySymbols,Zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Io=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Io||!0)?Symbol.toStringTag:null,w1=Object.prototype.propertyIsEnumerable,y1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function b1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||A1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-_1(-i):_1(i);if(r!==i){var s=String(r),o=ig.call(t,s.length+1);return Pi.call(s,e,"$&_")+"."+Pi.call(Pi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Pi.call(t,e,"$&_")}var Qm=d1(),v1=Qm.custom,T1=R1(v1)?v1:null,C1={__proto__:null,double:'"',single:"'"},_F={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};I1.exports=function i(t,e,r,s){var o=e||{};if(ri(o,"quoteStyle")&&!ri(C1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ri(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ri(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ri(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ri(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return B1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?b1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?b1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return Jm(t)?"[Array]":"[Object]";var u=kF(o,r);if(typeof s>"u")s=[];else if(M1(s,t)>=0)return"[Circular]";function d(W,D,it){if(D&&(s=xF.call(s),s.push(D)),it){var L={depth:o.depth};return ri(o,"quoteStyle")&&(L.quoteStyle=o.quoteStyle),i(W,L,r+1,s)}return i(W,o,r+1,s)}if(typeof t=="function"&&!S1(t)){var f=CF(t),p=nu(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ur.call(p,", ")+" }":"")}if(R1(t)){var m=Io?Pi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zm.call(t);return typeof t=="object"&&!Io?oh(m):m}if(FF(t)){for(var g="<"+g1.call(String(t.nodeName)),b=t.attributes||[],_=0;_<b.length;_++)g+=" "+b[_].name+"="+P1(yF(b[_].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+g1.call(String(t.nodeName))+">",g}if(Jm(t)){if(t.length===0)return"[]";var v=nu(t,d);return u&&!UF(v)?"["+tg(v,u)+"]":"[ "+Ur.call(v,", ")+" ]"}if(vF(t)){var T=nu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!w1.call(t,"cause")?"{ ["+String(t)+"] "+Ur.call(x1.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ur.call(T,", ")+" }"}if(typeof t=="object"&&n){if(T1&&typeof t[T1]=="function"&&Qm)return Qm(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(PF(t)){var A=[];return f1&&f1.call(t,function(W,D){A.push(d(D,t,!0)+" => "+d(W,t))}),E1("Map",au.call(t),A,u)}if(BF(t)){var S=[];return p1&&p1.call(t,function(W){S.push(d(W,t))}),E1("Set",hu.call(t),S,u)}if(RF(t))return qm("WeakMap");if(IF(t))return qm("WeakSet");if(MF(t))return qm("WeakRef");if(SF(t))return oh(d(Number(t)));if(AF(t))return oh(d(Km.call(t)));if(EF(t))return oh(dF.call(t));if(TF(t))return oh(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!bF(t)&&!S1(t)){var w=nu(t,d),M=y1?y1(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",R=!M&&hh&&Object(t)===t&&hh in t?ig.call(Ri(t),8,-1):P?"Object":"",B=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",F=B+(R||P?"["+Ur.call(x1.call([],R||[],P||[]),": ")+"] ":"");return w.length===0?F+"{}":u?F+"{"+tg(w,u)+"}":F+"{ "+Ur.call(w,", ")+" }"}return String(t)};function P1(i,t,e){var r=e.quoteStyle||t,s=C1[r];return s+i+s}function yF(i){return Pi.call(String(i),/"/g,""")}function is(i){return!hh||!(typeof i=="object"&&(hh in i||typeof i[hh]<"u"))}function Jm(i){return Ri(i)==="[object Array]"&&is(i)}function bF(i){return Ri(i)==="[object Date]"&&is(i)}function S1(i){return Ri(i)==="[object RegExp]"&&is(i)}function vF(i){return Ri(i)==="[object Error]"&&is(i)}function TF(i){return Ri(i)==="[object String]"&&is(i)}function SF(i){return Ri(i)==="[object Number]"&&is(i)}function EF(i){return Ri(i)==="[object Boolean]"&&is(i)}function R1(i){if(Io)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Zm)return!1;try{return Zm.call(i),!0}catch{}return!1}function AF(i){if(!i||typeof i!="object"||!Km)return!1;try{return Km.call(i),!0}catch{}return!1}var wF=Object.prototype.hasOwnProperty||function(i){return i in this};function ri(i,t){return wF.call(i,t)}function Ri(i){return fF.call(i)}function CF(i){if(i.name)return i.name;var t=mF.call(pF.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function M1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function PF(i){if(!au||!i||typeof i!="object")return!1;try{au.call(i);try{hu.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function RF(i){if(!nh||!i||typeof i!="object")return!1;try{nh.call(i,nh);try{ah.call(i,ah)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function MF(i){if(!m1||!i||typeof i!="object")return!1;try{return m1.call(i),!0}catch{}return!1}function BF(i){if(!hu||!i||typeof i!="object")return!1;try{hu.call(i);try{au.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function IF(i){if(!ah||!i||typeof i!="object")return!1;try{ah.call(i,ah);try{nh.call(i,nh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function FF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function B1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return B1(ig.call(i,0,t.maxStringLength),t)+r}var s=_F[t.quoteStyle||"single"];s.lastIndex=0;var o=Pi.call(Pi.call(i,s,"\\$1"),/[\x00-\x1f]/g,GF);return P1(o,"single",t)}function GF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+gF.call(t.toString(16))}function oh(i){return"Object("+i+")"}function qm(i){return i+" { ? }"}function E1(i,t,e,r){var s=r?tg(e,r):Ur.call(e,", ");return i+" ("+t+") {"+s+"}"}function UF(i){for(var t=0;t<i.length;t++)if(M1(i[t],`
|
|
1090
1090
|
`)>=0)return!1;return!0}function kF(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=Ur.call(Array(i.indent+1)," ");else return null;return{base:e,prev:Ur.call(Array(t+1),e)}}function tg(i,t){if(i.length===0)return"";var e=`
|
|
1091
1091
|
`+t.prev+t.base;return e+Ur.call(i,","+e)+`
|
|
1092
|
-
`+t.prev}function nu(i,t){var e=Jm(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ri(i,s)?t(i[s],i):""}var o=typeof Ym=="function"?Ym(i):[],n;if(Io){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ri(i,h)&&(e&&String(Number(h))===h&&h<i.length||Io&&n["$"+h]instanceof Symbol||(A1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Ym=="function")for(var l=0;l<o.length;l++)w1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var G1=K((Ont,F1)=>{"use strict";var OF=lh(),LF=rs(),lu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},DF=function(i,t){if(i){var e=lu(i,t);return e&&e.value}},NF=function(i,t,e){var r=lu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},HF=function(i,t){return i?!!lu(i,t):!1},VF=function(i,t){if(i)return lu(i,t,!0)};F1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new LF("Side channel does not contain "+OF(r))},delete:function(r){var s=t&&t.next,o=VF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return DF(t,r)},has:function(r){return HF(t,r)},set:function(r,s){t||(t={next:void 0}),NF(t,r,s)}};return e}});var sg=K((Lnt,U1)=>{"use strict";U1.exports=Object});var O1=K((Dnt,k1)=>{"use strict";k1.exports=Error});var D1=K((Nnt,L1)=>{"use strict";L1.exports=EvalError});var H1=K((Hnt,N1)=>{"use strict";N1.exports=RangeError});var W1=K((Vnt,V1)=>{"use strict";V1.exports=ReferenceError});var $1=K((Wnt,z1)=>{"use strict";z1.exports=SyntaxError});var j1=K((znt,X1)=>{"use strict";X1.exports=URIError});var q1=K(($nt,Y1)=>{"use strict";Y1.exports=Math.abs});var Z1=K((Xnt,K1)=>{"use strict";K1.exports=Math.floor});var J1=K((jnt,Q1)=>{"use strict";Q1.exports=Math.max});var eC=K((Ynt,tC)=>{"use strict";tC.exports=Math.min});var iC=K((qnt,rC)=>{"use strict";rC.exports=Math.pow});var oC=K((Knt,sC)=>{"use strict";sC.exports=Math.round});var aC=K((Znt,nC)=>{"use strict";nC.exports=Number.isNaN||function(t){return t!==t}});var lC=K((Qnt,hC)=>{"use strict";var WF=aC();hC.exports=function(t){return WF(t)||t===0?t:t<0?-1:1}});var uC=K((Jnt,cC)=>{"use strict";cC.exports=Object.getOwnPropertyDescriptor});var og=K((tat,dC)=>{"use strict";var cu=uC();if(cu)try{cu([],"length")}catch{cu=null}dC.exports=cu});var pC=K((eat,fC)=>{"use strict";var uu=Object.defineProperty||!1;if(uu)try{uu({},"a",{value:1})}catch{uu=!1}fC.exports=uu});var gC=K((rat,mC)=>{"use strict";mC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var yC=K((iat,_C)=>{"use strict";var xC=typeof Symbol<"u"&&Symbol,zF=gC();_C.exports=function(){return typeof xC!="function"||typeof Symbol!="function"||typeof xC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:zF()}});var ng=K((sat,bC)=>{"use strict";bC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ag=K((oat,vC)=>{"use strict";var $F=sg();vC.exports=$F.getPrototypeOf||null});var EC=K((nat,SC)=>{"use strict";var XF="Function.prototype.bind called on incompatible ",jF=Object.prototype.toString,YF=Math.max,qF="[object Function]",TC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},KF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},ZF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};SC.exports=function(t){var e=this;if(typeof e!="function"||jF.apply(e)!==qF)throw new TypeError(XF+e);for(var r=KF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,TC(r,arguments));return Object(c)===c?c:this}return e.apply(t,TC(r,arguments))},n=YF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+ZF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ch=K((aat,AC)=>{"use strict";var QF=EC();AC.exports=Function.prototype.bind||QF});var du=K((hat,wC)=>{"use strict";wC.exports=Function.prototype.call});var hg=K((lat,CC)=>{"use strict";CC.exports=Function.prototype.apply});var RC=K((cat,PC)=>{"use strict";PC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var BC=K((uat,MC)=>{"use strict";var JF=ch(),tG=hg(),eG=du(),rG=RC();MC.exports=rG||JF.call(eG,tG)});var lg=K((dat,IC)=>{"use strict";var iG=ch(),sG=rs(),oG=du(),nG=BC();IC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new sG("a function is required");return nG(iG,oG,t)}});var LC=K((fat,OC)=>{"use strict";var aG=lg(),FC=og(),UC;try{UC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var cg=!!UC&&FC&&FC(Object.prototype,"__proto__"),kC=Object,GC=kC.getPrototypeOf;OC.exports=cg&&typeof cg.get=="function"?aG([cg.get]):typeof GC=="function"?function(t){return GC(t==null?t:kC(t))}:!1});var WC=K((pat,VC)=>{"use strict";var DC=ng(),NC=ag(),HC=LC();VC.exports=DC?function(t){return DC(t)}:NC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return NC(t)}:HC?function(t){return HC(t)}:null});var $C=K((mat,zC)=>{"use strict";var hG=Function.prototype.call,lG=Object.prototype.hasOwnProperty,cG=ch();zC.exports=cG.call(hG,lG)});var mu=K((gat,ZC)=>{"use strict";var lt,uG=sg(),dG=O1(),fG=D1(),pG=H1(),mG=W1(),ko=$1(),Uo=rs(),gG=j1(),xG=q1(),_G=Z1(),yG=J1(),bG=eC(),vG=iC(),TG=oC(),SG=lC(),qC=Function,ug=function(i){try{return qC('"use strict"; return ('+i+").constructor;")()}catch{}},uh=og(),EG=pC(),dg=function(){throw new Uo},AG=uh?function(){try{return arguments.callee,dg}catch{try{return uh(arguments,"callee").get}catch{return dg}}}():dg,Fo=yC()(),de=WC(),wG=ag(),CG=ng(),KC=hg(),dh=du(),Go={},PG=typeof Uint8Array>"u"||!de?lt:de(Uint8Array),ss={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?lt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?lt:ArrayBuffer,"%ArrayIteratorPrototype%":Fo&&de?de([][Symbol.iterator]()):lt,"%AsyncFromSyncIteratorPrototype%":lt,"%AsyncFunction%":Go,"%AsyncGenerator%":Go,"%AsyncGeneratorFunction%":Go,"%AsyncIteratorPrototype%":Go,"%Atomics%":typeof Atomics>"u"?lt:Atomics,"%BigInt%":typeof BigInt>"u"?lt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?lt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?lt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?lt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":dG,"%eval%":eval,"%EvalError%":fG,"%Float16Array%":typeof Float16Array>"u"?lt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?lt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?lt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?lt:FinalizationRegistry,"%Function%":qC,"%GeneratorFunction%":Go,"%Int8Array%":typeof Int8Array>"u"?lt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?lt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?lt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fo&&de?de(de([][Symbol.iterator]())):lt,"%JSON%":typeof JSON=="object"?JSON:lt,"%Map%":typeof Map>"u"?lt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fo||!de?lt:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":uG,"%Object.getOwnPropertyDescriptor%":uh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?lt:Promise,"%Proxy%":typeof Proxy>"u"?lt:Proxy,"%RangeError%":pG,"%ReferenceError%":mG,"%Reflect%":typeof Reflect>"u"?lt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?lt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fo||!de?lt:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?lt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fo&&de?de(""[Symbol.iterator]()):lt,"%Symbol%":Fo?Symbol:lt,"%SyntaxError%":ko,"%ThrowTypeError%":AG,"%TypedArray%":PG,"%TypeError%":Uo,"%Uint8Array%":typeof Uint8Array>"u"?lt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?lt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?lt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?lt:Uint32Array,"%URIError%":gG,"%WeakMap%":typeof WeakMap>"u"?lt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?lt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?lt:WeakSet,"%Function.prototype.call%":dh,"%Function.prototype.apply%":KC,"%Object.defineProperty%":EG,"%Object.getPrototypeOf%":wG,"%Math.abs%":xG,"%Math.floor%":_G,"%Math.max%":yG,"%Math.min%":bG,"%Math.pow%":vG,"%Math.round%":TG,"%Math.sign%":SG,"%Reflect.getPrototypeOf%":CG};if(de)try{null.error}catch(i){XC=de(de(i)),ss["%Error.prototype%"]=XC}var XC,RG=function i(t){var e;if(t==="%AsyncFunction%")e=ug("async function () {}");else if(t==="%GeneratorFunction%")e=ug("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ug("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&de&&(e=de(s.prototype))}return ss[t]=e,e},jC={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fh=ch(),fu=$C(),MG=fh.call(dh,Array.prototype.concat),BG=fh.call(KC,Array.prototype.splice),YC=fh.call(dh,String.prototype.replace),pu=fh.call(dh,String.prototype.slice),IG=fh.call(dh,RegExp.prototype.exec),FG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,GG=/\\(\\)?/g,UG=function(t){var e=pu(t,0,1),r=pu(t,-1);if(e==="%"&&r!=="%")throw new ko("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new ko("invalid intrinsic syntax, expected opening `%`");var s=[];return YC(t,FG,function(o,n,a,h){s[s.length]=a?YC(h,GG,"$1"):n||o}),s},kG=function(t,e){var r=t,s;if(fu(jC,r)&&(s=jC[r],r="%"+s[0]+"%"),fu(ss,r)){var o=ss[r];if(o===Go&&(o=RG(r)),typeof o>"u"&&!e)throw new Uo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new ko("intrinsic "+t+" does not exist!")};ZC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Uo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Uo('"allowMissing" argument must be a boolean');if(IG(/^%?[^%]*%?$/,t)===null)throw new ko("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=UG(t),s=r.length>0?r[0]:"",o=kG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],BG(r,MG([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=pu(d,0,1),p=pu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new ko("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",fu(ss,n))a=ss[n];else if(a!=null){if(!(d in a)){if(!e)throw new Uo("base intrinsic for "+t+" exists, but the property is not available.");return}if(uh&&c+1>=r.length){var m=uh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=fu(a,d),a=a[d];u&&!h&&(ss[n]=a)}}return a}});var fg=K((xat,tP)=>{"use strict";var QC=mu(),JC=lg(),OG=JC([QC("%String.prototype.indexOf%")]);tP.exports=function(t,e){var r=QC(t,!!e);return typeof r=="function"&&OG(t,".prototype.")>-1?JC([r]):r}});var pg=K((_at,rP)=>{"use strict";var LG=mu(),ph=fg(),DG=lh(),NG=rs(),eP=LG("%Map%",!0),HG=ph("Map.prototype.get",!0),VG=ph("Map.prototype.set",!0),WG=ph("Map.prototype.has",!0),zG=ph("Map.prototype.delete",!0),$G=ph("Map.prototype.size",!0);rP.exports=!!eP&&function(){var t,e={assert:function(r){if(!e.has(r))throw new NG("Side channel does not contain "+DG(r))},delete:function(r){if(t){var s=zG(t,r);return $G(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return HG(t,r)},has:function(r){return t?WG(t,r):!1},set:function(r,s){t||(t=new eP),VG(t,r,s)}};return e}});var sP=K((yat,iP)=>{"use strict";var XG=mu(),xu=fg(),jG=lh(),gu=pg(),YG=rs(),Oo=XG("%WeakMap%",!0),qG=xu("WeakMap.prototype.get",!0),KG=xu("WeakMap.prototype.set",!0),ZG=xu("WeakMap.prototype.has",!0),QG=xu("WeakMap.prototype.delete",!0);iP.exports=Oo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new YG("Side channel does not contain "+jG(s))},delete:function(s){if(Oo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return QG(t,s)}else if(gu&&e)return e.delete(s);return!1},get:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?qG(t,s):e&&e.get(s)},has:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?ZG(t,s):!!e&&e.has(s)},set:function(s,o){Oo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Oo),KG(t,s,o)):gu&&(e||(e=gu()),e.set(s,o))}};return r}:gu});var nP=K((bat,oP)=>{"use strict";var JG=rs(),t2=lh(),e2=G1(),r2=pg(),i2=sP(),s2=i2||r2||e2;oP.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new JG("Side channel does not contain "+t2(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=s2()),t.set(r,s)}};return e}});var _u=K((vat,aP)=>{"use strict";var o2=String.prototype.replace,n2=/%20/g,mg={RFC1738:"RFC1738",RFC3986:"RFC3986"};aP.exports={default:mg.RFC3986,formatters:{RFC1738:function(i){return o2.call(i,n2,"+")},RFC3986:function(i){return String(i)}},RFC1738:mg.RFC1738,RFC3986:mg.RFC3986}});var _g=K((Tat,lP)=>{"use strict";var a2=_u(),gg=Object.prototype.hasOwnProperty,os=Array.isArray,kr=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),h2=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(os(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},hP=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},l2=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(os(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!gg.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return os(t)&&!os(e)&&(s=hP(t,r)),os(t)&&os(e)?(e.forEach(function(o,n){if(gg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return gg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},c2=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},u2=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},xg=1024,d2=function(t,e,r,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",h=0;h<n.length;h+=xg){for(var l=n.length>=xg?n.slice(h,h+xg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===a2.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=kr[d];continue}if(d<2048){c[c.length]=kr[192|d>>6]+kr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=kr[224|d>>12]+kr[128|d>>6&63]+kr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=kr[240|d>>18]+kr[128|d>>12&63]+kr[128|d>>6&63]+kr[128|d&63]}a+=c.join("")}return a},f2=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return h2(e),t},p2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},m2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},g2=function(t,e){return[].concat(t,e)},x2=function(t,e){if(os(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};lP.exports={arrayToObject:hP,assign:c2,combine:g2,compact:f2,decode:u2,encode:d2,isBuffer:m2,isRegExp:p2,maybeMap:x2,merge:l2}});var mP=K((Sat,pP)=>{"use strict";var uP=nP(),yu=_g(),mh=_u(),_2=Object.prototype.hasOwnProperty,dP={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Or=Array.isArray,y2=Array.prototype.push,fP=function(i,t){y2.apply(i,Or(t)?t:[t])},b2=Date.prototype.toISOString,cP=mh.default,oe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:yu.encode,encodeValuesOnly:!1,filter:void 0,format:cP,formatter:mh.formatters[cP],indices:!1,serializeDate:function(t){return b2.call(t)},skipNulls:!1,strictNullHandling:!1},v2=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},yg={},T2=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m,g,b,_){for(var v=t,T=_,w=0,S=!1;(T=T.get(yg))!==void 0&&!S;){var A=T.get(t);if(w+=1,typeof A<"u"){if(A===w)throw new RangeError("Cyclic object value");S=!0}typeof T.get(yg)>"u"&&(w=0)}if(typeof c=="function"?v=c(e,v):v instanceof Date?v=f(v):r==="comma"&&Or(v)&&(v=yu.maybeMap(v,function(tt){return tt instanceof Date?f(tt):tt})),v===null){if(n)return l&&!g?l(e,oe.encoder,b,"key",p):e;v=""}if(v2(v)||yu.isBuffer(v)){if(l){var M=g?e:l(e,oe.encoder,b,"key",p);return[m(M)+"="+m(l(v,oe.encoder,b,"value",p))]}return[m(e)+"="+m(String(v))]}var P=[];if(typeof v>"u")return P;var R;if(r==="comma"&&Or(v))g&&l&&(v=yu.maybeMap(v,l)),R=[{value:v.length>0?v.join(",")||null:void 0}];else if(Or(c))R=c;else{var I=Object.keys(v);R=u?I.sort(u):I}var k=h?String(e).replace(/\./g,"%2E"):String(e),j=s&&Or(v)&&v.length===1?k+"[]":k;if(o&&Or(v)&&v.length===0)return j+"[]";for(var N=0;N<R.length;++N){var ot=R[N],L=typeof ot=="object"&&ot&&typeof ot.value<"u"?ot.value:v[ot];if(!(a&&L===null)){var $=d&&h?String(ot).replace(/\./g,"%2E"):String(ot),H=Or(v)?typeof r=="function"?r(j,$):j:j+(d?"."+$:"["+$+"]");_.set(t,w);var U=uP();U.set(yg,_),fP(P,i(L,H,r,s,o,n,a,h,r==="comma"&&g&&Or(v)?null:l,c,u,d,f,p,m,g,b,U))}}return P},S2=function(t){if(!t)return oe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||oe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=mh.default;if(typeof t.format<"u"){if(!_2.call(mh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=mh.formatters[r],o=oe.filter;(typeof t.filter=="function"||Or(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in dP?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=oe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:oe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:oe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:oe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?oe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:oe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:oe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:oe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:oe.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:oe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:oe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}};pP.exports=function(i,t){var e=i,r=S2(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Or(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=dP[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=uP(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||fP(n,T2(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var yP=K((Eat,_P)=>{"use strict";var ns=_g(),bg=Object.prototype.hasOwnProperty,gP=Array.isArray,zt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ns.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},E2=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},xP=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},A2="utf8=%26%2310003%3B",w2="utf8=%E2%9C%93",C2=function(t,e){var r={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===w2?l="utf-8":n[h]===A2&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,zt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),zt.decoder,l,"key"),p=ns.maybeMap(xP(c.slice(d+1),e,gP(r[f])?r[f].length:0),function(g){return e.decoder(g,zt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=E2(String(p))),c.indexOf("[]=")>-1&&(p=gP(p)?[p]:p);var m=bg.call(r,f);m&&e.duplicates==="combine"?r[f]=ns.combine(r[f],p):(!m||e.duplicates==="last")&&(r[f]=p)}return r},P2=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:xP(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:ns.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},R2=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&bg.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&bg.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return P2(c,e,r,s)}},M2=function(t){if(!t)return zt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?zt.charset:t.charset,r=typeof t.duplicates>"u"?zt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:zt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:zt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:zt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:zt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:zt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:zt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:zt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:zt.decoder,delimiter:typeof t.delimiter=="string"||ns.isRegExp(t.delimiter)?t.delimiter:zt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:zt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:zt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:zt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:zt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};_P.exports=function(i,t){var e=M2(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?C2(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=R2(a,r[a],e,typeof i=="string");s=ns.merge(s,h,e)}return e.allowSparse===!0?s:ns.compact(s)}});var vP=K((Aat,bP)=>{"use strict";var B2=mP(),I2=yP(),F2=_u();bP.exports={formats:F2,parse:I2,stringify:B2}});var AP=K(Do=>{"use strict";var G2=c1();function hr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var U2=/^([a-z0-9.+-]+:)/i,k2=/:[0-9]*$/,O2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,L2=["<",">",'"',"`"," ","\r",`
|
|
1093
|
-
`," "],D2=["{","}","|","\\","^","`"].concat(L2),vg=["'"].concat(D2),TP=["%","/","?",";","#"].concat(vg),SP=["/","?","#"],N2=255,EP=/^[+a-z0-9A-Z_-]{0,63}$/,H2=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,V2={javascript:!0,"javascript:":!0},Tg={javascript:!0,"javascript:":!0},Lo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sg=vP();function gh(i,t,e){if(i&&typeof i=="object"&&i instanceof hr)return i;var r=new hr;return r.parse(i,t,e),r}hr.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=O2.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=U2.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&Tg[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tg[l]&&(u||l&&!Lo[l])){for(var d=-1,f=0;f<SP.length;f++){var p=a.indexOf(SP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<TP.length;f++){var p=a.indexOf(TP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var b=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!b)for(var _=this.hostname.split(/\./),f=0,v=_.length;f<v;f++){var T=_[f];if(T&&!T.match(EP)){for(var w="",S=0,A=T.length;S<A;S++)T.charCodeAt(S)>127?w+="x":w+=T[S];if(!w.match(EP)){var M=_.slice(0,f),P=_.slice(f+1),R=T.match(H2);R&&(M.push(R[1]),P.unshift(R[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>N2?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=G2.toASCII(this.hostname));var I=this.port?":"+this.port:"",k=this.hostname||"";this.host=k+I,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!V2[c])for(var f=0,v=vg.length;f<v;f++){var j=vg[f];if(a.indexOf(j)!==-1){var N=encodeURIComponent(j);N===j&&(N=escape(j)),a=a.split(j).join(N)}}var ot=a.indexOf("#");ot!==-1&&(this.hash=a.substr(ot),a=a.slice(0,ot));var L=a.indexOf("?");if(L!==-1?(this.search=a.substr(L),this.query=a.substr(L+1),t&&(this.query=Sg.parse(this.query)),a=a.slice(0,L)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Lo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var I=this.pathname||"",$=this.search||"";this.path=I+$}return this.href=this.format(),this};function W2(i){return typeof i=="string"&&(i=gh(i)),i instanceof hr?i.format():hr.prototype.format.call(i)}hr.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Sg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Lo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function z2(i,t){return gh(i,!1,!0).resolve(t)}hr.prototype.resolve=function(i){return this.resolveObject(gh(i,!1,!0)).format()};function $2(i,t){return i?gh(i,!1,!0).resolveObject(t):t}hr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new hr;t.parse(i,!1,!0),i=t}for(var e=new hr,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Lo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Lo[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!Tg[i.protocol]){for(var v=(i.pathname||"").split("/");v.length&&!(i.host=v.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),v[0]!==""&&v.unshift(""),v.length<2&&v.unshift(""),e.pathname=v.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",g=m||p||e.host&&i.pathname,b=g,_=e.pathname&&e.pathname.split("/")||[],v=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Lo[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(v[0]===""?v[0]=i.host:v.unshift(i.host)),i.host=null),g=g&&(v[0]===""||_[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,_=v;else if(v.length)_||(_=[]),_.pop(),_=_.concat(v),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=_.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=_.slice(-1)[0],A=(e.host||i.host||_.length>1)&&(S==="."||S==="..")||S==="",M=0,P=_.length;P>=0;P--)S=_[P],S==="."?_.splice(P,1):S===".."?(_.splice(P,1),M++):M&&(_.splice(P,1),M--);if(!g&&!b)for(;M--;M)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),A&&_.join("/").substr(-1)!=="/"&&_.push("");var R=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(T){e.hostname=R?"":_.length?_.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!R&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};hr.prototype.parseHost=function(){var i=this.host,t=k2.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};Do.parse=gh;Do.resolve=z2;Do.resolveObject=$2;Do.format=W2;Do.Url=hr});var TR=()=>{let i=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))i.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};i.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of i.entries())n[a]=h;return n},clear:()=>i.clear(),size:()=>i.size,has:n=>i.has(n)}};C();var OT={extension:{type:y.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(kT(),MB))}};C();var DT={extension:{type:y.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(LT(),BB))}};C();C();Cl();bl();C();Rt();sa();var vc;function jT(i){return vc!==void 0||(vc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ei.defaultOptions.failIfMajorPerformanceCaveat};try{if(!z.get().getWebGLRenderingContext())return!1;let r=z.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),vc}Rt();var Tc;async function YT(i={}){return Tc!==void 0||(Tc=await(async()=>{let t=z.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Tc}sa();var aw=["webgl","webgpu","canvas"];async function hw(i){let t=[];i.preference?(t.push(i.preference),aw.forEach(o=>{o!==i.preference&&t.push(o)})):t=aw.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await YT()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(GE(),FE));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&jT(i.failIfMajorPerformanceCaveat??Ei.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(nw(),ow));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}dr();zp();Dt();var lw=class Im{constructor(...t){this.stage=new St,t[0]!==void 0&&W(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await hw(t),Im._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return W(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Im._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};lw._plugins=[];var Ja=lw;F.handleByList(y.Application,Ja._plugins);F.add(pa);C();Yr();zd();Rt();C();Wi();he();vt();bp();Ap();var th=class extends so{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new it(n.x+a.x,n.y+a.y,n.width,n.height),c=new E({source:h,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Kn.install(t)}static uninstall(t){Kn.uninstall(t)}};var Yc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let g=f[m].split("="),b=g[0],_=g[1].replace(/"/gm,""),v=parseFloat(_),T=isNaN(v)?_:v;p[b]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};Rt();var Fm={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Gm={test(i){return typeof i=="string"&&i.includes("<font>")?Fm.test(z.get().parseXML(i)):!1},parse(i){return Fm.parse(z.get().parseXML(i))}};var uI=[".xml",".fnt"],cw={extension:{type:y.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof th,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},uw={extension:{type:y.LoadParser,priority:le.Normal},name:"loadBitmapFont",test(i){return uI.includes(ie.extname(i).toLowerCase())},async testParse(i){return Yc.test(i)||Gm.test(i)},async parse(i,t,e){let r=Yc.test(i)?Yc.parse(i):Gm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ie.join(ie.dirname(s),d);f=En(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new th({data:r,textures:l},s)},async load(i,t){return await(await z.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};At();var qc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};gi();C();vt();var dw={extension:{type:y.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof E),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};C();async function Kc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var fw={extension:{type:y.DetectionParser,priority:1},test:async()=>Kc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};C();var pw=["png","jpg","jpeg"],mw={extension:{type:y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...pw],remove:async i=>i.filter(t=>!pw.includes(t))};C();var dI="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function yo(i){return dI?!1:document.createElement("video").canPlayType(i)!==""}var gw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};C();var xw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};C();var _w={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};C();var yw={extension:{type:y.DetectionParser,priority:0},test:async()=>Kc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};At();Wi();Sn();yl();var Zc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=zi(t),n=Ee(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ie.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
1094
|
-
${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t,s=>({alias:[s],src:s})).map(async s=>{let o=ie.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&O(`[Assets] loadParser name conflict "${e.name}"`):O("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Rt();C();function ir(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}Wi();function sr(i,t){let e=i.split("?")[0],r=ie.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}Yr();var fI=".json",pI="application/json",bw={extension:{type:y.LoadParser,priority:le.Low},name:"loadJson",test(i){return ir(i,pI)||sr(i,fI)},async load(i){return await(await
|
|
1092
|
+
`+t.prev}function nu(i,t){var e=Jm(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ri(i,s)?t(i[s],i):""}var o=typeof Ym=="function"?Ym(i):[],n;if(Io){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ri(i,h)&&(e&&String(Number(h))===h&&h<i.length||Io&&n["$"+h]instanceof Symbol||(A1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Ym=="function")for(var l=0;l<o.length;l++)w1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var G1=K((Ont,F1)=>{"use strict";var OF=lh(),LF=rs(),lu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},DF=function(i,t){if(i){var e=lu(i,t);return e&&e.value}},NF=function(i,t,e){var r=lu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},HF=function(i,t){return i?!!lu(i,t):!1},VF=function(i,t){if(i)return lu(i,t,!0)};F1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new LF("Side channel does not contain "+OF(r))},delete:function(r){var s=t&&t.next,o=VF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return DF(t,r)},has:function(r){return HF(t,r)},set:function(r,s){t||(t={next:void 0}),NF(t,r,s)}};return e}});var sg=K((Lnt,U1)=>{"use strict";U1.exports=Object});var O1=K((Dnt,k1)=>{"use strict";k1.exports=Error});var D1=K((Nnt,L1)=>{"use strict";L1.exports=EvalError});var H1=K((Hnt,N1)=>{"use strict";N1.exports=RangeError});var W1=K((Vnt,V1)=>{"use strict";V1.exports=ReferenceError});var $1=K((Wnt,z1)=>{"use strict";z1.exports=SyntaxError});var j1=K((znt,X1)=>{"use strict";X1.exports=URIError});var q1=K(($nt,Y1)=>{"use strict";Y1.exports=Math.abs});var Z1=K((Xnt,K1)=>{"use strict";K1.exports=Math.floor});var J1=K((jnt,Q1)=>{"use strict";Q1.exports=Math.max});var eC=K((Ynt,tC)=>{"use strict";tC.exports=Math.min});var iC=K((qnt,rC)=>{"use strict";rC.exports=Math.pow});var oC=K((Knt,sC)=>{"use strict";sC.exports=Math.round});var aC=K((Znt,nC)=>{"use strict";nC.exports=Number.isNaN||function(t){return t!==t}});var lC=K((Qnt,hC)=>{"use strict";var WF=aC();hC.exports=function(t){return WF(t)||t===0?t:t<0?-1:1}});var uC=K((Jnt,cC)=>{"use strict";cC.exports=Object.getOwnPropertyDescriptor});var og=K((tat,dC)=>{"use strict";var cu=uC();if(cu)try{cu([],"length")}catch{cu=null}dC.exports=cu});var pC=K((eat,fC)=>{"use strict";var uu=Object.defineProperty||!1;if(uu)try{uu({},"a",{value:1})}catch{uu=!1}fC.exports=uu});var gC=K((rat,mC)=>{"use strict";mC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var yC=K((iat,_C)=>{"use strict";var xC=typeof Symbol<"u"&&Symbol,zF=gC();_C.exports=function(){return typeof xC!="function"||typeof Symbol!="function"||typeof xC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:zF()}});var ng=K((sat,bC)=>{"use strict";bC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ag=K((oat,vC)=>{"use strict";var $F=sg();vC.exports=$F.getPrototypeOf||null});var EC=K((nat,SC)=>{"use strict";var XF="Function.prototype.bind called on incompatible ",jF=Object.prototype.toString,YF=Math.max,qF="[object Function]",TC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},KF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},ZF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};SC.exports=function(t){var e=this;if(typeof e!="function"||jF.apply(e)!==qF)throw new TypeError(XF+e);for(var r=KF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,TC(r,arguments));return Object(c)===c?c:this}return e.apply(t,TC(r,arguments))},n=YF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+ZF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ch=K((aat,AC)=>{"use strict";var QF=EC();AC.exports=Function.prototype.bind||QF});var du=K((hat,wC)=>{"use strict";wC.exports=Function.prototype.call});var hg=K((lat,CC)=>{"use strict";CC.exports=Function.prototype.apply});var RC=K((cat,PC)=>{"use strict";PC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var BC=K((uat,MC)=>{"use strict";var JF=ch(),tG=hg(),eG=du(),rG=RC();MC.exports=rG||JF.call(eG,tG)});var lg=K((dat,IC)=>{"use strict";var iG=ch(),sG=rs(),oG=du(),nG=BC();IC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new sG("a function is required");return nG(iG,oG,t)}});var LC=K((fat,OC)=>{"use strict";var aG=lg(),FC=og(),UC;try{UC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var cg=!!UC&&FC&&FC(Object.prototype,"__proto__"),kC=Object,GC=kC.getPrototypeOf;OC.exports=cg&&typeof cg.get=="function"?aG([cg.get]):typeof GC=="function"?function(t){return GC(t==null?t:kC(t))}:!1});var WC=K((pat,VC)=>{"use strict";var DC=ng(),NC=ag(),HC=LC();VC.exports=DC?function(t){return DC(t)}:NC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return NC(t)}:HC?function(t){return HC(t)}:null});var $C=K((mat,zC)=>{"use strict";var hG=Function.prototype.call,lG=Object.prototype.hasOwnProperty,cG=ch();zC.exports=cG.call(hG,lG)});var mu=K((gat,ZC)=>{"use strict";var lt,uG=sg(),dG=O1(),fG=D1(),pG=H1(),mG=W1(),ko=$1(),Uo=rs(),gG=j1(),xG=q1(),_G=Z1(),yG=J1(),bG=eC(),vG=iC(),TG=oC(),SG=lC(),qC=Function,ug=function(i){try{return qC('"use strict"; return ('+i+").constructor;")()}catch{}},uh=og(),EG=pC(),dg=function(){throw new Uo},AG=uh?function(){try{return arguments.callee,dg}catch{try{return uh(arguments,"callee").get}catch{return dg}}}():dg,Fo=yC()(),de=WC(),wG=ag(),CG=ng(),KC=hg(),dh=du(),Go={},PG=typeof Uint8Array>"u"||!de?lt:de(Uint8Array),ss={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?lt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?lt:ArrayBuffer,"%ArrayIteratorPrototype%":Fo&&de?de([][Symbol.iterator]()):lt,"%AsyncFromSyncIteratorPrototype%":lt,"%AsyncFunction%":Go,"%AsyncGenerator%":Go,"%AsyncGeneratorFunction%":Go,"%AsyncIteratorPrototype%":Go,"%Atomics%":typeof Atomics>"u"?lt:Atomics,"%BigInt%":typeof BigInt>"u"?lt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?lt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?lt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?lt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":dG,"%eval%":eval,"%EvalError%":fG,"%Float16Array%":typeof Float16Array>"u"?lt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?lt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?lt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?lt:FinalizationRegistry,"%Function%":qC,"%GeneratorFunction%":Go,"%Int8Array%":typeof Int8Array>"u"?lt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?lt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?lt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fo&&de?de(de([][Symbol.iterator]())):lt,"%JSON%":typeof JSON=="object"?JSON:lt,"%Map%":typeof Map>"u"?lt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fo||!de?lt:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":uG,"%Object.getOwnPropertyDescriptor%":uh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?lt:Promise,"%Proxy%":typeof Proxy>"u"?lt:Proxy,"%RangeError%":pG,"%ReferenceError%":mG,"%Reflect%":typeof Reflect>"u"?lt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?lt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fo||!de?lt:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?lt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fo&&de?de(""[Symbol.iterator]()):lt,"%Symbol%":Fo?Symbol:lt,"%SyntaxError%":ko,"%ThrowTypeError%":AG,"%TypedArray%":PG,"%TypeError%":Uo,"%Uint8Array%":typeof Uint8Array>"u"?lt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?lt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?lt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?lt:Uint32Array,"%URIError%":gG,"%WeakMap%":typeof WeakMap>"u"?lt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?lt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?lt:WeakSet,"%Function.prototype.call%":dh,"%Function.prototype.apply%":KC,"%Object.defineProperty%":EG,"%Object.getPrototypeOf%":wG,"%Math.abs%":xG,"%Math.floor%":_G,"%Math.max%":yG,"%Math.min%":bG,"%Math.pow%":vG,"%Math.round%":TG,"%Math.sign%":SG,"%Reflect.getPrototypeOf%":CG};if(de)try{null.error}catch(i){XC=de(de(i)),ss["%Error.prototype%"]=XC}var XC,RG=function i(t){var e;if(t==="%AsyncFunction%")e=ug("async function () {}");else if(t==="%GeneratorFunction%")e=ug("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ug("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&de&&(e=de(s.prototype))}return ss[t]=e,e},jC={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fh=ch(),fu=$C(),MG=fh.call(dh,Array.prototype.concat),BG=fh.call(KC,Array.prototype.splice),YC=fh.call(dh,String.prototype.replace),pu=fh.call(dh,String.prototype.slice),IG=fh.call(dh,RegExp.prototype.exec),FG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,GG=/\\(\\)?/g,UG=function(t){var e=pu(t,0,1),r=pu(t,-1);if(e==="%"&&r!=="%")throw new ko("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new ko("invalid intrinsic syntax, expected opening `%`");var s=[];return YC(t,FG,function(o,n,a,h){s[s.length]=a?YC(h,GG,"$1"):n||o}),s},kG=function(t,e){var r=t,s;if(fu(jC,r)&&(s=jC[r],r="%"+s[0]+"%"),fu(ss,r)){var o=ss[r];if(o===Go&&(o=RG(r)),typeof o>"u"&&!e)throw new Uo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new ko("intrinsic "+t+" does not exist!")};ZC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Uo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Uo('"allowMissing" argument must be a boolean');if(IG(/^%?[^%]*%?$/,t)===null)throw new ko("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=UG(t),s=r.length>0?r[0]:"",o=kG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],BG(r,MG([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=pu(d,0,1),p=pu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new ko("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",fu(ss,n))a=ss[n];else if(a!=null){if(!(d in a)){if(!e)throw new Uo("base intrinsic for "+t+" exists, but the property is not available.");return}if(uh&&c+1>=r.length){var m=uh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=fu(a,d),a=a[d];u&&!h&&(ss[n]=a)}}return a}});var fg=K((xat,tP)=>{"use strict";var QC=mu(),JC=lg(),OG=JC([QC("%String.prototype.indexOf%")]);tP.exports=function(t,e){var r=QC(t,!!e);return typeof r=="function"&&OG(t,".prototype.")>-1?JC([r]):r}});var pg=K((_at,rP)=>{"use strict";var LG=mu(),ph=fg(),DG=lh(),NG=rs(),eP=LG("%Map%",!0),HG=ph("Map.prototype.get",!0),VG=ph("Map.prototype.set",!0),WG=ph("Map.prototype.has",!0),zG=ph("Map.prototype.delete",!0),$G=ph("Map.prototype.size",!0);rP.exports=!!eP&&function(){var t,e={assert:function(r){if(!e.has(r))throw new NG("Side channel does not contain "+DG(r))},delete:function(r){if(t){var s=zG(t,r);return $G(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return HG(t,r)},has:function(r){return t?WG(t,r):!1},set:function(r,s){t||(t=new eP),VG(t,r,s)}};return e}});var sP=K((yat,iP)=>{"use strict";var XG=mu(),xu=fg(),jG=lh(),gu=pg(),YG=rs(),Oo=XG("%WeakMap%",!0),qG=xu("WeakMap.prototype.get",!0),KG=xu("WeakMap.prototype.set",!0),ZG=xu("WeakMap.prototype.has",!0),QG=xu("WeakMap.prototype.delete",!0);iP.exports=Oo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new YG("Side channel does not contain "+jG(s))},delete:function(s){if(Oo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return QG(t,s)}else if(gu&&e)return e.delete(s);return!1},get:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?qG(t,s):e&&e.get(s)},has:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?ZG(t,s):!!e&&e.has(s)},set:function(s,o){Oo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Oo),KG(t,s,o)):gu&&(e||(e=gu()),e.set(s,o))}};return r}:gu});var nP=K((bat,oP)=>{"use strict";var JG=rs(),t2=lh(),e2=G1(),r2=pg(),i2=sP(),s2=i2||r2||e2;oP.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new JG("Side channel does not contain "+t2(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=s2()),t.set(r,s)}};return e}});var _u=K((vat,aP)=>{"use strict";var o2=String.prototype.replace,n2=/%20/g,mg={RFC1738:"RFC1738",RFC3986:"RFC3986"};aP.exports={default:mg.RFC3986,formatters:{RFC1738:function(i){return o2.call(i,n2,"+")},RFC3986:function(i){return String(i)}},RFC1738:mg.RFC1738,RFC3986:mg.RFC3986}});var _g=K((Tat,lP)=>{"use strict";var a2=_u(),gg=Object.prototype.hasOwnProperty,os=Array.isArray,kr=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),h2=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(os(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},hP=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},l2=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(os(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!gg.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return os(t)&&!os(e)&&(s=hP(t,r)),os(t)&&os(e)?(e.forEach(function(o,n){if(gg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return gg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},c2=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},u2=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},xg=1024,d2=function(t,e,r,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",h=0;h<n.length;h+=xg){for(var l=n.length>=xg?n.slice(h,h+xg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===a2.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=kr[d];continue}if(d<2048){c[c.length]=kr[192|d>>6]+kr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=kr[224|d>>12]+kr[128|d>>6&63]+kr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=kr[240|d>>18]+kr[128|d>>12&63]+kr[128|d>>6&63]+kr[128|d&63]}a+=c.join("")}return a},f2=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return h2(e),t},p2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},m2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},g2=function(t,e){return[].concat(t,e)},x2=function(t,e){if(os(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};lP.exports={arrayToObject:hP,assign:c2,combine:g2,compact:f2,decode:u2,encode:d2,isBuffer:m2,isRegExp:p2,maybeMap:x2,merge:l2}});var mP=K((Sat,pP)=>{"use strict";var uP=nP(),yu=_g(),mh=_u(),_2=Object.prototype.hasOwnProperty,dP={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Or=Array.isArray,y2=Array.prototype.push,fP=function(i,t){y2.apply(i,Or(t)?t:[t])},b2=Date.prototype.toISOString,cP=mh.default,oe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:yu.encode,encodeValuesOnly:!1,filter:void 0,format:cP,formatter:mh.formatters[cP],indices:!1,serializeDate:function(t){return b2.call(t)},skipNulls:!1,strictNullHandling:!1},v2=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},yg={},T2=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m,g,b,_){for(var v=t,T=_,A=0,S=!1;(T=T.get(yg))!==void 0&&!S;){var w=T.get(t);if(A+=1,typeof w<"u"){if(w===A)throw new RangeError("Cyclic object value");S=!0}typeof T.get(yg)>"u"&&(A=0)}if(typeof c=="function"?v=c(e,v):v instanceof Date?v=f(v):r==="comma"&&Or(v)&&(v=yu.maybeMap(v,function(tt){return tt instanceof Date?f(tt):tt})),v===null){if(n)return l&&!g?l(e,oe.encoder,b,"key",p):e;v=""}if(v2(v)||yu.isBuffer(v)){if(l){var M=g?e:l(e,oe.encoder,b,"key",p);return[m(M)+"="+m(l(v,oe.encoder,b,"value",p))]}return[m(e)+"="+m(String(v))]}var P=[];if(typeof v>"u")return P;var R;if(r==="comma"&&Or(v))g&&l&&(v=yu.maybeMap(v,l)),R=[{value:v.length>0?v.join(",")||null:void 0}];else if(Or(c))R=c;else{var B=Object.keys(v);R=u?B.sort(u):B}var F=h?String(e).replace(/\./g,"%2E"):String(e),W=s&&Or(v)&&v.length===1?F+"[]":F;if(o&&Or(v)&&v.length===0)return W+"[]";for(var D=0;D<R.length;++D){var it=R[D],L=typeof it=="object"&&it&&typeof it.value<"u"?it.value:v[it];if(!(a&&L===null)){var X=d&&h?String(it).replace(/\./g,"%2E"):String(it),H=Or(v)?typeof r=="function"?r(W,X):W:W+(d?"."+X:"["+X+"]");_.set(t,A);var k=uP();k.set(yg,_),fP(P,i(L,H,r,s,o,n,a,h,r==="comma"&&g&&Or(v)?null:l,c,u,d,f,p,m,g,b,k))}}return P},S2=function(t){if(!t)return oe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||oe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=mh.default;if(typeof t.format<"u"){if(!_2.call(mh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=mh.formatters[r],o=oe.filter;(typeof t.filter=="function"||Or(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in dP?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=oe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:oe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:oe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:oe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?oe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:oe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:oe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:oe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:oe.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:oe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:oe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}};pP.exports=function(i,t){var e=i,r=S2(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Or(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=dP[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=uP(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||fP(n,T2(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var yP=K((Eat,_P)=>{"use strict";var ns=_g(),bg=Object.prototype.hasOwnProperty,gP=Array.isArray,zt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ns.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},E2=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},xP=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},A2="utf8=%26%2310003%3B",w2="utf8=%E2%9C%93",C2=function(t,e){var r={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===w2?l="utf-8":n[h]===A2&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,zt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),zt.decoder,l,"key"),p=ns.maybeMap(xP(c.slice(d+1),e,gP(r[f])?r[f].length:0),function(g){return e.decoder(g,zt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=E2(String(p))),c.indexOf("[]=")>-1&&(p=gP(p)?[p]:p);var m=bg.call(r,f);m&&e.duplicates==="combine"?r[f]=ns.combine(r[f],p):(!m||e.duplicates==="last")&&(r[f]=p)}return r},P2=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:xP(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:ns.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},R2=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&bg.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&bg.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return P2(c,e,r,s)}},M2=function(t){if(!t)return zt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?zt.charset:t.charset,r=typeof t.duplicates>"u"?zt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:zt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:zt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:zt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:zt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:zt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:zt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:zt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:zt.decoder,delimiter:typeof t.delimiter=="string"||ns.isRegExp(t.delimiter)?t.delimiter:zt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:zt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:zt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:zt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:zt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};_P.exports=function(i,t){var e=M2(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?C2(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=R2(a,r[a],e,typeof i=="string");s=ns.merge(s,h,e)}return e.allowSparse===!0?s:ns.compact(s)}});var vP=K((Aat,bP)=>{"use strict";var B2=mP(),I2=yP(),F2=_u();bP.exports={formats:F2,parse:I2,stringify:B2}});var AP=K(Do=>{"use strict";var G2=c1();function hr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var U2=/^([a-z0-9.+-]+:)/i,k2=/:[0-9]*$/,O2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,L2=["<",">",'"',"`"," ","\r",`
|
|
1093
|
+
`," "],D2=["{","}","|","\\","^","`"].concat(L2),vg=["'"].concat(D2),TP=["%","/","?",";","#"].concat(vg),SP=["/","?","#"],N2=255,EP=/^[+a-z0-9A-Z_-]{0,63}$/,H2=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,V2={javascript:!0,"javascript:":!0},Tg={javascript:!0,"javascript:":!0},Lo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sg=vP();function gh(i,t,e){if(i&&typeof i=="object"&&i instanceof hr)return i;var r=new hr;return r.parse(i,t,e),r}hr.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=O2.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=U2.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&Tg[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tg[l]&&(u||l&&!Lo[l])){for(var d=-1,f=0;f<SP.length;f++){var p=a.indexOf(SP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<TP.length;f++){var p=a.indexOf(TP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var b=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!b)for(var _=this.hostname.split(/\./),f=0,v=_.length;f<v;f++){var T=_[f];if(T&&!T.match(EP)){for(var A="",S=0,w=T.length;S<w;S++)T.charCodeAt(S)>127?A+="x":A+=T[S];if(!A.match(EP)){var M=_.slice(0,f),P=_.slice(f+1),R=T.match(H2);R&&(M.push(R[1]),P.unshift(R[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>N2?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=G2.toASCII(this.hostname));var B=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+B,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!V2[c])for(var f=0,v=vg.length;f<v;f++){var W=vg[f];if(a.indexOf(W)!==-1){var D=encodeURIComponent(W);D===W&&(D=escape(W)),a=a.split(W).join(D)}}var it=a.indexOf("#");it!==-1&&(this.hash=a.substr(it),a=a.slice(0,it));var L=a.indexOf("?");if(L!==-1?(this.search=a.substr(L),this.query=a.substr(L+1),t&&(this.query=Sg.parse(this.query)),a=a.slice(0,L)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Lo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var B=this.pathname||"",X=this.search||"";this.path=B+X}return this.href=this.format(),this};function W2(i){return typeof i=="string"&&(i=gh(i)),i instanceof hr?i.format():hr.prototype.format.call(i)}hr.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Sg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Lo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function z2(i,t){return gh(i,!1,!0).resolve(t)}hr.prototype.resolve=function(i){return this.resolveObject(gh(i,!1,!0)).format()};function $2(i,t){return i?gh(i,!1,!0).resolveObject(t):t}hr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new hr;t.parse(i,!1,!0),i=t}for(var e=new hr,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Lo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Lo[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!Tg[i.protocol]){for(var v=(i.pathname||"").split("/");v.length&&!(i.host=v.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),v[0]!==""&&v.unshift(""),v.length<2&&v.unshift(""),e.pathname=v.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",g=m||p||e.host&&i.pathname,b=g,_=e.pathname&&e.pathname.split("/")||[],v=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Lo[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(v[0]===""?v[0]=i.host:v.unshift(i.host)),i.host=null),g=g&&(v[0]===""||_[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,_=v;else if(v.length)_||(_=[]),_.pop(),_=_.concat(v),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=_.shift(),e.hostname=e.host;var A=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;A&&(e.auth=A.shift(),e.hostname=A.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=_.slice(-1)[0],w=(e.host||i.host||_.length>1)&&(S==="."||S==="..")||S==="",M=0,P=_.length;P>=0;P--)S=_[P],S==="."?_.splice(P,1):S===".."?(_.splice(P,1),M++):M&&(_.splice(P,1),M--);if(!g&&!b)for(;M--;M)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),w&&_.join("/").substr(-1)!=="/"&&_.push("");var R=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(T){e.hostname=R?"":_.length?_.shift():"",e.host=e.hostname;var A=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;A&&(e.auth=A.shift(),e.hostname=A.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!R&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};hr.prototype.parseHost=function(){var i=this.host,t=k2.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};Do.parse=gh;Do.resolve=z2;Do.resolveObject=$2;Do.format=W2;Do.Url=hr});var TR=()=>{let i=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))i.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};i.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of i.entries())n[a]=h;return n},clear:()=>i.clear(),size:()=>i.size,has:n=>i.has(n)}};C();var OT={extension:{type:y.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(kT(),MB))}};C();var DT={extension:{type:y.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(LT(),BB))}};C();C();Cl();bl();C();Rt();sa();var vc;function jT(i){return vc!==void 0||(vc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ei.defaultOptions.failIfMajorPerformanceCaveat};try{if(!$.get().getWebGLRenderingContext())return!1;let r=$.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),vc}Rt();var Tc;async function YT(i={}){return Tc!==void 0||(Tc=await(async()=>{let t=$.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Tc}sa();var aw=["webgl","webgpu","canvas"];async function hw(i){let t=[];i.preference?(t.push(i.preference),aw.forEach(o=>{o!==i.preference&&t.push(o)})):t=aw.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await YT()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(GE(),FE));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&jT(i.failIfMajorPerformanceCaveat??Ei.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(nw(),ow));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}dr();zp();Dt();var lw=class Im{constructor(...t){this.stage=new St,t[0]!==void 0&&z(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await hw(t),Im._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return z(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Im._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};lw._plugins=[];var Ja=lw;G.handleByList(y.Application,Ja._plugins);G.add(pa);C();Yr();zd();Rt();C();Wi();he();vt();bp();Ap();var th=class extends so{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new st(n.x+a.x,n.y+a.y,n.width,n.height),c=new E({source:h,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Kn.install(t)}static uninstall(t){Kn.uninstall(t)}};var Yc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let g=f[m].split("="),b=g[0],_=g[1].replace(/"/gm,""),v=parseFloat(_),T=isNaN(v)?_:v;p[b]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};Rt();var Fm={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Gm={test(i){return typeof i=="string"&&i.includes("<font>")?Fm.test($.get().parseXML(i)):!1},parse(i){return Fm.parse($.get().parseXML(i))}};var uI=[".xml",".fnt"],cw={extension:{type:y.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof th,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},uw={extension:{type:y.LoadParser,priority:le.Normal},name:"loadBitmapFont",test(i){return uI.includes(ie.extname(i).toLowerCase())},async testParse(i){return Yc.test(i)||Gm.test(i)},async parse(i,t,e){let r=Yc.test(i)?Yc.parse(i):Gm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ie.join(ie.dirname(s),d);f=En(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new th({data:r,textures:l},s)},async load(i,t){return await(await $.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};At();var qc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};gi();C();vt();var dw={extension:{type:y.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof E),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};C();async function Kc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var fw={extension:{type:y.DetectionParser,priority:1},test:async()=>Kc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};C();var pw=["png","jpg","jpeg"],mw={extension:{type:y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...pw],remove:async i=>i.filter(t=>!pw.includes(t))};C();var dI="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function yo(i){return dI?!1:document.createElement("video").canPlayType(i)!==""}var gw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};C();var xw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};C();var _w={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};C();var yw={extension:{type:y.DetectionParser,priority:0},test:async()=>Kc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};At();Wi();Sn();yl();var Zc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=zi(t),n=Ee(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ie.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
1094
|
+
${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t,s=>({alias:[s],src:s})).map(async s=>{let o=ie.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&O(`[Assets] loadParser name conflict "${e.name}"`):O("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Rt();C();function ir(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}Wi();function sr(i,t){let e=i.split("?")[0],r=ie.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}Yr();var fI=".json",pI="application/json",bw={extension:{type:y.LoadParser,priority:le.Low},name:"loadJson",test(i){return ir(i,pI)||sr(i,fI)},async load(i){return await(await $.get().fetch(i)).json()}};Rt();C();Yr();var mI=".txt",gI="text/plain",vw={name:"loadTxt",extension:{type:y.LoadParser,priority:le.Low,name:"loadTxt"},test(i){return ir(i,gI)||sr(i,mI)},async load(i){return await(await $.get().fetch(i)).text()}};Rt();C();At();Wi();gi();Yr();var xI=["normal","bold","100","200","300","400","500","600","700","800","900"],_I=[".ttf",".otf",".woff",".woff2"],yI=["font/ttf","font/otf","font/woff","font/woff2"],bI=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function vI(i){let t=ie.extname(i),s=ie.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(bI)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var TI=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function SI(i){return TI.test(i)?i:encodeURI(i)}var Tw={extension:{type:y.LoadParser,priority:le.Low},name:"loadWebFont",test(i){return ir(i,yI)||sr(i,_I)},async load(i,t){let e=$.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??vI(i),o=t.data?.weights?.filter(a=>xI.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let h=o[a],l=new FontFace(s,`url(${SI(i)})`,{...n,weight:h});await l.load(),e.add(l),r.push(l)}return xt.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return O("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{xt.remove(`${t.family}-and-url`),$.get().getFontFaceSet().delete(t)})}};Rt();C();Gs();nc();Is();function bo(i,t=1){let e=We.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}Yr();vt();At();gi();function vo(i,t,e){i.label=e,i._sourceOrigin=e;let r=new E({source:i,label:e}),s=()=>{delete t.promiseCache[e],xt.has(e)&&xt.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(O("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(O("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var EI=".svg",AI="image/svg+xml",Sw={extension:{type:y.LoadParser,priority:le.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ir(i,AI)||sr(i,EI)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?CI(i):wI(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function wI(i,t,e,r){let o=await(await $.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let h=document.createElement("canvas"),l=h.getContext("2d"),c=t.data?.resolution||bo(i),u=t.data?.width??a.width,d=t.data?.height??a.height;h.width=u*c,h.height=d*c,l.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new Ge({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return vo(m,e,i)}async function CI(i){let e=await(await $.get().fetch(i)).text(),r=new we;return r.svg(e),r}Rt();C();Gs();var PI=`(function () {
|
|
1095
1095
|
'use strict';
|
|
1096
1096
|
|
|
1097
1097
|
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
@@ -1141,14 +1141,14 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t
|
|
|
1141
1141
|
};
|
|
1142
1142
|
|
|
1143
1143
|
})();
|
|
1144
|
-
`,Eo=null,eh=class{constructor(){Eo||(Eo=URL.createObjectURL(new Blob([RI],{type:"application/javascript"}))),this.worker=new Worker(Eo)}};eh.revokeObjectURL=function(){Eo&&(URL.revokeObjectURL(Eo),Eo=null)};var Ew=0,Um,km=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new So;e.addEventListener("message",r=>{e.terminate(),So.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Um===void 0&&(Um=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Um&&(this._createdWorkers++,t=new eh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[Ew]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Ew++,id:r})}},Om=new km;Yr();var MI=[".jpeg",".jpg",".png",".webp",".avif"],BI=["image/jpeg","image/png","image/webp","image/avif"];async function II(i,t){let e=await z.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Qc={name:"loadTextures",extension:{type:y.LoadParser,priority:le.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ir(i,BI)||sr(i,MI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Om.isImageBitmapSupported()?r=await Om.loadImageBitmap(i,t):r=await II(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Ge({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||bo(i),...t.data});return vo(s,e,i)},unload(i){i.destroy(!0)}};C();Zd();Kd();var Aw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],FI=Aw.map(i=>`video/${i.substring(1)}`);function GI(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=kI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function UI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function kI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var ww={name:"loadVideo",extension:{type:y.LoadParser,name:"loadVideo"},test(i){let t=ir(i,FI),e=sr(i,Aw);return t||e},async load(i,t,e){let r={...Us.defaultOptions,resolution:t.data?.resolution||bo(i),alphaMode:t.data?.alphaMode||await Al(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),GI(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Us.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Us({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await UI(s),h(vo(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};C();Is();C();Is();var Jc={extension:{type:y.ResolveParser,name:"resolveTexture"},test:Qc.test,parse:i=>({resolution:parseFloat(We.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Cw={extension:{type:y.ResolveParser,priority:-2,name:"resolveJson"},test:i=>We.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Jc.parse};Is();Sn();yl();var tu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new We,this.loader=new Zc,this.cache=xt,this._backgroundLoader=new qc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=zi(t),s=Ee(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return xt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=xt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),xt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ee(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ee(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{xt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},or=new tu;F.handleByList(y.LoadParser,or.loader.parsers).handleByList(y.ResolveParser,or.resolver.parsers).handleByList(y.CacheParser,or.cache.parsers).handleByList(y.DetectionParser,or.detections);F.add(dw,mw,fw,yw,gw,xw,_w,bw,vw,Tw,Sw,Qc,ww,uw,cw,Jc,Cw);var Pw={loader:y.LoadParser,resolver:y.ResolveParser,cache:y.CacheParser,detection:y.DetectionParser};F.handle(y.Asset,i=>{let t=i.ref;Object.entries(Pw).filter(([e])=>!!t[e]).forEach(([e,r])=>F.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Pw).filter(e=>!!t[e]).forEach(e=>F.remove(t[e]))});Jh();Dt();_l();var eu=class extends mi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new pe({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Rw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(W(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Yn();Ji();var _r=class extends eu{constructor(...t){let e=Rw(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=Xt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Yr();vt();tf();dr();xp();Tl();Yn();Ji();_e();var OI=Gi(Vl(),1);F.add(OT,DT);var LI=new(window.AudioContext||window.webkitAudioContext),Lm={},DI=async(i,t)=>{if(!Lm[i]&&t.byteLength!==0)try{let e=await LI.decodeAudioData(t);Lm[i]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${i}:`,e)}},NI=i=>Lm[i],Ao={load:DI,getAsset:NI};var ze=({type:i,add:t,update:e,delete:r,parse:s})=>({type:i,add:t,update:e,delete:r,parse:s});var Dm=({type:i,animate:t})=>({type:i,animate:t});var Nm=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Mw={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},Hm={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var ru={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider"};var wo={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0};var Le=(i,t,e={})=>{let r={...wo,...e,...t};i.style=r};async function _t(i,t,{app:e,element:r,animations:s,signal:o}){let n=[];for(let a of s)if(a.targetId===i){let h=t.find(l=>l.type===a.type);if(!h)throw new Error(`No animation plugin found for type: ${a.type}`);n.push(h.animate({app:e,element:r,animation:a,signal:o}))}return Promise.all(n)}var Bw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new _r({label:e.id}),l=()=>{h.text=e.content,Le(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click;if(u){let{cursor:f,soundSrc:p,actionPayload:m}=u;h.eventMode="static";let g=()=>{m&&s&&s("hover",{_event:{id:h.label},...m}),f&&(h.cursor=f),p&&i.audioStage.add({id:`hover-${Date.now()}`,url:p,loop:!1}),u?.textStyle&&Le(h,u.textStyle,e.textStyle)},b=()=>{h.cursor="auto",Le(h,e.textStyle)};h.on("pointerover",g),h.on("pointerout",b)}if(d){let{soundSrc:f,actionPayload:p}=d;h.eventMode="static";let m=()=>{d?.textStyle&&Le(h,d.textStyle,e.textStyle)},g=()=>{Le(h,e.textStyle),p&&s&&s("click",{_event:{id:h.label},...p}),f&&i.audioStage.add({id:`click-${Date.now()}`,url:f,loop:!1})},b=()=>{Le(h,e.textStyle)};h.on("pointerdown",m),h.on("pointerup",g),h.on("pointerupoutside",b)}t.addChild(h),r&&r.length>0&&(a=!1,await _t(e.id,o,{app:i,element:h,animations:r,signal:n}),a=!0),n.removeEventListener("abort",c)};var Iw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.text=r.content,Le(h,r.textStyle),h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{g&&s&&s("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.textStyle&&Le(h,d.textStyle,r.textStyle)},_=()=>{h.cursor="auto",Le(h,r.textStyle)};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{f?.textStyle&&Le(h,f.textStyle,r.textStyle)},b=()=>{Le(h,r.textStyle),m&&s&&s("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{Le(h,r.textStyle)};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await _t(r.id,n,{app:i,element:h,animations:o,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Fw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Gw=({positionX:i=0,positionY:t=0,width:e,height:r,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof r!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:r*o},a=i-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var nr=i=>{if(typeof i.width!="number"||typeof i.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(ru).includes(i.type))throw new Error("Input Error: Type must be one of "+Object.values(ru).join(", "));if(!i.id)throw new Error("Input Error: Id is missing");let t=i.scaleX?i.scaleX*i.width:i.width,e=i.scaleY?i.scaleY*i.height:i.height;i.type===ru.CONTAINER&&(t=i.width,e=i.height);let{x:r,y:s,originX:o,originY:n}=Gw({positionX:i.x,positionY:i.y,width:t,height:e,anchorX:i.anchorX,anchorY:i.anchorY}),a={id:i.id,type:i.type,width:Math.round(t),height:Math.round(e),x:Math.round(r),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:i.alpha??1};return i.hover&&(a.hover=i.hover),i.click&&(a.click=i.click),a};var Uw=({state:i})=>{let t={...wo,...i.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),i.width&&(t.wordWrapWidth=i.width,t.wordWrap=!0);let{width:e,height:r}=Xt.measureText(i.content??"",new Mt(t)),s=Math.round(e),o=Math.round(r);return{...nr({...i,width:s,height:o}),content:i.content??"",textStyle:{...t}}};var HI=ze({type:"text",add:Bw,update:Iw,delete:Fw,parse:Uw});var kw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,originX:p,originY:m,rotation:g,alpha:b}=e,_=new xr;_.label=a;let v=!0,T=()=>{_.clear(),_.rect(0,0,Math.round(c),Math.round(u)).fill(d),_.x=Math.round(h),_.y=Math.round(l),_.alpha=b,f&&_.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},w=async()=>{v||T()};n.addEventListener("abort",w),T();let S=e?.hover,A=e?.click;if(S){let{cursor:M,soundSrc:P,actionPayload:R}=S;_.eventMode="static";let I=()=>{R&&o&&o("hover",{_event:{id:_.label},...R}),M&&(_.cursor=M),P&&i.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},k=()=>{_.cursor="auto"};_.on("pointerover",I),_.on("pointerout",k)}if(A){let{soundSrc:M,actionPayload:P}=A;_.eventMode="static";let R=()=>{P&&o&&o("click",{_event:{id:_.label},...P}),M&&i.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})};_.on("pointerup",R)}t.addChild(_),r&&r.length>0&&(v=!1,await _t(a,s,{app:i,element:_,animations:r,signal:n})),v=!0,n.removeEventListener("abort",w)};var Ow=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.clear(),h.rect(0,0,Math.round(r.width),Math.round(r.height)).fill(r.fill),h.x=Math.round(r.x),h.y=Math.round(r.y),h.alpha=r.alpha,r.border&&h.stroke({color:r.border.color,alpha:r.border.alpha,width:Math.round(r.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{g&&n&&n("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1})},_=()=>{h.cursor="auto"};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{m&&n&&n("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})};h.on("pointerup",g)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Lw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Dw=({state:i})=>{let t=nr(i),e=t;return i.border&&(e={...t,border:{alpha:i.border?.alpha??1,color:i.border?.color??"black",width:i.border?.width??0}}),{...e,cursor:i.cursor??"",fill:i.fill??"white",pointerDown:i.pointerDown??"",pointerMove:i.pointerMove??"",pointerUp:i.pointerUp??"",rotation:i.rotation??0}};var VI=ze({type:"rect",add:kw,update:Ow,delete:Lw,parse:Dw});var Nw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?E.from(f):E.EMPTY,g=new se(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},_=async()=>{a||b()};n.addEventListener("abort",_),b();let v=e?.hover,T=e?.click;if(v){let{cursor:w,soundSrc:S,actionPayload:A}=v;g.eventMode="static";let M=()=>{if(A&&s&&s("hover",{_event:{id:g.label},...A}),w&&(g.cursor=w),S&&i.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1}),v?.src){let R=v.src?E.from(v.src):E.EMPTY;g.texture=R}},P=()=>{g.cursor="auto",g.texture=m};g.on("pointerover",M),g.on("pointerout",P)}if(T){let{soundSrc:w,actionPayload:S}=T;g.eventMode="static";let A=()=>{if(T?.src){let R=T.src?E.from(T.src):E.EMPTY;g.texture=R}},M=()=>{g.texture=m,S&&s&&s("click",{_event:{id:g.label},...S}),w&&i.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1})},P=()=>{g.texture=m};g.on("pointerdown",A),g.on("pointerup",M),g.on("pointerupoutside",P)}t.addChild(g),r&&r.length>0&&(a=!1,await _t(h,o,{app:i,element:g,animations:r,signal:n}),a=!0),n.removeEventListener("abort",_)};var Hw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){if(e.src!==r.src){let p=r.src?E.from(r.src):E.EMPTY;h.texture=p}h.x=Math.round(r.x),h.y=Math.round(r.y),h.width=Math.round(r.width),h.height=Math.round(r.height),h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{if(g&&n&&n("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.src){let v=d.src?E.from(d.src):E.EMPTY;h.texture=v}},_=()=>{h.cursor="auto",h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{if(f?.src){let v=f.src?E.from(f.src):E.EMPTY;h.texture=v}},b=()=>{h.texture=r.src?E.from(r.src):E.EMPTY,m&&n&&n("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Vw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.children.find(a=>a.label===e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Ww=({state:i})=>({...nr(i),src:i.src??i.url??"",alpha:i.alpha??1,cursor:i.cursor??""});var WI=ze({type:"sprite",add:Nw,update:Hw,delete:Vw,parse:Ww});var zw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:_,step:v,initialValue:T,originX:w,originY:S,hover:A,change:M}=e,P=new St;P.label=h,P.x=l,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let R=0,I=m?E.from(m):E.EMPTY,k=new se(I);k.label=`${h}-bar`,k.eventMode="static";let j=p?E.from(p):E.EMPTY,N=new se(j);N.label=`${h}-thumb`,N.eventMode="static";let ot=T??b,L=_-b,$=Tt=>{let ct=(Tt-b)/L;g==="horizontal"?(N.x=ct*(k.width-N.width),N.y=(k.height-N.height)/2):(N.x=(k.width-N.width)/2,N.y=ct*(k.height-N.height))},H=()=>{k.width=u,k.height=d;let Tt=g==="horizontal"?d-R*2:u-R*2,ct=p?E.from(p):E.EMPTY,gt=ct.width,Ft=ct.height,qt=Tt/gt,Kt=Tt/Ft,Me=Math.min(qt,Kt);N.width=gt*Me,N.height=Ft*Me,$(ot)},U=async()=>{a||H()};n.addEventListener("abort",U),H();let tt=j,yt=I,mt=!1,Ot=Tt=>{let ct;if(g==="horizontal"){let Ft=Tt.x-N.width/2;ct=Math.max(0,Math.min(1,Ft/(k.width-N.width)))}else{let Ft=Tt.y-N.height/2;ct=Math.max(0,Math.min(1,Ft/(k.height-N.height)))}let gt=b+ct*L;return v>0&&(gt=Math.round((gt-b)/v)*v+b,gt=Math.max(b,Math.min(_,gt))),gt},Lt=Tt=>{let ct=P.toLocal(Tt.global),gt=Ot(ct);gt!==ot&&(ot=gt,$(ot),M?.actionPayload&&o&&o("change",{_event:{id:h,value:ot},...M.actionPayload}))},Yt=Tt=>{mt=!0,Lt(Tt)},re=Tt=>{mt&&Lt(Tt)},ge=()=>{mt&&(mt=!1)};if(P.on("pointerdown",Yt),P.on("globalpointermove",re),P.on("pointerup",ge),P.on("pointerupoutside",ge),A){let{cursor:Tt,soundSrc:ct,thumbSrc:gt,barSrc:Ft}=A,qt=()=>{Tt&&(k.cursor=Tt,N.cursor=Tt),ct&&i.audioStage.add({id:`hover-${Date.now()}`,url:ct,loop:!1}),gt&&(N.texture=E.from(gt)),Ft&&(k.texture=E.from(Ft))},Kt=()=>{mt||(k.cursor="auto",N.cursor="auto",N.texture=tt,k.texture=yt)};P.on("pointerover",qt),P.on("pointerout",Kt),P.on("pointerupoutside",Kt)}P.addChild(k),P.addChild(N),t.addChild(P),r&&r.length>0&&(a=!1,await _t(h,s,{app:i,element:P,animations:r,signal:n}),a=!0),n.removeEventListener("abort",U)};var $w=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.label=r.id,h.pivot.set(r.originX,r.originY);let c=h.getChildByLabel(`${r.id}-bar`),u=h.getChildByLabel(`${r.id}-thumb`);if(c&&u){c.width=r.width,c.height=r.height;let d=0,f=r.direction==="horizontal"?r.height-d*2:r.width-d*2,p=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY,m=p.width||16,g=p.height||16,b=f/m,_=f/g,v=Math.min(b,_);if(u.width=m*v,u.height=g*v,e.barSrc!==r.barSrc){let S=r.barSrc?E.from(r.barSrc):E.EMPTY;c.texture=S}if(e.thumbSrc!==r.thumbSrc){let S=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY;u.texture=S}let T=r.max-r.min,w=(r.initialValue-r.min)/T;r.direction==="horizontal"?(u.x=w*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=w*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,change:f,min:p,max:m,step:g,direction:b,initialValue:_}=r,v=_??p,T=m-p;h.eventMode="static";let w=N=>{let ot=(N-p)/T;b==="horizontal"?(u.x=ot*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=ot*(c.height-u.height))},S=N=>{let ot;if(b==="horizontal"){let $=N.x-u.width/2;ot=Math.max(0,Math.min(1,$/(c.width-u.width)))}else{let $=N.y-u.height/2;ot=Math.max(0,Math.min(1,$/(c.height-u.height)))}let L=p+ot*T;return g>0&&(L=Math.round((L-p)/g)*g+p,L=Math.max(p,Math.min(m,L))),L},A=u.texture,M=c.texture,P=!1,R=N=>{let ot=h.toLocal(N.global),L=S(ot);L!==v&&(v=L,w(v),f?.actionPayload&&s&&s("change",{_event:{id,value:v},...f.actionPayload}))},I=N=>{P=!0,R(N)},k=N=>{P&&R(N)},j=()=>{P&&(P=!1)};if(h.on("pointerdown",I),h.on("globalpointermove",k),h.on("pointerup",j),h.on("pointerupoutside",j),d){let{cursor:N,soundSrc:ot,thumbSrc:L,barSrc:$}=d,H=()=>{N&&(h.cursor=N,u.cursor=N),ot&&i.audioStage.add({id:`hover-${Date.now()}`,url:ot,loop:!1}),L&&(u.texture=E.from(L)),$&&(c.texture=E.from($))},U=()=>{P||(h.cursor="auto",u.cursor="auto",u.texture=A,c.texture=M)};h.on("pointerover",H),h.on("pointerout",U),h.on("pointerupoutside",U)}}}};h&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Xw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy({children:!0})},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var jw=({state:i})=>{let t=nr(i),e=i.min??0,r=i.max??100;if(r<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:i.direction??"horizontal",thumbSrc:i.thumbSrc??"",barSrc:i.barSrc??"",alpha:i.alpha??1,min:e,max:r,step:i.step??1,initialValue:i.initialValue??0,...i.hover&&{hover:i.hover},...i.change&&{change:i.change}}};var zI=ze({type:"slider",add:zw,update:$w,delete:Xw,parse:jw});var Yw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new St;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let _ of u){let v=n.find(T=>T.type===_.type);if(!v)throw new Error(`No plugin found for child element type: ${_.type}`);await v.add({app:i,parent:p,element:_,animations:r,eventHandler:s,animationPlugins:o,animateElements:_t,elementPlugins:n,signal:a})}d&&$I({container:p,element:e}),r&&r.length>0&&(m=!1,await _t(h,o,{app:i,element:p,animations:r,signal:a})),m=!0,a.removeEventListener("abort",b)},$I=({container:i,element:t})=>{let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new St;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new xr().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}};var qw=(i,t,e=[])=>{let r=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of i)r.add(l.id),s.set(l.id,l);for(let l of t)r.add(l.id),o.set(l.id,l);for(let l of r){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var rh=async({app:i,parent:t,prevASTTree:e,nextASTTree:r,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=qw(e,r,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:i,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:i,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:i,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),XI(t,r)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},XI=(i,t)=>{i.children.sort((e,r)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===r.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1})};var Kw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(r)&&(l.x=Math.round(r.x),l.y=Math.round(r.y),l.label=r.id,l.alpha=r.alpha,JSON.stringify(e.children)!==JSON.stringify(r.children)&&await rh({app:i,parent:l,nextASTTree:r.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await _t(e.id,n,{app:i,element:l,animations:o,signal:h})),c=!0,await u(),h.removeEventListener("abort",d))};var Zw=async({app:i,parent:t,element:e,animationPlugins:r,animations:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&(t.removeChild(n),n.destroy({children:!0,texture:!0,baseTexture:!0}))},l=async()=>{a||h()};o.addEventListener("abort",l),s&&s.length>0&&(a=!1,await _t(e.id,r,{app:i,element:n,animations:s,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Qw=({state:i,parserPlugins:t=[]})=>{let e=i.direction,r=!!i.scroll,s=i.gap||0,o=structuredClone(i.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let _=0;_<o.length;_++){let v=_<o.length-1?s:0,T=o[_];_>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let w=t.find(S=>S.type===T.type);w&&(T=w.parse({state:T,parserPlugins:t})),e==="horizontal"?(i.width&&T.width+m>i.width&&!r?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+v,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"&&(i.height&&T.height+g>i.height&&!r?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+v,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)),n.push(T)}return{...nr({...i,width:i.width?i.width:a,height:i.height?i.height:h}),children:n,direction:e,gap:s,scroll:r,rotation:i.rotation??0}};var jI=ze({type:"container",add:Yw,update:Kw,delete:Zw,parse:Qw});function Co(i,t){let e=i.text.substring(0,t),s=Xt.measureText(e,i.style).width;return i.x+s}var YI=async(i,t)=>new Promise((e,r)=>{if(t?.aborted)return r(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},i),o=()=>{clearTimeout(s),r(t.reason)};t?.addEventListener("abort",o,{once:!0})}),Po=YI;var Jw=async({parent:i,element:t,signal:e})=>{let r=t.speed??50,s=t.revealEffect??"typewriter",o=t?.indicator?.offset??12,n=s==="none",a=n?0:Math.max(1,Math.floor(1e3/r)),h=n?0:Math.max(1,Math.floor(4e3/r)),l=new St;l.label=t.id;let c=new se(E.EMPTY);if(t?.indicator?.revealing?.src){let u=t.indicator.revealing.src?E.from(t.indicator.revealing.src):E.EMPTY;c=new se(u),c.width=t.indicator.revealing.width??u.width,c.height=t.indicator.revealing.height??u.height}l.addChild(c),t.x!==void 0&&(l.x=Math.round(t.x)),t.y!==void 0&&(l.y=Math.round(t.y)),t.alpha!==void 0&&(l.alpha=t.alpha),i.addChild(l);for(let u=0;u<t.content.length;u++){let d=t.content[u];c.x=o,c.y=d.y+(d.lineMaxHeight-c.height);for(let f=0;f<d.lineParts.length;f++){if(e?.aborted)return;let p=d.lineParts[f],m=new Mt(p.textStyle),g=new _r({text:"",style:m,x:Math.round(p.x),y:Math.round(p.y)}),b=null;if(p.furigana){let T=new Mt(p.furigana.textStyle);b=new _r({text:"",style:T,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),l.addChild(b)}l.addChild(g);let _=p.text,v=p.furigana?.text||"";if(n||e?.aborted)g.text=_,c.x=Co(g,_.length-1)+o,b&&(b.text=v);else{let T=v.length;for(let w=0;w<_.length;w++){if(e?.aborted)return;g.text=_.substring(0,w+1),c.x=Co(g,w)+o;let S=Math.round((w+1)/_.length*T);if(b&&(b.text=v.substring(0,S)),w<_.length-1)try{await Po(a,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(u<t.content.length-1)try{await Po(h,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let u=t.indicator.complete.src?E.from(t.indicator.complete.src):E.EMPTY;c.texture=u,c.width=t.indicator.complete.width??u.width,c.height=t.indicator.complete.height??u.height}};var t1=async i=>{let{parent:t,nextElement:e,signal:r}=i,s=e.speed??50,o=e.revealEffect??"typewriter",n=e?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=t.children.find(u=>u.label===e.id);if(c){c.removeChildren();let u=new se(E.EMPTY);if(e?.indicator?.revealing?.src){let d=e.indicator.revealing.src?E.from(e.indicator.revealing.src):E.EMPTY;u=new se(d),u.width=e.indicator.revealing.width??d.width,u.height=e.indicator.revealing.height??d.height}c.addChild(u),e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha);for(let d=0;d<e.content.length;d++){let f=e.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(r?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new _r({text:"",style:g,x:m.x,y:m.y}),_=null;if(m.furigana){let w=new Mt(m.furigana.textStyle);_=new _r({text:"",style:w,x:m.furigana.x,y:m.furigana.y}),c.addChild(_)}c.addChild(b);let v=m.text,T=m.furigana?.text||"";if(a||r?.aborted)b.text=v,u.x=Co(b,v.length-1)+n,_&&(_.text=T);else{let w=T.length;for(let S=0;S<v.length;S++){b.text=v.substring(0,S+1),u.x=Co(b,S)+n;let A=Math.round((S+1)/v.length*w);if(_&&(_.text=T.substring(0,A)),S<v.length-1)try{await Po(h,r)}catch(M){if(M.name==="AbortError")return;throw M}}}}if(d<e.content.length-1)try{await Po(l,r)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let d=e.indicator.complete.src?E.from(e.indicator.complete.src):E.EMPTY;u.texture=d,u.width=e.indicator.complete.width??d.width,u.height=e.indicator.complete.height??d.height}}};var e1=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=i.getChildByLabel(t.id);if(r){let s=!0,o=()=>{r&&!r.destroyed&&r.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var qI=(i,t)=>{let e=[],r=[],s=0,o=0,n=0,a=0,h=[...i],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=t-s,f={...u.textStyle,wordWrapWidth:d},p=Xt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&r.length>0){e.push({lineParts:[...r],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,r=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=Xt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let v=Xt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-v.height+o+2,w={text:u.furigana.text,textStyle:u.furigana.textStyle,x:s+(p.lineWidths[0]-v.width)/2,y:T};b.furigana=w}r.push(b),n=Math.max(n,g.height),s+=p.lineWidths[0],a=Math.max(a,s);let _=p.lines.slice(1).join(" ");_&&_.length>0?u.text=_:h.shift()}r.length>0&&e.push({lineParts:r,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},r1=({state:i})=>{let t={...wo,wordWrap:!0},e=(i.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),i.width&&(u.wordWrapWidth=i.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),i.width&&(f.wordWrapWidth=i.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),r=i.width||500,{chunks:s,width:o,height:n}=qI(e,r),a=i.width||o,l=nr({...i,width:a,height:n});if(l.alpha=i.alpha??1,i.indicator){let c=i.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...i.textStyle||{}},speed:i.speed??50,revealEffect:i.revealEffect??"typewriter",...i.width!==void 0&&{width:i.width}}};var KI=ze({type:"text-revealing",add:Jw,update:t1,delete:e1,parse:r1});var ZI={linear:i=>i},QI=(i,t,e,r)=>i+(t-i)*ZI[r](e),JI=(i,t,e)=>{typeof t=="string"&&(t=Hm[t]);let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r},tF=(i,t,e)=>{typeof t=="string"&&(t=Hm[t]);let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i},eF=i=>{let t=[],e=0,r;return i.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(r=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?r=r+s:r=s,t.push({time:e,value:r,easing:n}))}),t},rF=(i,t)=>{if(i.length===0)return 0;if(t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.length-1].value;for(let e=0;e<i.length-1;e++){let{time:r,value:s,easing:o}=i[e],{time:n,value:a}=i[e+1];if(t>=r&&t<=n){let h=(t-r)/(n-r);return QI(s,a,h,o)}}return i[i.length-1].value},iF=i=>Math.max.apply(null,i),i1=async({app:i,element:t,animation:e,signal:r})=>new Promise((s,o)=>{if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}let{properties:n}=e,a=Object.entries(n).map(([m,g])=>{if(!Mw[m])throw new Error(`${m} is not a supported property for transition.`);return{...g,property:m}}),h=a.map(m=>m.keyframes.reduce((g,b)=>g+b.duration||0,0)),l=iF(h),c={};a.forEach(m=>{c[m.property]=JI(t,m.property)});let u=a.map(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue}]:g=[{value:c[m.property]}],g=g.concat(m.keyframes);let b=eF(g);return{property:m.property,timeline:b}}),d=0,f=m=>{u.forEach(({property:g,timeline:b})=>{let _=rF(b,m);t&&!t.destroyed&&tF(t,g,_)})};r&&r.addEventListener("abort",()=>{i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"))});let p=m=>{if(d+=m.deltaMS,d>=l){i.ticker.remove(p),s();return}f(d)};if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}i.ticker.add(p)});var sF=Dm({type:"tween",animate:i1});var s1=({app:i,element:t,signal:e})=>{if(e?.aborted)return;let r={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||i.audioStage.add(r)},t.delay):i.audioStage.add(r)};var o1=({app:i,prevElement:t,nextElement:e,signal:r})=>{if(!r?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=i.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var n1=({app:i,element:t,signal:e})=>{e?.aborted||i.audioStage.remove(t.id)};var oF=Nm({type:"sound",add:s1,update:o1,delete:n1});var a1=(i=[],t=[])=>{let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Vm=async({app:i,prevAudioTree:t,nextAudioTree:e,audioPlugins:r,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=a1(t,e),h=[];for(let l of n){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:i,element:l,signal:s}))}for(let l of o){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:i,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=r.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:i,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var $e=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))($e||{}),Wm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Wm||{}),iu=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(iu||{}),Z=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Z||{}),Ro=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ro||{}),G=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(G||{}),ei=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(ei||{}),rt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(rt||{}),D=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(D||{}),ar=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(ar||{}),ih=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(ih||{}),yr=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(yr||{}),Xe=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(Xe||{}),Ci=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ci||{}),su=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(su||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Jt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Jt||{});var Ct=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(Ct||{}),De=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(De||{});var zm={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var Y={ADAPTER:zm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Gd();var nF=fi.default??fi,br=nF(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var hs=Gi(l1(),1),Z2=Gi(Vl(),1);var Eg=Gi(AP(),1);var wP={};function ht(i,t,e=3){if(wP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1144
|
+
`,Eo=null,eh=class{constructor(){Eo||(Eo=URL.createObjectURL(new Blob([RI],{type:"application/javascript"}))),this.worker=new Worker(Eo)}};eh.revokeObjectURL=function(){Eo&&(URL.revokeObjectURL(Eo),Eo=null)};var Ew=0,Um,km=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new So;e.addEventListener("message",r=>{e.terminate(),So.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Um===void 0&&(Um=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Um&&(this._createdWorkers++,t=new eh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[Ew]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Ew++,id:r})}},Om=new km;Yr();var MI=[".jpeg",".jpg",".png",".webp",".avif"],BI=["image/jpeg","image/png","image/webp","image/avif"];async function II(i,t){let e=await $.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Qc={name:"loadTextures",extension:{type:y.LoadParser,priority:le.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ir(i,BI)||sr(i,MI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Om.isImageBitmapSupported()?r=await Om.loadImageBitmap(i,t):r=await II(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Ge({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||bo(i),...t.data});return vo(s,e,i)},unload(i){i.destroy(!0)}};C();Zd();Kd();var Aw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],FI=Aw.map(i=>`video/${i.substring(1)}`);function GI(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=kI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function UI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function kI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var ww={name:"loadVideo",extension:{type:y.LoadParser,name:"loadVideo"},test(i){let t=ir(i,FI),e=sr(i,Aw);return t||e},async load(i,t,e){let r={...Us.defaultOptions,resolution:t.data?.resolution||bo(i),alphaMode:t.data?.alphaMode||await Al(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),GI(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Us.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Us({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await UI(s),h(vo(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};C();Is();C();Is();var Jc={extension:{type:y.ResolveParser,name:"resolveTexture"},test:Qc.test,parse:i=>({resolution:parseFloat(We.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Cw={extension:{type:y.ResolveParser,priority:-2,name:"resolveJson"},test:i=>We.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Jc.parse};Is();Sn();yl();var tu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new We,this.loader=new Zc,this.cache=xt,this._backgroundLoader=new qc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=zi(t),s=Ee(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return xt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=xt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),xt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ee(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ee(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{xt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},or=new tu;G.handleByList(y.LoadParser,or.loader.parsers).handleByList(y.ResolveParser,or.resolver.parsers).handleByList(y.CacheParser,or.cache.parsers).handleByList(y.DetectionParser,or.detections);G.add(dw,mw,fw,yw,gw,xw,_w,bw,vw,Tw,Sw,Qc,ww,uw,cw,Jc,Cw);var Pw={loader:y.LoadParser,resolver:y.ResolveParser,cache:y.CacheParser,detection:y.DetectionParser};G.handle(y.Asset,i=>{let t=i.ref;Object.entries(Pw).filter(([e])=>!!t[e]).forEach(([e,r])=>G.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Pw).filter(e=>!!t[e]).forEach(e=>G.remove(t[e]))});Jh();Dt();_l();var eu=class extends mi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new pe({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Rw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(z(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Yn();Ji();var _r=class extends eu{constructor(...t){let e=Rw(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=Xt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Yr();vt();tf();dr();xp();Tl();Yn();Ji();_e();var OI=Gi(Vl(),1);G.add(OT,DT);var LI=new(window.AudioContext||window.webkitAudioContext),Lm={},DI=async(i,t)=>{if(!Lm[i]&&t.byteLength!==0)try{let e=await LI.decodeAudioData(t);Lm[i]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${i}:`,e)}},NI=i=>Lm[i],Ao={load:DI,getAsset:NI};var ze=({type:i,add:t,update:e,delete:r,parse:s})=>({type:i,add:t,update:e,delete:r,parse:s});var Dm=({type:i,animate:t})=>({type:i,animate:t});var Nm=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Mw={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},Hm={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var ru={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider"};var wo={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0};var Le=(i,t,e={})=>{let r={...wo,...e,...t};i.style=r};async function _t(i,t,{app:e,element:r,animations:s,signal:o}){let n=[];for(let a of s)if(a.targetId===i){let h=t.find(l=>l.type===a.type);if(!h)throw new Error(`No animation plugin found for type: ${a.type}`);n.push(h.animate({app:e,element:r,animation:a,signal:o}))}return Promise.all(n)}var Bw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new _r({label:e.id}),l=()=>{h.text=e.content,Le(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click;if(u){let{cursor:f,soundSrc:p,actionPayload:m}=u;h.eventMode="static";let g=()=>{m&&s&&s("hover",{_event:{id:h.label},...m}),f&&(h.cursor=f),p&&i.audioStage.add({id:`hover-${Date.now()}`,url:p,loop:!1}),u?.textStyle&&Le(h,u.textStyle,e.textStyle)},b=()=>{h.cursor="auto",Le(h,e.textStyle)};h.on("pointerover",g),h.on("pointerout",b)}if(d){let{soundSrc:f,actionPayload:p}=d;h.eventMode="static";let m=()=>{d?.textStyle&&Le(h,d.textStyle,e.textStyle)},g=()=>{Le(h,e.textStyle),p&&s&&s("click",{_event:{id:h.label},...p}),f&&i.audioStage.add({id:`click-${Date.now()}`,url:f,loop:!1})},b=()=>{Le(h,e.textStyle)};h.on("pointerdown",m),h.on("pointerup",g),h.on("pointerupoutside",b)}t.addChild(h),r&&r.length>0&&(a=!1,await _t(e.id,o,{app:i,element:h,animations:r,signal:n}),a=!0),n.removeEventListener("abort",c)};var Iw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.text=r.content,Le(h,r.textStyle),h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{g&&s&&s("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.textStyle&&Le(h,d.textStyle,r.textStyle)},_=()=>{h.cursor="auto",Le(h,r.textStyle)};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{f?.textStyle&&Le(h,f.textStyle,r.textStyle)},b=()=>{Le(h,r.textStyle),m&&s&&s("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{Le(h,r.textStyle)};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await _t(r.id,n,{app:i,element:h,animations:o,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Fw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Gw=({positionX:i=0,positionY:t=0,width:e,height:r,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof r!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:r*o},a=i-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var nr=i=>{if(typeof i.width!="number"||typeof i.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(ru).includes(i.type))throw new Error("Input Error: Type must be one of "+Object.values(ru).join(", "));if(!i.id)throw new Error("Input Error: Id is missing");let t=i.scaleX?i.scaleX*i.width:i.width,e=i.scaleY?i.scaleY*i.height:i.height;i.type===ru.CONTAINER&&(t=i.width,e=i.height);let{x:r,y:s,originX:o,originY:n}=Gw({positionX:i.x,positionY:i.y,width:t,height:e,anchorX:i.anchorX,anchorY:i.anchorY}),a={id:i.id,type:i.type,width:Math.round(t),height:Math.round(e),x:Math.round(r),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:i.alpha??1};return i.hover&&(a.hover=i.hover),i.click&&(a.click=i.click),a};var Uw=({state:i})=>{let t={...wo,...i.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),i.width&&(t.wordWrapWidth=i.width,t.wordWrap=!0);let{width:e,height:r}=Xt.measureText(i.content??"",new Mt(t)),s=Math.round(e),o=Math.round(r);return{...nr({...i,width:s,height:o}),content:i.content??"",textStyle:{...t}}};var HI=ze({type:"text",add:Bw,update:Iw,delete:Fw,parse:Uw});var kw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,originX:p,originY:m,rotation:g,alpha:b}=e,_=new xr;_.label=a;let v=!0,T=()=>{_.clear(),_.rect(0,0,Math.round(c),Math.round(u)).fill(d),_.x=Math.round(h),_.y=Math.round(l),_.alpha=b,f&&_.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},A=async()=>{v||T()};n.addEventListener("abort",A),T();let S=e?.hover,w=e?.click,M=e?.drag;if(S){let{cursor:P,soundSrc:R,actionPayload:B}=S;_.eventMode="static";let F=()=>{B&&o&&o("hover",{_event:{id:_.label},...B}),P&&(_.cursor=P),R&&i.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},W=()=>{_.cursor="auto"};_.on("pointerover",F),_.on("pointerout",W)}if(w){let{soundSrc:P,actionPayload:R}=w;_.eventMode="static";let B=()=>{R&&o&&o("click",{_event:{id:_.label},...R}),P&&i.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1})};_.on("pointerup",B)}if(M){let{start:P,end:R,move:B}=M;_.eventMode="static";let F=()=>{_._isDragging=!0,P&&o&&o("drag-start",{_event:{id:_.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},W=()=>{_._isDragging=!1,R&&o&&o("drag-end",{_event:{id:_.label},...typeof R?.actionPayload=="object"?R.actionPayload:{}})},D=it=>{B&&o&&_._isDragging&&o("drag-move",{_event:{id:_.label,x:it.global.x,y:it.global.y},...typeof B?.actionPayload=="object"?B.actionPayload:{}})};_.on("pointerdown",F),_.on("pointerup",W),_.on("globalpointermove",D),_.on("pointerupoutside",W)}t.addChild(_),r&&r.length>0&&(v=!1,await _t(a,s,{app:i,element:_,animations:r,signal:n})),v=!0,n.removeEventListener("abort",A)};var Ow=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.clear(),h.rect(0,0,Math.round(r.width),Math.round(r.height)).fill(r.fill),h.x=Math.round(r.x),h.y=Math.round(r.y),h.alpha=r.alpha,r.border&&h.stroke({color:r.border.color,alpha:r.border.alpha,width:Math.round(r.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let d=r?.hover,f=r?.click,p=r?.drag;if(d){let{cursor:m,soundSrc:g,actionPayload:b}=d;h.eventMode="static";let _=()=>{b&&n&&n("hover",{_event:{id:h.label},...b}),m&&(h.cursor=m),g&&i.audioStage.add({id:`hover-${Date.now()}`,url:g,loop:!1})},v=()=>{h.cursor="auto"};h.on("pointerover",_),h.on("pointerout",v)}if(f){let{soundSrc:m,actionPayload:g}=f;h.eventMode="static";let b=()=>{g&&n&&n("click",{_event:{id:h.label},...g}),m&&i.audioStage.add({id:`click-${Date.now()}`,url:m,loop:!1})};h.on("pointerup",b)}if(p){let{start:m,end:g,move:b}=p;h.eventMode="static";let _=()=>{h._isDragging=!0,m&&n&&n("drag-start",{_event:{id:h.label},...typeof m?.actionPayload=="object"?m.actionPayload:{}})},v=()=>{h._isDragging=!1,g&&n&&n("drag-end",{_event:{id:h.label},...typeof g?.actionPayload=="object"?g.actionPayload:{}})},T=A=>{b&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:A.global.x,y:A.global.y},...typeof b?.actionPayload=="object"?b.actionPayload:{}})};h.on("pointerdown",_),h.on("pointerup",v),h.on("globalpointermove",T),h.on("pointerupoutside",v)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Lw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Dw=({state:i})=>{let t=nr(i),e=t;return i.border&&(e={...t,border:{alpha:i.border?.alpha??1,color:i.border?.color??"black",width:i.border?.width??0}}),{...e,cursor:i.cursor??"",fill:i.fill??"white",rotation:i.rotation??0,...i.drag&&{drag:i.drag}}};var VI=ze({type:"rect",add:kw,update:Ow,delete:Lw,parse:Dw});var Nw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?E.from(f):E.EMPTY,g=new se(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},_=async()=>{a||b()};n.addEventListener("abort",_),b();let v=e?.hover,T=e?.click;if(v){let{cursor:A,soundSrc:S,actionPayload:w}=v;g.eventMode="static";let M=()=>{if(w&&s&&s("hover",{_event:{id:g.label},...w}),A&&(g.cursor=A),S&&i.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1}),v?.src){let R=v.src?E.from(v.src):E.EMPTY;g.texture=R}},P=()=>{g.cursor="auto",g.texture=m};g.on("pointerover",M),g.on("pointerout",P)}if(T){let{soundSrc:A,actionPayload:S}=T;g.eventMode="static";let w=()=>{if(T?.src){let R=T.src?E.from(T.src):E.EMPTY;g.texture=R}},M=()=>{g.texture=m,S&&s&&s("click",{_event:{id:g.label},...S}),A&&i.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1})},P=()=>{g.texture=m};g.on("pointerdown",w),g.on("pointerup",M),g.on("pointerupoutside",P)}t.addChild(g),r&&r.length>0&&(a=!1,await _t(h,o,{app:i,element:g,animations:r,signal:n}),a=!0),n.removeEventListener("abort",_)};var Hw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){if(e.src!==r.src){let p=r.src?E.from(r.src):E.EMPTY;h.texture=p}h.x=Math.round(r.x),h.y=Math.round(r.y),h.width=Math.round(r.width),h.height=Math.round(r.height),h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{if(g&&n&&n("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.src){let v=d.src?E.from(d.src):E.EMPTY;h.texture=v}},_=()=>{h.cursor="auto",h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{if(f?.src){let v=f.src?E.from(f.src):E.EMPTY;h.texture=v}},b=()=>{h.texture=r.src?E.from(r.src):E.EMPTY,m&&n&&n("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Vw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.children.find(a=>a.label===e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Ww=({state:i})=>({...nr(i),src:i.src??i.url??"",alpha:i.alpha??1,cursor:i.cursor??""});var WI=ze({type:"sprite",add:Nw,update:Hw,delete:Vw,parse:Ww});var zw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:_,step:v,initialValue:T,originX:A,originY:S,hover:w,change:M}=e,P=new St;P.label=h,P.x=l,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let R=0,B=m?E.from(m):E.EMPTY,F=new se(B);F.label=`${h}-bar`,F.eventMode="static";let W=p?E.from(p):E.EMPTY,D=new se(W);D.label=`${h}-thumb`,D.eventMode="static";let it=T??b,L=_-b,X=Tt=>{let ct=(Tt-b)/L;g==="horizontal"?(D.x=ct*(F.width-D.width),D.y=(F.height-D.height)/2):(D.x=(F.width-D.width)/2,D.y=ct*(F.height-D.height))},H=()=>{F.width=u,F.height=d;let Tt=g==="horizontal"?d-R*2:u-R*2,ct=p?E.from(p):E.EMPTY,gt=ct.width,Ft=ct.height,qt=Tt/gt,Kt=Tt/Ft,Me=Math.min(qt,Kt);D.width=gt*Me,D.height=Ft*Me,X(it)},k=async()=>{a||H()};n.addEventListener("abort",k),H();let tt=W,yt=B,mt=!1,Ot=Tt=>{let ct;if(g==="horizontal"){let Ft=Tt.x-D.width/2;ct=Math.max(0,Math.min(1,Ft/(F.width-D.width)))}else{let Ft=Tt.y-D.height/2;ct=Math.max(0,Math.min(1,Ft/(F.height-D.height)))}let gt=b+ct*L;return v>0&&(gt=Math.round((gt-b)/v)*v+b,gt=Math.max(b,Math.min(_,gt))),gt},Lt=Tt=>{let ct=P.toLocal(Tt.global),gt=Ot(ct);gt!==it&&(it=gt,X(it),M?.actionPayload&&o&&o("change",{_event:{id:h,value:it},...M.actionPayload}))},Yt=Tt=>{mt=!0,Lt(Tt)},re=Tt=>{mt&&Lt(Tt)},ge=()=>{mt&&(mt=!1)};if(P.on("pointerdown",Yt),P.on("globalpointermove",re),P.on("pointerup",ge),P.on("pointerupoutside",ge),w){let{cursor:Tt,soundSrc:ct,thumbSrc:gt,barSrc:Ft}=w,qt=()=>{Tt&&(F.cursor=Tt,D.cursor=Tt),ct&&i.audioStage.add({id:`hover-${Date.now()}`,url:ct,loop:!1}),gt&&(D.texture=E.from(gt)),Ft&&(F.texture=E.from(Ft))},Kt=()=>{mt||(F.cursor="auto",D.cursor="auto",D.texture=tt,F.texture=yt)};P.on("pointerover",qt),P.on("pointerout",Kt),P.on("pointerupoutside",Kt)}P.addChild(F),P.addChild(D),t.addChild(P),r&&r.length>0&&(a=!1,await _t(h,s,{app:i,element:P,animations:r,signal:n}),a=!0),n.removeEventListener("abort",k)};var $w=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.label=r.id,h.pivot.set(r.originX,r.originY);let c=h.getChildByLabel(`${r.id}-bar`),u=h.getChildByLabel(`${r.id}-thumb`);if(c&&u){c.width=r.width,c.height=r.height;let d=0,f=r.direction==="horizontal"?r.height-d*2:r.width-d*2,p=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY,m=p.width||16,g=p.height||16,b=f/m,_=f/g,v=Math.min(b,_);if(u.width=m*v,u.height=g*v,e.barSrc!==r.barSrc){let S=r.barSrc?E.from(r.barSrc):E.EMPTY;c.texture=S}if(e.thumbSrc!==r.thumbSrc){let S=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY;u.texture=S}let T=r.max-r.min,A=(r.initialValue-r.min)/T;r.direction==="horizontal"?(u.x=A*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=A*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,change:f,min:p,max:m,step:g,direction:b,initialValue:_}=r,v=_??p,T=m-p;h.eventMode="static";let A=D=>{let it=(D-p)/T;b==="horizontal"?(u.x=it*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=it*(c.height-u.height))},S=D=>{let it;if(b==="horizontal"){let X=D.x-u.width/2;it=Math.max(0,Math.min(1,X/(c.width-u.width)))}else{let X=D.y-u.height/2;it=Math.max(0,Math.min(1,X/(c.height-u.height)))}let L=p+it*T;return g>0&&(L=Math.round((L-p)/g)*g+p,L=Math.max(p,Math.min(m,L))),L},w=u.texture,M=c.texture,P=!1,R=D=>{let it=h.toLocal(D.global),L=S(it);L!==v&&(v=L,A(v),f?.actionPayload&&s&&s("change",{_event:{id,value:v},...f.actionPayload}))},B=D=>{P=!0,R(D)},F=D=>{P&&R(D)},W=()=>{P&&(P=!1)};if(h.on("pointerdown",B),h.on("globalpointermove",F),h.on("pointerup",W),h.on("pointerupoutside",W),d){let{cursor:D,soundSrc:it,thumbSrc:L,barSrc:X}=d,H=()=>{D&&(h.cursor=D,u.cursor=D),it&&i.audioStage.add({id:`hover-${Date.now()}`,url:it,loop:!1}),L&&(u.texture=E.from(L)),X&&(c.texture=E.from(X))},k=()=>{P||(h.cursor="auto",u.cursor="auto",u.texture=w,c.texture=M)};h.on("pointerover",H),h.on("pointerout",k),h.on("pointerupoutside",k)}}}};h&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Xw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy({children:!0})},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var jw=({state:i})=>{let t=nr(i),e=i.min??0,r=i.max??100;if(r<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:i.direction??"horizontal",thumbSrc:i.thumbSrc??"",barSrc:i.barSrc??"",alpha:i.alpha??1,min:e,max:r,step:i.step??1,initialValue:i.initialValue??0,...i.hover&&{hover:i.hover},...i.change&&{change:i.change}}};var zI=ze({type:"slider",add:zw,update:$w,delete:Xw,parse:jw});var Yw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new St;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let _ of u){let v=n.find(T=>T.type===_.type);if(!v)throw new Error(`No plugin found for child element type: ${_.type}`);await v.add({app:i,parent:p,element:_,animations:r,eventHandler:s,animationPlugins:o,animateElements:_t,elementPlugins:n,signal:a})}d&&$I({container:p,element:e}),r&&r.length>0&&(m=!1,await _t(h,o,{app:i,element:p,animations:r,signal:a})),m=!0,a.removeEventListener("abort",b)},$I=({container:i,element:t})=>{let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new St;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new xr().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}};var qw=(i,t,e=[])=>{let r=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of i)r.add(l.id),s.set(l.id,l);for(let l of t)r.add(l.id),o.set(l.id,l);for(let l of r){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var rh=async({app:i,parent:t,prevASTTree:e,nextASTTree:r,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=qw(e,r,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:i,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:i,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:i,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),XI(t,r)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},XI=(i,t)=>{i.children.sort((e,r)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===r.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1})};var Kw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(r)&&(l.x=Math.round(r.x),l.y=Math.round(r.y),l.label=r.id,l.alpha=r.alpha,JSON.stringify(e.children)!==JSON.stringify(r.children)&&await rh({app:i,parent:l,nextASTTree:r.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await _t(e.id,n,{app:i,element:l,animations:o,signal:h})),c=!0,await u(),h.removeEventListener("abort",d))};var Zw=async({app:i,parent:t,element:e,animationPlugins:r,animations:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&(t.removeChild(n),n.destroy({children:!0,texture:!0,baseTexture:!0}))},l=async()=>{a||h()};o.addEventListener("abort",l),s&&s.length>0&&(a=!1,await _t(e.id,r,{app:i,element:n,animations:s,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Qw=({state:i,parserPlugins:t=[]})=>{let e=i.direction??"",r=!!i.scroll,s=i.gap||0,o=structuredClone(i.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let _=0;_<o.length;_++){let v=_<o.length-1?s:0,T=o[_];_>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let A=t.find(S=>S.type===T.type);A&&(T=A.parse({state:T,parserPlugins:t})),e==="horizontal"?(i.width&&T.width+m>i.width&&!r?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+v,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"?(i.height&&T.height+g>i.height&&!r?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+v,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)):(a=Math.max(T.width+T.x,a),h=Math.max(T.height+T.y,h)),n.push(T)}return{...nr({...i,width:i.width?i.width:a,height:i.height?i.height:h}),children:n,direction:e,gap:s,scroll:r,rotation:i.rotation??0}};var jI=ze({type:"container",add:Yw,update:Kw,delete:Zw,parse:Qw});function Co(i,t){let e=i.text.substring(0,t),s=Xt.measureText(e,i.style).width;return i.x+s}var YI=async(i,t)=>new Promise((e,r)=>{if(t?.aborted)return r(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},i),o=()=>{clearTimeout(s),r(t.reason)};t?.addEventListener("abort",o,{once:!0})}),Po=YI;var Jw=async({parent:i,element:t,signal:e})=>{let r=t.speed??50,s=t.revealEffect??"typewriter",o=t?.indicator?.offset??12,n=s==="none",a=n?0:Math.max(1,Math.floor(1e3/r)),h=n?0:Math.max(1,Math.floor(4e3/r)),l=new St;l.label=t.id;let c=new se(E.EMPTY);if(t?.indicator?.revealing?.src){let u=t.indicator.revealing.src?E.from(t.indicator.revealing.src):E.EMPTY;c=new se(u),c.width=t.indicator.revealing.width??u.width,c.height=t.indicator.revealing.height??u.height}l.addChild(c),t.x!==void 0&&(l.x=Math.round(t.x)),t.y!==void 0&&(l.y=Math.round(t.y)),t.alpha!==void 0&&(l.alpha=t.alpha),i.addChild(l);for(let u=0;u<t.content.length;u++){let d=t.content[u];c.x=o,c.y=d.y+(d.lineMaxHeight-c.height);for(let f=0;f<d.lineParts.length;f++){if(e?.aborted)return;let p=d.lineParts[f],m=new Mt(p.textStyle),g=new _r({text:"",style:m,x:Math.round(p.x),y:Math.round(p.y)}),b=null;if(p.furigana){let T=new Mt(p.furigana.textStyle);b=new _r({text:"",style:T,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),l.addChild(b)}l.addChild(g);let _=p.text,v=p.furigana?.text||"";if(n||e?.aborted)g.text=_,c.x=Co(g,_.length-1)+o,b&&(b.text=v);else{let T=v.length;for(let A=0;A<_.length;A++){if(e?.aborted)return;g.text=_.substring(0,A+1),c.x=Co(g,A)+o;let S=Math.round((A+1)/_.length*T);if(b&&(b.text=v.substring(0,S)),A<_.length-1)try{await Po(a,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(u<t.content.length-1)try{await Po(h,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let u=t.indicator.complete.src?E.from(t.indicator.complete.src):E.EMPTY;c.texture=u,c.width=t.indicator.complete.width??u.width,c.height=t.indicator.complete.height??u.height}};var t1=async i=>{let{parent:t,nextElement:e,signal:r}=i,s=e.speed??50,o=e.revealEffect??"typewriter",n=e?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=t.children.find(u=>u.label===e.id);if(c){c.removeChildren();let u=new se(E.EMPTY);if(e?.indicator?.revealing?.src){let d=e.indicator.revealing.src?E.from(e.indicator.revealing.src):E.EMPTY;u=new se(d),u.width=e.indicator.revealing.width??d.width,u.height=e.indicator.revealing.height??d.height}c.addChild(u),e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha);for(let d=0;d<e.content.length;d++){let f=e.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(r?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new _r({text:"",style:g,x:m.x,y:m.y}),_=null;if(m.furigana){let A=new Mt(m.furigana.textStyle);_=new _r({text:"",style:A,x:m.furigana.x,y:m.furigana.y}),c.addChild(_)}c.addChild(b);let v=m.text,T=m.furigana?.text||"";if(a||r?.aborted)b.text=v,u.x=Co(b,v.length-1)+n,_&&(_.text=T);else{let A=T.length;for(let S=0;S<v.length;S++){b.text=v.substring(0,S+1),u.x=Co(b,S)+n;let w=Math.round((S+1)/v.length*A);if(_&&(_.text=T.substring(0,w)),S<v.length-1)try{await Po(h,r)}catch(M){if(M.name==="AbortError")return;throw M}}}}if(d<e.content.length-1)try{await Po(l,r)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let d=e.indicator.complete.src?E.from(e.indicator.complete.src):E.EMPTY;u.texture=d,u.width=e.indicator.complete.width??d.width,u.height=e.indicator.complete.height??d.height}}};var e1=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=i.getChildByLabel(t.id);if(r){let s=!0,o=()=>{r&&!r.destroyed&&r.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var qI=(i,t)=>{let e=[],r=[],s=0,o=0,n=0,a=0,h=[...i],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},p=Xt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&r.length>0){e.push({lineParts:[...r],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,r=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=Xt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let v=Xt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-v.height+o+2,A={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(p.lineWidths[0]-v.width)/2),y:T};b.furigana=A}r.push(b),n=Math.max(n,g.height),s+=Math.round(p.lineWidths[0]),a=Math.max(a,s);let _=p.lines.slice(1).join(" ");_&&_.length>0?u.text=_:h.shift()}r.length>0&&e.push({lineParts:r,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},r1=({state:i})=>{let t={...wo,wordWrap:!0},e=(i.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),i.width&&(u.wordWrapWidth=i.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),i.width&&(f.wordWrapWidth=i.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),r=i.width||500,{chunks:s,width:o,height:n}=qI(e,r),a=i.width||o,l=nr({...i,width:a,height:n});if(l.alpha=i.alpha??1,i.indicator){let c=i.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...i.textStyle||{}},speed:i.speed??50,revealEffect:i.revealEffect??"typewriter",...i.width!==void 0&&{width:i.width}}};var KI=ze({type:"text-revealing",add:Jw,update:t1,delete:e1,parse:r1});var ZI={linear:i=>i},QI=(i,t,e,r)=>i+(t-i)*ZI[r](e),JI=(i,t,e)=>{typeof t=="string"&&(t=Hm[t]);let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r},tF=(i,t,e)=>{typeof t=="string"&&(t=Hm[t]);let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i},eF=i=>{let t=[],e=0,r;return i.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(r=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?r=r+s:r=s,t.push({time:e,value:r,easing:n}))}),t},rF=(i,t)=>{if(i.length===0)return 0;if(t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.length-1].value;for(let e=0;e<i.length-1;e++){let{time:r,value:s,easing:o}=i[e],{time:n,value:a}=i[e+1];if(t>=r&&t<=n){let h=(t-r)/(n-r);return QI(s,a,h,o)}}return i[i.length-1].value},iF=i=>Math.max.apply(null,i),i1=async({app:i,element:t,animation:e,signal:r})=>new Promise((s,o)=>{if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}let{properties:n}=e,a=Object.entries(n).map(([m,g])=>{if(!Mw[m])throw new Error(`${m} is not a supported property for transition.`);return{...g,property:m}}),h=a.map(m=>m.keyframes.reduce((g,b)=>g+b.duration||0,0)),l=iF(h),c={};a.forEach(m=>{c[m.property]=JI(t,m.property)});let u=a.map(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue}]:g=[{value:c[m.property]}],g=g.concat(m.keyframes);let b=eF(g);return{property:m.property,timeline:b}}),d=0,f=m=>{u.forEach(({property:g,timeline:b})=>{let _=rF(b,m);t&&!t.destroyed&&tF(t,g,_)})};r&&r.addEventListener("abort",()=>{i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"))});let p=m=>{if(d+=m.deltaMS,d>=l){i.ticker.remove(p),f(l),s();return}f(d)};if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}i.useCustomTicker===!1?i.ticker.add(p):window.addEventListener("snapShotKeyFrame",m=>{m?.detail?.deltaMS&&p({deltaMS:Number(m.detail.deltaMS)})})});var sF=Dm({type:"tween",animate:i1});var s1=({app:i,element:t,signal:e})=>{if(e?.aborted)return;let r={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||i.audioStage.add(r)},t.delay):i.audioStage.add(r)};var o1=({app:i,prevElement:t,nextElement:e,signal:r})=>{if(!r?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=i.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var n1=({app:i,element:t,signal:e})=>{e?.aborted||i.audioStage.remove(t.id)};var oF=Nm({type:"sound",add:s1,update:o1,delete:n1});var a1=(i=[],t=[])=>{let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Vm=async({app:i,prevAudioTree:t,nextAudioTree:e,audioPlugins:r,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=a1(t,e),h=[];for(let l of n){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:i,element:l,signal:s}))}for(let l of o){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:i,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=r.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:i,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var $e=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))($e||{}),Wm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Wm||{}),iu=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(iu||{}),Z=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Z||{}),Ro=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ro||{}),U=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(U||{}),ei=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(ei||{}),rt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(rt||{}),N=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(N||{}),ar=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(ar||{}),ih=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(ih||{}),yr=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(yr||{}),Xe=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(Xe||{}),Ci=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ci||{}),su=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(su||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Jt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Jt||{});var Ct=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(Ct||{}),De=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(De||{});var zm={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var Y={ADAPTER:zm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Gd();var nF=fi.default??fi,br=nF(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var hs=Gi(l1(),1),Z2=Gi(Vl(),1);var Eg=Gi(AP(),1);var wP={};function ht(i,t,e=3){if(wP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1145
1145
|
Deprecated since v${i}`):(r=r.split(`
|
|
1146
1146
|
`).splice(e).join(`
|
|
1147
1147
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
1148
1148
|
Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1149
1149
|
Deprecated since v${i}`),console.warn(r))),wP[t]=!0}var Ag;function wg(){return typeof Ag>"u"&&(Ag=function(){let i={stencil:!0,failIfMajorPerformanceCaveat:Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Y.ADAPTER.getWebGLRenderingContext())return!1;let t=Y.ADAPTER.createCanvas(),e=t.getContext("webgl",i)||t.getContext("experimental-webgl",i),r=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,r}catch{return!1}}()),Ag}nd();ad();Zh([Qh]);var No=class bu{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}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(t){return this.value=t,this}set value(t){if(t instanceof bu)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=bu.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,r,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=bu.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ne(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}};No.shared=new No,No.temp=new No,No.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var vr=No;function X2(){let i=[],t=[];for(let r=0;r<32;r++)i[r]=r,t[r]=r;i[Z.NORMAL_NPM]=Z.NORMAL,i[Z.ADD_NPM]=Z.ADD,i[Z.SCREEN_NPM]=Z.SCREEN,t[Z.NORMAL]=Z.NORMAL_NPM,t[Z.ADD]=Z.ADD_NPM,t[Z.SCREEN]=Z.SCREEN_NPM;let e=[];return e.push(t),e.push(i),e}var Cg=X2();function Ho(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function as(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function vu(i){return!(i&i-1)&&!!i}function Tu(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Pg(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var j2=0;function ii(){return++j2}var CP=class{constructor(i,t,e,r){this.left=i,this.top=t,this.right=e,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};CP.EMPTY=new CP(0,0,0,0);var Su={},je=Object.create(null),Lr=Object.create(null);function Rg(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Eu(i,t=1){let e=Y.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}var V=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(V||{}),Mg=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},RP=(i,t)=>Mg(i).priority??t,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Mg).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Mg).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>RP(o,e)-RP(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})}};var xh=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var Q2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
1150
1150
|
`);function J2(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
1151
|
-
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Au(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=Q2.replace(/%forloop%/gi,J2(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Bg=0,Ig=1,Fg=2,Gg=3,Ug=4,kg=5,Dr=class i{constructor(){this.data=0,this.blendMode=Z.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Bg)}set blend(t){!!(this.data&1<<Bg)!==t&&(this.data^=1<<Bg)}get offsets(){return!!(this.data&1<<Ig)}set offsets(t){!!(this.data&1<<Ig)!==t&&(this.data^=1<<Ig)}get culling(){return!!(this.data&1<<Fg)}set culling(t){!!(this.data&1<<Fg)!==t&&(this.data^=1<<Fg)}get depthTest(){return!!(this.data&1<<Gg)}set depthTest(t){!!(this.data&1<<Gg)!==t&&(this.data^=1<<Gg)}get depthMask(){return!!(this.data&1<<kg)}set depthMask(t){!!(this.data&1<<kg)!==t&&(this.data^=1<<kg)}get clockwiseFrontFace(){return!!(this.data&1<<Ug)}set clockwiseFrontFace(t){!!(this.data&1<<Ug)!==t&&(this.data^=1<<Ug)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Z.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new i;return t.depthTest=!1,t.blend=!0,t}};Dr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var _h=[];function Vo(i,t){if(!i)return null;let e="";if(typeof i=="string"){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=_h.length-1;r>=0;--r){let s=_h[r];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var jt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,s,o,n,a,h){if(arguments.length>8)throw new Error("max arguments reached");let{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(jt.prototype,{dispatch:{value:jt.prototype.emit},run:{value:jt.prototype.emit}});var Ye=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new jt("setRealSize"),this.onUpdate=new jt("update"),this.onError=new jt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,r){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var ls=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK);let o=e.realWidth,n=e.realHeight;return r.width===o&&r.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,r.type,this.data):(r.width=o,r.height=n,s.texImage2D(e.target,0,r.internalFormat,o,n,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var tU={scaleMode:ar.NEAREST,alphaMode:Xe.NPM},Og=class Wo extends hs.default{constructor(t=null,e=null){super(),e=Object.assign({},Wo.defaultOptions,e);let{alphaMode:r,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Ye)&&(t=Vo(t,p),t.internal=!0),this.resolution=f||Y.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=ii(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=vu(this.realWidth)&&vu(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Lr[this.cacheId],delete je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Wo.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=Lr[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Wo(t,e),n.cacheId=o,Wo.addToCache(n,o)),n}static fromBuffer(t,e,r,s){t=t||new Float32Array(e*r*4);let o=new ls(t,{width:e,height:r,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=G.RGBA,a=rt.FLOAT):t instanceof Int32Array?(n=G.RGBA_INTEGER,a=rt.INT):t instanceof Uint32Array?(n=G.RGBA_INTEGER,a=rt.UNSIGNED_INT):t instanceof Int16Array?(n=G.RGBA_INTEGER,a=rt.SHORT):t instanceof Uint16Array?(n=G.RGBA_INTEGER,a=rt.UNSIGNED_SHORT):t instanceof Int8Array?(n=G.RGBA,a=rt.BYTE):(n=G.RGBA,a=rt.UNSIGNED_BYTE),o.internal=!0,new Wo(o,Object.assign({},tU,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Lr[e]&&Lr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Lr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Lr[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Lr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Lr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Og.defaultOptions={mipmap:yr.POW2,anisotropicLevel:0,scaleMode:ar.LINEAR,wrapMode:ih.CLAMP,alphaMode:Xe.UNPACK,target:ei.TEXTURE_2D,format:G.RGBA,type:rt.UNSIGNED_BYTE},Og._globalBatch=0;var ut=Og;var yh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ro.TRIANGLES,this.start=0,this.size=0,this.data=null}};var eU=0,te=class i{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=eU++,this.disposeRunner=new jt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?De.ELEMENT_ARRAY_BUFFER:De.ARRAY_BUFFER}get index(){return this.type===De.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)}};var zo=class i{constructor(t,e=0,r=!1,s=rt.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=r,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,r,s,o){return new i(t,e,r,s,o)}};var rU={Float32Array,Uint32Array,Int32Array,Uint8Array};function MP(i,t){let e=0,r=0,s={};for(let h=0;h<i.length;h++)r+=t[h],e+=i[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<i.length;h++){let l=t[h],c=i[h],u=Ho(c);s[u]||(s[u]=new rU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*r+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var BP={5126:4,5123:2,5121:1},iU=0,sU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},si=class i{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=iU++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new jt("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof te||(e instanceof Array&&(e=new Float32Array(e)),e=new te(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,r,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new zo(c,r,s,o,n,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof te||(t instanceof Array&&(t=new Uint16Array(t)),t=new te(t)),t.type=De.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],r=new te,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*BP[o.type]/4),o.buffer=0}for(r.data=MP(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new i;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new te(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new zo(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new i,r=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)s[h]=s[h]||0,s[h]+=n.buffers[h].data.length,o[h]=0}for(let a=0;a<n.buffers.length;a++)r[a]=new sU[Ho(n.buffers[a].data)](s[a]),e.buffers[a]=new te(r[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)r[h].set(n.buffers[h].data,o[h]),o[h]+=n.buffers[h].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(h+=d.size*BP[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}};var bh=class extends si{constructor(t=!1){super(),this._buffer=new te(null,t,!1),this._indexBuffer=new te(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,rt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,rt.FLOAT).addAttribute("aColor",this._buffer,4,!0,rt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,rt.FLOAT).addIndex(this._indexBuffer)}};var Lg=Math.PI*2,oU=180/Math.PI,nU=Math.PI/180,lr=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(lr||{});var ee=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};ee.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var wu=[new ee,new ee,new ee,new ee],pt=class i{constructor(t=0,e=0,r=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s),this.type=lr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=wu[0].set(t.left,t.top),h=wu[1].set(t.left,t.bottom),l=wu[2].set(t.right,t.top),c=wu[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),v=u*(l.x-a.x),T=_*r+v*o,w=_*s+v*o,S=_*r+v*n,A=_*s+v*n;return!(Math.max(T,w,S,A)<=_*a.x+v*a.y||Math.min(T,w,S,A)>=_*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}};pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Cu=class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=lr.CIRC}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}getBounds(){return new pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Cu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Pu=class i{constructor(t=0,e=0,r=0,s=0){this.x=t,this.y=e,this.width=r,this.height=s,this.type=lr.ELIP}clone(){return new i(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,s=(e-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new pt(this.x-this.width,this.y-this.height,this.width,this.height)}};Pu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Ru=class i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.type=lr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}};Ru.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};var Mu=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o,this.type=lr.RREC}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}};Mu.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Bt=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new ee;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ee;let r=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*r*s+-this.c*r*o+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*o+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Lg-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new i}static get TEMP_MATRIX(){return new i}};Bt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var cs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],us=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ds=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Dg=[],IP=[],Bu=Math.sign;function aU(){for(let i=0;i<16;i++){let t=[];Dg.push(t);for(let e=0;e<16;e++){let r=Bu(cs[i]*cs[e]+ds[i]*us[e]),s=Bu(us[i]*cs[e]+fs[i]*us[e]),o=Bu(cs[i]*ds[e]+ds[i]*fs[e]),n=Bu(us[i]*ds[e]+fs[i]*fs[e]);for(let a=0;a<16;a++)if(cs[a]===r&&us[a]===s&&ds[a]===o&&fs[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new Bt;t.set(cs[i],us[i],ds[i],fs[i],0,0),IP.push(t)}}aU();var Gt={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:i=>cs[i],uY:i=>us[i],vX:i=>ds[i],vY:i=>fs[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Dg[i][t],sub:(i,t)=>Dg[i][Gt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Gt.E:Gt.W:t>0?i>0?Gt.SE:Gt.SW:i>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=IP[Gt.inv(t)];s.tx=e,s.ty=r,i.append(s)}};var oi=class i{constructor(t,e,r=0,s=0){this._x=r,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new i(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};oi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Ng=class{constructor(){this.worldTransform=new Bt,this.localTransform=new Bt,this.position=new oi(this.onChange,this,0,0),this.scale=new oi(this.onChange,this,1,1),this.pivot=new oi(this.onChange,this,0,0),this.skew=new oi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){let e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Ng.IDENTITY=new Ng;var Iu=Ng;Iu.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var FP=`varying vec2 vTextureCoord;
|
|
1151
|
+
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Au(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=Q2.replace(/%forloop%/gi,J2(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Bg=0,Ig=1,Fg=2,Gg=3,Ug=4,kg=5,Dr=class i{constructor(){this.data=0,this.blendMode=Z.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Bg)}set blend(t){!!(this.data&1<<Bg)!==t&&(this.data^=1<<Bg)}get offsets(){return!!(this.data&1<<Ig)}set offsets(t){!!(this.data&1<<Ig)!==t&&(this.data^=1<<Ig)}get culling(){return!!(this.data&1<<Fg)}set culling(t){!!(this.data&1<<Fg)!==t&&(this.data^=1<<Fg)}get depthTest(){return!!(this.data&1<<Gg)}set depthTest(t){!!(this.data&1<<Gg)!==t&&(this.data^=1<<Gg)}get depthMask(){return!!(this.data&1<<kg)}set depthMask(t){!!(this.data&1<<kg)!==t&&(this.data^=1<<kg)}get clockwiseFrontFace(){return!!(this.data&1<<Ug)}set clockwiseFrontFace(t){!!(this.data&1<<Ug)!==t&&(this.data^=1<<Ug)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Z.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new i;return t.depthTest=!1,t.blend=!0,t}};Dr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var _h=[];function Vo(i,t){if(!i)return null;let e="";if(typeof i=="string"){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=_h.length-1;r>=0;--r){let s=_h[r];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var jt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,s,o,n,a,h){if(arguments.length>8)throw new Error("max arguments reached");let{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(jt.prototype,{dispatch:{value:jt.prototype.emit},run:{value:jt.prototype.emit}});var Ye=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new jt("setRealSize"),this.onUpdate=new jt("update"),this.onError=new jt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,r){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var ls=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK);let o=e.realWidth,n=e.realHeight;return r.width===o&&r.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,r.type,this.data):(r.width=o,r.height=n,s.texImage2D(e.target,0,r.internalFormat,o,n,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var tU={scaleMode:ar.NEAREST,alphaMode:Xe.NPM},Og=class Wo extends hs.default{constructor(t=null,e=null){super(),e=Object.assign({},Wo.defaultOptions,e);let{alphaMode:r,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Ye)&&(t=Vo(t,p),t.internal=!0),this.resolution=f||Y.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=ii(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=vu(this.realWidth)&&vu(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Lr[this.cacheId],delete je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Wo.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=Lr[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Wo(t,e),n.cacheId=o,Wo.addToCache(n,o)),n}static fromBuffer(t,e,r,s){t=t||new Float32Array(e*r*4);let o=new ls(t,{width:e,height:r,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=U.RGBA,a=rt.FLOAT):t instanceof Int32Array?(n=U.RGBA_INTEGER,a=rt.INT):t instanceof Uint32Array?(n=U.RGBA_INTEGER,a=rt.UNSIGNED_INT):t instanceof Int16Array?(n=U.RGBA_INTEGER,a=rt.SHORT):t instanceof Uint16Array?(n=U.RGBA_INTEGER,a=rt.UNSIGNED_SHORT):t instanceof Int8Array?(n=U.RGBA,a=rt.BYTE):(n=U.RGBA,a=rt.UNSIGNED_BYTE),o.internal=!0,new Wo(o,Object.assign({},tU,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Lr[e]&&Lr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Lr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Lr[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Lr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Lr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Og.defaultOptions={mipmap:yr.POW2,anisotropicLevel:0,scaleMode:ar.LINEAR,wrapMode:ih.CLAMP,alphaMode:Xe.UNPACK,target:ei.TEXTURE_2D,format:U.RGBA,type:rt.UNSIGNED_BYTE},Og._globalBatch=0;var ut=Og;var yh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ro.TRIANGLES,this.start=0,this.size=0,this.data=null}};var eU=0,te=class i{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=eU++,this.disposeRunner=new jt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?De.ELEMENT_ARRAY_BUFFER:De.ARRAY_BUFFER}get index(){return this.type===De.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)}};var zo=class i{constructor(t,e=0,r=!1,s=rt.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=r,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,r,s,o){return new i(t,e,r,s,o)}};var rU={Float32Array,Uint32Array,Int32Array,Uint8Array};function MP(i,t){let e=0,r=0,s={};for(let h=0;h<i.length;h++)r+=t[h],e+=i[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<i.length;h++){let l=t[h],c=i[h],u=Ho(c);s[u]||(s[u]=new rU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*r+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var BP={5126:4,5123:2,5121:1},iU=0,sU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},si=class i{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=iU++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new jt("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof te||(e instanceof Array&&(e=new Float32Array(e)),e=new te(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,r,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new zo(c,r,s,o,n,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof te||(t instanceof Array&&(t=new Uint16Array(t)),t=new te(t)),t.type=De.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],r=new te,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*BP[o.type]/4),o.buffer=0}for(r.data=MP(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new i;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new te(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new zo(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new i,r=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)s[h]=s[h]||0,s[h]+=n.buffers[h].data.length,o[h]=0}for(let a=0;a<n.buffers.length;a++)r[a]=new sU[Ho(n.buffers[a].data)](s[a]),e.buffers[a]=new te(r[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)r[h].set(n.buffers[h].data,o[h]),o[h]+=n.buffers[h].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(h+=d.size*BP[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}};var bh=class extends si{constructor(t=!1){super(),this._buffer=new te(null,t,!1),this._indexBuffer=new te(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,rt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,rt.FLOAT).addAttribute("aColor",this._buffer,4,!0,rt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,rt.FLOAT).addIndex(this._indexBuffer)}};var Lg=Math.PI*2,oU=180/Math.PI,nU=Math.PI/180,lr=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(lr||{});var ee=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};ee.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var wu=[new ee,new ee,new ee,new ee],pt=class i{constructor(t=0,e=0,r=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s),this.type=lr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=wu[0].set(t.left,t.top),h=wu[1].set(t.left,t.bottom),l=wu[2].set(t.right,t.top),c=wu[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),v=u*(l.x-a.x),T=_*r+v*o,A=_*s+v*o,S=_*r+v*n,w=_*s+v*n;return!(Math.max(T,A,S,w)<=_*a.x+v*a.y||Math.min(T,A,S,w)>=_*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}};pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Cu=class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=lr.CIRC}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}getBounds(){return new pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Cu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Pu=class i{constructor(t=0,e=0,r=0,s=0){this.x=t,this.y=e,this.width=r,this.height=s,this.type=lr.ELIP}clone(){return new i(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,s=(e-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new pt(this.x-this.width,this.y-this.height,this.width,this.height)}};Pu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Ru=class i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.type=lr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}};Ru.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};var Mu=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o,this.type=lr.RREC}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}};Mu.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Bt=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new ee;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ee;let r=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*r*s+-this.c*r*o+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*o+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Lg-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new i}static get TEMP_MATRIX(){return new i}};Bt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var cs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],us=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ds=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Dg=[],IP=[],Bu=Math.sign;function aU(){for(let i=0;i<16;i++){let t=[];Dg.push(t);for(let e=0;e<16;e++){let r=Bu(cs[i]*cs[e]+ds[i]*us[e]),s=Bu(us[i]*cs[e]+fs[i]*us[e]),o=Bu(cs[i]*ds[e]+ds[i]*fs[e]),n=Bu(us[i]*ds[e]+fs[i]*fs[e]);for(let a=0;a<16;a++)if(cs[a]===r&&us[a]===s&&ds[a]===o&&fs[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new Bt;t.set(cs[i],us[i],ds[i],fs[i],0,0),IP.push(t)}}aU();var Gt={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:i=>cs[i],uY:i=>us[i],vX:i=>ds[i],vY:i=>fs[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Dg[i][t],sub:(i,t)=>Dg[i][Gt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Gt.E:Gt.W:t>0?i>0?Gt.SE:Gt.SW:i>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=IP[Gt.inv(t)];s.tx=e,s.ty=r,i.append(s)}};var oi=class i{constructor(t,e,r=0,s=0){this._x=r,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new i(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};oi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Ng=class{constructor(){this.worldTransform=new Bt,this.localTransform=new Bt,this.position=new oi(this.onChange,this,0,0),this.scale=new oi(this.onChange,this,1,1),this.pivot=new oi(this.onChange,this,0,0),this.skew=new oi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){let e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Ng.IDENTITY=new Ng;var Iu=Ng;Iu.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var FP=`varying vec2 vTextureCoord;
|
|
1152
1152
|
|
|
1153
1153
|
uniform sampler2D uSampler;
|
|
1154
1154
|
|
|
@@ -1514,7 +1514,7 @@ void main(void)
|
|
|
1514
1514
|
gl_Position = filterVertexPosition();
|
|
1515
1515
|
vTextureCoord = filterTextureCoord();
|
|
1516
1516
|
}
|
|
1517
|
-
`;var Xg=class Ph extends ps{constructor(t,e,r){let s=cr.from(t||Ph.defaultVertexSrc,e||Ph.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=Ph.defaultResolution,this.multisample=Ph.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Dr}apply(t,e,r,s,o){t.applyFilter(this,e,r,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return WP}static get defaultFragmentSrc(){return VP}};Xg.defaultResolution=1,Xg.defaultMultisample=Ct.NONE;var Hr=Xg;var ai=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new vr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:s}=t,o=r??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};ai.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ai.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"background"};q.add(ai);var Xo=class{constructor(t){this.renderer=t,this.emptyRenderer=new ms(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:r}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=r[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,r,s){let{elements:o,ids:n,count:a}=t,h=0;for(let l=0;l<a;l++){let c=o[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[l]=u;continue}for(;h<s;){let d=e[h];if(d&&d._batchEnabled===r&&d._batchLocation===h){h++;continue}n[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}};Xo.extension={type:V.RendererSystem,name:"batch"};q.add(Xo);var zP=0,hi=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let r;if(Y.PREFER_ENV>=$e.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};hi.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},hi.extension={type:V.RendererSystem,name:"context"};q.add(hi);var Mi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new jt("disposeFramebuffer"),this.multisample=Ct.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ut(null,{scaleMode:ar.NEAREST,resolution:1,mipmap:yr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ut(null,{scaleMode:ar.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:yr.OFF,format:G.DEPTH_COMPONENT,type:rt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let r=0;r<this.colorTextures.length;r++){let s=this.colorTextures[r],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var gs=class extends ut{constructor(t={}){if(typeof t=="number"){let e=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:r,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Ct.NONE),super(null,t),this.mipmap=yr.OFF,this.valid=!0,this._clear=new vr([0,0,0,0]),this.framebuffer=new Mi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var ne=class extends Ye{constructor(t){let e=t,r=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(r,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=Rg(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&r.width===n&&r.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,r.type,s):(r.width=n,r.height=a,o.texImage2D(e.target,0,r.internalFormat,e.format,r.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}};var xs=class extends ne{constructor(t,e){if(e=e||{},typeof t=="string"){let r=new Image;ne.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??Y.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,r)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{r(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==r&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var _s=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,r){let s=e.width,o=e.height;if(r){let n=t.width/2/s,a=t.height/2/o,h=t.x/s+n,l=t.y/o+a;r=Gt.add(r,Gt.NW),this.x0=h+n*Gt.uX(r),this.y0=l+a*Gt.uY(r),r=Gt.add(r,2),this.x1=h+n*Gt.uX(r),this.y1=l+a*Gt.uY(r),r=Gt.add(r,2),this.x2=h+n*Gt.uX(r),this.y2=l+a*Gt.uY(r),r=Gt.add(r,2),this.x3=h+n*Gt.uX(r),this.y3=l+a*Gt.uY(r)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};_s.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var $P=new _s;function Hu(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var Rh=class i extends hs.default{constructor(t,e,r,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof i&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=$P,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new ee(n.x,n.y):new ee(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&je[e.url]&&i.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,i.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new i(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===$P&&(this._uvs=new _s),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ut){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${ii()}`,ut.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=je[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ut)?(e.resolution||(e.resolution=Eu(t)),n=new i(new ut(t,e)),n.baseTexture.cacheId=o,ut.addToCache(n.baseTexture,o),i.addToCache(n,o)):!n&&t instanceof ut&&(n=new i(t),i.addToCache(n,o)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),s=i.from(t,Object.assign({resourceOptions:r},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,r,s){return new i(ut.fromBuffer(t,e,r,s))}static fromLoader(t,e,r,s){let o=new ut(t,Object.assign({scaleMode:ut.defaultOptions.scaleMode,resolution:Eu(e)},s)),{resource:n}=o;n instanceof xs&&(n.url=e);let a=new i(o);return r||(r=e),ut.addToCache(a.baseTexture,r),i.addToCache(a,r),r!==e&&(ut.addToCache(a.baseTexture,e),i.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),je[e]&&je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),je[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=je[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete je[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)je[t.textureCacheIds[e]]===t&&delete je[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:r,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=r+o>this.baseTexture.height;if(n||a){let h=n&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${r} + ${o} = ${r+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return i._EMPTY||(i._EMPTY=new i(new ut),Hu(i._EMPTY),Hu(i._EMPTY.baseTexture)),i._EMPTY}static get WHITE(){if(!i._WHITE){let t=Y.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),i._WHITE=new i(ut.from(t)),Hu(i._WHITE),Hu(i._WHITE.baseTexture)}return i._WHITE}};var ys=class i extends Rh{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,r=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,r&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new i(new gs(t))}};var jo=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=Ct.NONE){let s=new gs(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new ys(s)}getOptimalTexture(t,e,r=1,s=Ct.NONE){let o;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=as(t),e=as(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(r),n}getFilterTexture(t,e,r){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};jo.SCREEN_KEY=-1;var Mh=class extends si{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Bh=class extends si{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new te(this.vertices),this.uvBuffer=new te(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,s=0;return this.uvs[0]=r,this.uvs[1]=s,this.uvs[2]=r+e.width/t.width,this.uvs[3]=s,this.uvs[4]=r+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=r,this.uvs[7]=s+e.height/t.height,r=e.x,s=e.y,this.vertices[0]=r,this.vertices[1]=s,this.vertices[2]=r+e.width,this.vertices[3]=s,this.vertices[4]=r+e.width,this.vertices[5]=s+e.height,this.vertices[6]=r,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Ih=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ct.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Vu=[new ee,new ee,new ee,new ee],jg=new Bt,Yo=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new jo,this.statePool=[],this.quad=new Mh,this.quadUv=new Bh,this.tempRect=new pt,this.activeState={},this.globalUniforms=new qe({outputFrame:new pt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let r=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Ih,n=r.renderTexture,a,h;if(n.current){let g=n.current;a=g.resolution,h=g.multisample}else a=r.resolution,h=r.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){let b=e[g];l=Math.min(l,b.resolution||a),c=Math.min(c,b.multisample??h),u=this.useMaxPadding?Math.max(u,b.padding):u+b.padding,d=d&&b.autoFit,f=f||(b.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=l,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);r.projection.transform&&this.transformAABB(jg.copyFrom(r.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,l,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=r.projection.transform,r.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),r.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,h.renderTexture,Ci.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[u].apply(this,l,c,Ci.CLEAR,e);let d=l;l=c,c=d}r[u].apply(this,l,h.renderTexture,Ci.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ci.CLEAR){let{renderTexture:r,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,r.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Ci.CLEAR||e===Ci.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(r,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ro.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ro.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,r.x,r.y),a=e.worldTransform.copyTo(Bt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,s=Ct.NONE){return this.texturePool.getOptimalTexture(t,e,r,s)}getFilterTexture(t,e,r){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let r=Vu[0],s=Vu[1],o=Vu[2],n=Vu[3];r.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(r,r),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(r.x,s.x,o.x,n.x),h=Math.min(r.y,s.y,o.y,n.y),l=Math.max(r.x,s.x,o.x,n.x),c=Math.max(r.y,s.y,o.y,n.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,r,s,o){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(o){let{a:n,b:a,c:h,d:l}=o;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4))return}o=o?jg.copyFrom(o):jg.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};Yo.extension={type:V.RendererSystem,name:"filter"};q.add(Yo);var Fh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ct.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var fU=new pt,qo=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Mi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=r),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>r,a=e.height>>r,h=n/e.width;this.setViewport(e.x*h,e.y*h,n,a)}else{let n=t.width>>r,a=t.height>>r;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,r,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),s=Math.round(s),(o.width!==r||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=r,o.height=s,this.gl.viewport(t,e,r,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,r,s,o=iu.COLOR|iu.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,r=new Fh(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),n===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:r}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;r.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let h=0;h<n;h++){let l=o[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,s.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,s.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+h))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let h=t.depthTexture;this.renderer.texture.bind(h,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||r.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH_STENCIL):t.depth&&t.stencil?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH24_STENCIL8):t.depth?(h=r.DEPTH_ATTACHMENT,l=r.DEPTH_COMPONENT24):(h=r.STENCIL_ATTACHMENT,l=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,l,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,l,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,h,r.RENDERBUFFER,s.stencil)}else s.stencil&&(r.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,r=Ct.NONE;if(t<=1||e===null)return r;for(let s=0;s<e.length;s++)if(e[s]<=t){r=e[s];break}return r===1&&(r=Ct.NONE),r}blit(t,e,r){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Mi(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=fU,e.width=s.width,e.height=s.height),r||(r=e);let l=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,h.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let r=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,h;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,h=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,h,r,s):o.renderbufferStorage(o.RENDERBUFFER,h,r,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}};qo.extension={type:V.RendererSystem,name:"framebuffer"};q.add(qo);var Yg={5126:4,5123:2,5121:1},Ko=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let r=this.renderer.context.extensions.vertexArrayObject;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=s=>r.bindVertexArrayOES(s),t.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,h)=>r.drawElementsInstancedANGLE(s,o,n,a,h),t.drawArraysInstanced=(s,o,n,a)=>r.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:r}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.update(s)}}checkCompatibility(t,e){let r=t.attributes,s=e.attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,r=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID],c=l[h];if(c)return l[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Yg[d[m].type];for(let m in d){let g=d[m],b=g.size;g.stride===void 0&&(f[g.buffer]===b*Yg[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=b*Yg[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){let g=u[m];n.bind(g),r&&g._glBuffers[o].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),n.unbind(De.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!r){if(n)for(let a=0;a<o.length;a++){let h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in r)if(a[0]==="g"){let h=r[a];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let h=null;for(let l in a){let c=a[l],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(o.bind(u),h=d);let f=e.attributeData[l].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,h,(r||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,h,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,r,e||n.getSize(),s||1):o.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Ko.extension={type:V.RendererSystem,name:"geometry"};q.add(Ko);var XP=new Bt,Gh=class{constructor(t,e){this._texture=t,this.mapCoord=new Bt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let s=e.orig,o=e.trim;o&&(XP.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(XP));let n=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/n.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/n.width,a[1]=(e._frame.y+h+l)/n.height,a[2]=(e._frame.x+e._frame.width-h+l)/n.width,a[3]=(e._frame.y+e._frame.height-h+l)/n.height,this.uClampOffset[0]=l/n.realWidth,this.uClampOffset[1]=l/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var jP=`varying vec2 vMaskCoord;
|
|
1517
|
+
`;var Xg=class Ph extends ps{constructor(t,e,r){let s=cr.from(t||Ph.defaultVertexSrc,e||Ph.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=Ph.defaultResolution,this.multisample=Ph.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Dr}apply(t,e,r,s,o){t.applyFilter(this,e,r,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return WP}static get defaultFragmentSrc(){return VP}};Xg.defaultResolution=1,Xg.defaultMultisample=Ct.NONE;var Hr=Xg;var ai=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new vr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:s}=t,o=r??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};ai.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ai.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"background"};q.add(ai);var Xo=class{constructor(t){this.renderer=t,this.emptyRenderer=new ms(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:r}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=r[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,r,s){let{elements:o,ids:n,count:a}=t,h=0;for(let l=0;l<a;l++){let c=o[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[l]=u;continue}for(;h<s;){let d=e[h];if(d&&d._batchEnabled===r&&d._batchLocation===h){h++;continue}n[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}};Xo.extension={type:V.RendererSystem,name:"batch"};q.add(Xo);var zP=0,hi=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let r;if(Y.PREFER_ENV>=$e.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};hi.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},hi.extension={type:V.RendererSystem,name:"context"};q.add(hi);var Mi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new jt("disposeFramebuffer"),this.multisample=Ct.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ut(null,{scaleMode:ar.NEAREST,resolution:1,mipmap:yr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ut(null,{scaleMode:ar.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:yr.OFF,format:U.DEPTH_COMPONENT,type:rt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let r=0;r<this.colorTextures.length;r++){let s=this.colorTextures[r],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var gs=class extends ut{constructor(t={}){if(typeof t=="number"){let e=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:r,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Ct.NONE),super(null,t),this.mipmap=yr.OFF,this.valid=!0,this._clear=new vr([0,0,0,0]),this.framebuffer=new Mi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var ne=class extends Ye{constructor(t){let e=t,r=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(r,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=Rg(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&r.width===n&&r.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,r.type,s):(r.width=n,r.height=a,o.texImage2D(e.target,0,r.internalFormat,e.format,r.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}};var xs=class extends ne{constructor(t,e){if(e=e||{},typeof t=="string"){let r=new Image;ne.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??Y.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,r)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{r(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==r&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var _s=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,r){let s=e.width,o=e.height;if(r){let n=t.width/2/s,a=t.height/2/o,h=t.x/s+n,l=t.y/o+a;r=Gt.add(r,Gt.NW),this.x0=h+n*Gt.uX(r),this.y0=l+a*Gt.uY(r),r=Gt.add(r,2),this.x1=h+n*Gt.uX(r),this.y1=l+a*Gt.uY(r),r=Gt.add(r,2),this.x2=h+n*Gt.uX(r),this.y2=l+a*Gt.uY(r),r=Gt.add(r,2),this.x3=h+n*Gt.uX(r),this.y3=l+a*Gt.uY(r)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};_s.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var $P=new _s;function Hu(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var Rh=class i extends hs.default{constructor(t,e,r,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof i&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=$P,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new ee(n.x,n.y):new ee(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&je[e.url]&&i.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,i.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new i(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===$P&&(this._uvs=new _s),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ut){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${ii()}`,ut.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=je[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ut)?(e.resolution||(e.resolution=Eu(t)),n=new i(new ut(t,e)),n.baseTexture.cacheId=o,ut.addToCache(n.baseTexture,o),i.addToCache(n,o)):!n&&t instanceof ut&&(n=new i(t),i.addToCache(n,o)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),s=i.from(t,Object.assign({resourceOptions:r},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,r,s){return new i(ut.fromBuffer(t,e,r,s))}static fromLoader(t,e,r,s){let o=new ut(t,Object.assign({scaleMode:ut.defaultOptions.scaleMode,resolution:Eu(e)},s)),{resource:n}=o;n instanceof xs&&(n.url=e);let a=new i(o);return r||(r=e),ut.addToCache(a.baseTexture,r),i.addToCache(a,r),r!==e&&(ut.addToCache(a.baseTexture,e),i.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),je[e]&&je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),je[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=je[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete je[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)je[t.textureCacheIds[e]]===t&&delete je[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:r,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=r+o>this.baseTexture.height;if(n||a){let h=n&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${r} + ${o} = ${r+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return i._EMPTY||(i._EMPTY=new i(new ut),Hu(i._EMPTY),Hu(i._EMPTY.baseTexture)),i._EMPTY}static get WHITE(){if(!i._WHITE){let t=Y.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),i._WHITE=new i(ut.from(t)),Hu(i._WHITE),Hu(i._WHITE.baseTexture)}return i._WHITE}};var ys=class i extends Rh{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,r=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,r&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new i(new gs(t))}};var jo=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=Ct.NONE){let s=new gs(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new ys(s)}getOptimalTexture(t,e,r=1,s=Ct.NONE){let o;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=as(t),e=as(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(r),n}getFilterTexture(t,e,r){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};jo.SCREEN_KEY=-1;var Mh=class extends si{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Bh=class extends si{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new te(this.vertices),this.uvBuffer=new te(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,s=0;return this.uvs[0]=r,this.uvs[1]=s,this.uvs[2]=r+e.width/t.width,this.uvs[3]=s,this.uvs[4]=r+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=r,this.uvs[7]=s+e.height/t.height,r=e.x,s=e.y,this.vertices[0]=r,this.vertices[1]=s,this.vertices[2]=r+e.width,this.vertices[3]=s,this.vertices[4]=r+e.width,this.vertices[5]=s+e.height,this.vertices[6]=r,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Ih=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ct.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Vu=[new ee,new ee,new ee,new ee],jg=new Bt,Yo=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new jo,this.statePool=[],this.quad=new Mh,this.quadUv=new Bh,this.tempRect=new pt,this.activeState={},this.globalUniforms=new qe({outputFrame:new pt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let r=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Ih,n=r.renderTexture,a,h;if(n.current){let g=n.current;a=g.resolution,h=g.multisample}else a=r.resolution,h=r.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){let b=e[g];l=Math.min(l,b.resolution||a),c=Math.min(c,b.multisample??h),u=this.useMaxPadding?Math.max(u,b.padding):u+b.padding,d=d&&b.autoFit,f=f||(b.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=l,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);r.projection.transform&&this.transformAABB(jg.copyFrom(r.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,l,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=r.projection.transform,r.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),r.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,h.renderTexture,Ci.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[u].apply(this,l,c,Ci.CLEAR,e);let d=l;l=c,c=d}r[u].apply(this,l,h.renderTexture,Ci.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ci.CLEAR){let{renderTexture:r,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,r.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Ci.CLEAR||e===Ci.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(r,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ro.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ro.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,r.x,r.y),a=e.worldTransform.copyTo(Bt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,s=Ct.NONE){return this.texturePool.getOptimalTexture(t,e,r,s)}getFilterTexture(t,e,r){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let r=Vu[0],s=Vu[1],o=Vu[2],n=Vu[3];r.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(r,r),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(r.x,s.x,o.x,n.x),h=Math.min(r.y,s.y,o.y,n.y),l=Math.max(r.x,s.x,o.x,n.x),c=Math.max(r.y,s.y,o.y,n.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,r,s,o){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(o){let{a:n,b:a,c:h,d:l}=o;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4))return}o=o?jg.copyFrom(o):jg.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};Yo.extension={type:V.RendererSystem,name:"filter"};q.add(Yo);var Fh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ct.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var fU=new pt,qo=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Mi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=r),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>r,a=e.height>>r,h=n/e.width;this.setViewport(e.x*h,e.y*h,n,a)}else{let n=t.width>>r,a=t.height>>r;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,r,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),s=Math.round(s),(o.width!==r||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=r,o.height=s,this.gl.viewport(t,e,r,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,r,s,o=iu.COLOR|iu.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,r=new Fh(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),n===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:r}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;r.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let h=0;h<n;h++){let l=o[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,s.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,s.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+h))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let h=t.depthTexture;this.renderer.texture.bind(h,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||r.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH_STENCIL):t.depth&&t.stencil?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH24_STENCIL8):t.depth?(h=r.DEPTH_ATTACHMENT,l=r.DEPTH_COMPONENT24):(h=r.STENCIL_ATTACHMENT,l=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,l,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,l,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,h,r.RENDERBUFFER,s.stencil)}else s.stencil&&(r.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,r=Ct.NONE;if(t<=1||e===null)return r;for(let s=0;s<e.length;s++)if(e[s]<=t){r=e[s];break}return r===1&&(r=Ct.NONE),r}blit(t,e,r){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Mi(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=fU,e.width=s.width,e.height=s.height),r||(r=e);let l=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,h.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let r=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,h;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,h=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,h,r,s):o.renderbufferStorage(o.RENDERBUFFER,h,r,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}};qo.extension={type:V.RendererSystem,name:"framebuffer"};q.add(qo);var Yg={5126:4,5123:2,5121:1},Ko=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let r=this.renderer.context.extensions.vertexArrayObject;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=s=>r.bindVertexArrayOES(s),t.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,h)=>r.drawElementsInstancedANGLE(s,o,n,a,h),t.drawArraysInstanced=(s,o,n,a)=>r.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:r}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.update(s)}}checkCompatibility(t,e){let r=t.attributes,s=e.attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,r=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID],c=l[h];if(c)return l[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Yg[d[m].type];for(let m in d){let g=d[m],b=g.size;g.stride===void 0&&(f[g.buffer]===b*Yg[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=b*Yg[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){let g=u[m];n.bind(g),r&&g._glBuffers[o].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),n.unbind(De.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!r){if(n)for(let a=0;a<o.length;a++){let h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in r)if(a[0]==="g"){let h=r[a];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let h=null;for(let l in a){let c=a[l],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(o.bind(u),h=d);let f=e.attributeData[l].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,h,(r||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,h,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,r,e||n.getSize(),s||1):o.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Ko.extension={type:V.RendererSystem,name:"geometry"};q.add(Ko);var XP=new Bt,Gh=class{constructor(t,e){this._texture=t,this.mapCoord=new Bt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let s=e.orig,o=e.trim;o&&(XP.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(XP));let n=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/n.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/n.width,a[1]=(e._frame.y+h+l)/n.height,a[2]=(e._frame.x+e._frame.width-h+l)/n.width,a[3]=(e._frame.y+e._frame.height-h+l)/n.height,this.uClampOffset[0]=l/n.realWidth,this.uClampOffset[1]=l/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var jP=`varying vec2 vMaskCoord;
|
|
1518
1518
|
varying vec2 vTextureCoord;
|
|
1519
1519
|
|
|
1520
1520
|
uniform sampler2D uSampler;
|
|
@@ -1625,7 +1625,7 @@ void main(void)
|
|
|
1625
1625
|
`)}}return o.push(`
|
|
1626
1626
|
renderer.buffer.update(buffer);
|
|
1627
1627
|
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
|
|
1628
|
-
`))}}var xU=0,zu={textureCount:0,uboCount:0},Bi=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=xU++}systemCheck(){if(!Du())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(zu.textureCount=0,zu.uboCount=0,this.syncUniformGroup(t.uniformGroup,zu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Vg(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,zu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Zg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Kg(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Bi.extension={type:V.RendererSystem,name:"shader"};q.add(Bi);var li=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};li.defaultOptions={hello:!1},li.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(li);function sR(i,t=[]){return t[Z.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[i.ONE,i.ONE],t[Z.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[Z.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[Z.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[Z.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[Z.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[Z.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[Z.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var _U=0,yU=1,bU=2,vU=3,TU=4,SU=5,oR=class Qg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[_U]=this.setBlend,this.map[yU]=this.setOffset,this.map[bU]=this.setCullFace,this.map[vU]=this.setDepthTest,this.map[TU]=this.setFrontFace,this.map[SU]=this.setDepthMask,this.checks=[],this.defaultState=new Dr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=sR(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Qg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Qg.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};oR.extension={type:V.RendererSystem,name:"state"};var Jg=oR;q.add(Jg);var on=class extends hs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new jt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Dh=class $u{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=$u.defaultMaxIdle,this.checkCountMax=$u.defaultCheckCountMax,this.mode=$u.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==su.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,r=!0)}if(r){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Dh.defaultMode=su.AUTO,Dh.defaultMaxIdle=60*60,Dh.defaultCheckCountMax=60*10,Dh.extension={type:V.RendererSystem,name:"textureGC"};var Vr=Dh;q.add(Vr);var vs=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=rt.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}};function nR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.R8]:D.FLOAT,[i.R8_SNORM]:D.FLOAT,[i.RG8]:D.FLOAT,[i.RG8_SNORM]:D.FLOAT,[i.RGB8]:D.FLOAT,[i.RGB8_SNORM]:D.FLOAT,[i.RGB565]:D.FLOAT,[i.RGBA4]:D.FLOAT,[i.RGB5_A1]:D.FLOAT,[i.RGBA8]:D.FLOAT,[i.RGBA8_SNORM]:D.FLOAT,[i.RGB10_A2]:D.FLOAT,[i.RGB10_A2UI]:D.FLOAT,[i.SRGB8]:D.FLOAT,[i.SRGB8_ALPHA8]:D.FLOAT,[i.R16F]:D.FLOAT,[i.RG16F]:D.FLOAT,[i.RGB16F]:D.FLOAT,[i.RGBA16F]:D.FLOAT,[i.R32F]:D.FLOAT,[i.RG32F]:D.FLOAT,[i.RGB32F]:D.FLOAT,[i.RGBA32F]:D.FLOAT,[i.R11F_G11F_B10F]:D.FLOAT,[i.RGB9_E5]:D.FLOAT,[i.R8I]:D.INT,[i.R8UI]:D.UINT,[i.R16I]:D.INT,[i.R16UI]:D.UINT,[i.R32I]:D.INT,[i.R32UI]:D.UINT,[i.RG8I]:D.INT,[i.RG8UI]:D.UINT,[i.RG16I]:D.INT,[i.RG16UI]:D.UINT,[i.RG32I]:D.INT,[i.RG32UI]:D.UINT,[i.RGB8I]:D.INT,[i.RGB8UI]:D.UINT,[i.RGB16I]:D.INT,[i.RGB16UI]:D.UINT,[i.RGB32I]:D.INT,[i.RGB32UI]:D.UINT,[i.RGBA8I]:D.INT,[i.RGBA8UI]:D.UINT,[i.RGBA16I]:D.INT,[i.RGBA16UI]:D.UINT,[i.RGBA32I]:D.INT,[i.RGBA32UI]:D.UINT,[i.DEPTH_COMPONENT16]:D.FLOAT,[i.DEPTH_COMPONENT24]:D.FLOAT,[i.DEPTH_COMPONENT32F]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT,[i.DEPTH24_STENCIL8]:D.FLOAT,[i.DEPTH32F_STENCIL8]:D.FLOAT}:t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT},t}function aR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[rt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA8,[G.RGB]:i.RGB8,[G.RG]:i.RG8,[G.RED]:i.R8,[G.RGBA_INTEGER]:i.RGBA8UI,[G.RGB_INTEGER]:i.RGB8UI,[G.RG_INTEGER]:i.RG8UI,[G.RED_INTEGER]:i.R8UI,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.BYTE]:{[G.RGBA]:i.RGBA8_SNORM,[G.RGB]:i.RGB8_SNORM,[G.RG]:i.RG8_SNORM,[G.RED]:i.R8_SNORM,[G.RGBA_INTEGER]:i.RGBA8I,[G.RGB_INTEGER]:i.RGB8I,[G.RG_INTEGER]:i.RG8I,[G.RED_INTEGER]:i.R8I},[rt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:i.RGBA16UI,[G.RGB_INTEGER]:i.RGB16UI,[G.RG_INTEGER]:i.RG16UI,[G.RED_INTEGER]:i.R16UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[rt.SHORT]:{[G.RGBA_INTEGER]:i.RGBA16I,[G.RGB_INTEGER]:i.RGB16I,[G.RG_INTEGER]:i.RG16I,[G.RED_INTEGER]:i.R16I},[rt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:i.RGBA32UI,[G.RGB_INTEGER]:i.RGB32UI,[G.RG_INTEGER]:i.RG32UI,[G.RED_INTEGER]:i.R32UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[rt.INT]:{[G.RGBA_INTEGER]:i.RGBA32I,[G.RGB_INTEGER]:i.RGB32I,[G.RG_INTEGER]:i.RG32I,[G.RED_INTEGER]:i.R32I},[rt.FLOAT]:{[G.RGBA]:i.RGBA32F,[G.RGB]:i.RGB32F,[G.RG]:i.RG32F,[G.RED]:i.R32F,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[rt.HALF_FLOAT]:{[G.RGBA]:i.RGBA16F,[G.RGB]:i.RGB16F,[G.RG]:i.RG16F,[G.RED]:i.R16F},[rt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB565},[rt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA4},[rt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGB5_A1},[rt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:i.RGB10_A2,[G.RGBA_INTEGER]:i.RGB10_A2UI},[rt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:i.R11F_G11F_B10F},[rt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:i.RGB9_E5},[rt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[rt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[rt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA,[G.RGB]:i.RGB,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB},[rt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA},[rt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGBA}},t}var nn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=aR(t),this.samplerTypes=nR(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let r=new vs(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new vs(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==D.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new vs(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??D.FLOAT,this.webGLVersion===2&&t.type===rt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==D.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&Pg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===yr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ih.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==yr.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===ar.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"texture"};q.add(nn);var an=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(r.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};an.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(an);var ci=class{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};ci.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ci.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(ci);Y.PREFER_ENV=$e.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...hi.defaultOptions,...ai.defaultOptions,...ci.defaultOptions,...li.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Hr.defaultResolution},set(i){Hr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Hr.defaultMultisample},set(i){Hr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ni.defaultMaxTextures},set(i){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ni.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ni.defaultBatchSize},set(i){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ni.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ni.canUploadSameBuffer},set(i){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ni.canUploadSameBuffer=i}},GC_MODE:{get(){return Vr.defaultMode},set(i){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Vr.defaultMode=i}},GC_MAX_IDLE:{get(){return Vr.defaultMaxIdle},set(i){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Vr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Vr.defaultCheckCountMax},set(i){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Vr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return cr.defaultVertexPrecision},set(i){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),cr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return cr.defaultFragmentPrecision},set(i){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),cr.defaultFragmentPrecision=i}}});var Ts=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ts||{});var hn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var hR=class Ke{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new hn(null,null,1/0),this.deltaMS=1/Ke.targetFPMS,this.elapsedMS=1/Ke.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r))}addOnce(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ke.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ke.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ke._shared){let t=Ke._shared=new Ke;t.autoStart=!0,t._protected=!0}return Ke._shared}static get system(){if(!Ke._system){let t=Ke._system=new Ke;t.autoStart=!0,t._protected=!0}return Ke._system}};hR.targetFPMS=.06;var ur=hR;Object.defineProperties(Y,{TARGET_FPMS:{get(){return ur.targetFPMS},set(i){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ur.targetFPMS=i}}});var Nh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ts.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ur.shared:new ur,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nh.extension=V.Application;q.add(Nh);var EU=[];q.handleByList(V.Renderer,EU);var Hh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=Ct.HIGH?this.multisample=Ct.HIGH:e>=Ct.MEDIUM?this.multisample=Ct.MEDIUM:e>=Ct.LOW?this.multisample=Ct.LOW:this.multisample=Ct.NONE}destroy(){}};Hh.extension={type:V.RendererSystem,name:"_multisample"};q.add(Hh);var Xu=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Vh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new Xu(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Vh.extension={type:V.RendererSystem,name:"buffer"};q.add(Vh);var Wh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(Wh);var ju=class tx extends on{constructor(t){super(),this.type=Wm.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new qe({projectionMatrix:new Bt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:tx.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=tx.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:wg()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ju.extension={type:V.Renderer,priority:1},ju.__plugins={},ju.__systems={};var Yu=ju;q.handleByMap(V.RendererPlugin,Yu.__plugins);q.handleByMap(V.RendererSystem,Yu.__systems);q.add(Yu);var Ii=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof Ye?this.addResourceAt(t[r],r):this.addResourceAt(Vo(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var zh=class extends Ii{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ei.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var $h=class extends ne{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var lR=class Xh extends Ii{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Xh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Xh.SIDES;a++)this.items[a].target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=ei.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){let s=this.itemDirtyIds;for(let o=0;o<Xh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xh.SIDES}};lR.SIDES=6;var ex=lR;var jh=class i extends ne{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let r=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return i._EMPTY=i._EMPTY??Y.ADAPTER.createCanvas(0,0),i._EMPTY}};var rx=class qu extends ne{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},qu.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;ne.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${ii()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=qu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&qu.SVG_XML.test(t)}};rx.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,rx.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ix=rx;var Ku=class extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var sx=class ox extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ne.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ox.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=ur.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ur.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||ox.TYPES.includes(e)}};sx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],sx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var nx=sx;_h.push(jh,xs,$h,nx,Ku,ix,ls,ex,zh);var AU={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},wU={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function cR(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,h.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],h.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,h.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?AU:wU)[c.type].call(null,h,d.location,d.value,u)}}function CU(){Object.assign(Bi.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;cR(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}CU();var Yh=new(window.AudioContext||window.webkitAudioContext),PU=(i,t)=>{let e,r=Yh.createGain();r.gain.value=t.volume??1,r.connect(Yh.destination);let s={id:i,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Ao.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Yh.createBufferSource(),e.buffer=m,e.loop=s.loop,r.gain.setValueAtTime(s.volume,Yh.currentTime),e.connect(r),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),r.disconnect(),r.connect(Yh.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,r.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:r}},uR=()=>{let i=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=i.find(c=>c.id===h.id);if(!l){let c=PU(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});i.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of i)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));i=i.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of i)a.stop();i=[],t=[]}}};var RU=({JSONObject:i,parserPlugins:t=[]})=>i.map(r=>{let s=t.find(o=>o.type===r.type);return s?s.parse({state:r,parserPlugins:t}):i}),ax=RU;var dR=({type:i,parse:t})=>({type:i,parse:t});var MU=i=>i.split("/").pop(),BU=i=>({name:"advancedBufferLoader",priority:2,bufferMap:i,load:async t=>{let e=t.startsWith("file:")?t:MU(t),r=i[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}},test:async t=>!0,testParse:async t=>!0,parse:async t=>{if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)},unload:async t=>t.destroy(!0)}),IU=()=>{let i,t=uR(),e={elements:[],animations:[],audio:[]},r,s={animations:[],elements:[],audios:[],parsers:[]},o,n=!1,a,h=d=>d?d.startsWith("audio/")?"audio":d.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(d)?"font":"texture":"texture",l=(d,f,p)=>{d.renderer.events.cursorStyles||(d.renderer.events.cursorStyles={}),d.renderer.events.cursorStyles.default||(d.renderer.events.cursorStyles.default="default"),d.renderer.events.cursorStyles.hover||(d.renderer.events.cursorStyles.hover="pointer");let m=f?.cursorStyles,g=p?.cursorStyles;JSON.stringify(m)!==JSON.stringify(g)&&(g?(g.default&&(d.renderer.events.cursorStyles.default=g.default,d.canvas.style.cursor=g.default),g.hover&&(d.renderer.events.cursorStyles.hover=g.hover)):m&&(d.renderer.events.cursorStyles.default="default",d.renderer.events.cursorStyles.hover="pointer"))},c=async(d,f,p,m)=>{l(d,e.global,p.global),o&&n&&o.abort(),o=new AbortController;let g=o.signal;for(;n;)await new Promise(b=>setTimeout(b,0));n=!0,await rh({app:d,parent:f,prevASTTree:e.elements,nextASTTree:p.elements,animations:p.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:m,signal:g}),await Vm({app:d,prevAudioTree:e.audio,nextAudioTree:p.audio,audioPlugins:s.audios,signal:g}),n=!1,e=p},u={rendererName:"pixi",get canvas(){return i.canvas},get ticker(){return i.ticker},findElementByLabel:d=>{if(i.stage.children&&i.stage.children.length>0)for(let f of i.stage.children){let p=findElementByLabel(f,d);if(p)return p}return null},extractBase64:async d=>{await i.renderer.extract.base64(d)},assignStageEvent:(d,f)=>{i.stage.eventMode="static",i.stage.on(d,f)},init:async d=>{let{eventHandler:f,plugins:p,width:m,height:g,backgroundColor:b}=d,_=[];p?.elements?.forEach(T=>{T?.parse&&_.push(dR({type:T.type,parse:T.parse}))}),s={animations:p.animations??[],elements:p.elements??[],audios:p.audios??[],parsers:_},r=f,i=new Ja,i.audioStage=t,await i.init({width:m,height:g,backgroundColor:b,preference:"webgl"});let v=new xr;return v.rect(0,0,m,g),v.fill(b||0),i.stage.addChild(v),i.stage.width=m,i.stage.height=g,i.ticker.add(i.audioStage.tick),u},destroy:()=>{i.audioStage.destroy(),i.destroy()},loadAssets:async d=>{if(!d)throw new Error("assetBufferMap is required");let f={audio:{},font:{},texture:{}};for(let[m,g]of Object.entries(d)){let b=h(g.type);f[b][m]=g}await Promise.all(Object.entries(f.audio).map(([m,g])=>Ao.load(m,g.buffer))),await Promise.all(Object.entries(f.font).map(async([m,g])=>{let b=new Blob([g.buffer],{type:g.type}),_=URL.createObjectURL(b),v=new FontFace(m,`url(${_})`);try{await v.load(),document.fonts.add(v)}catch(T){console.error(`Failed to load font ${m}:`,T)}finally{URL.revokeObjectURL(_)}})),a?Object.assign(a.bufferMap,f.texture):(a=BU(f.texture),or.loader.parsers.length=0,or.reset(),F.add({name:"advanced-buffer-loader",extension:y.Asset,priority:le.High,loader:a}),typeof or.registerPlugin=="function"&&or.registerPlugin(a));let p=Object.keys(f.texture);return Promise.all(p.map(m=>or.load(m)))},loadAudioAssets:async d=>Promise.all(d.map(async f=>{let m=await(await fetch(f)).arrayBuffer();return Ao.load(f,m)})),updatedBackgroundColor:d=>{i.renderer.background.color=d},render:d=>{let f=ax({JSONObject:d.elements,parserPlugins:s.parsers}),p={...d,elements:f};c(i,i.stage,p,r)},parse:d=>{let f=ax({JSONObject:d.elements,parserPlugins:s.parsers});return{...d,elements:f}}};return u},fR=IU;var pbt=fR;export{Ja as Application,or as Assets,Ao as AudioAsset,jI as containerPlugin,Dm as createAnimationPlugin,TR as createAssetBufferManager,Nm as createAudioPlugin,ze as createElementPlugin,pbt as default,VI as rectPlugin,Vm as renderAudio,rh as renderElements,zI as sliderPlugin,oF as soundPlugin,WI as spritePlugin,HI as textPlugin,KI as textRevealingPlugin,sF as tweenPlugin};
|
|
1628
|
+
`))}}var xU=0,zu={textureCount:0,uboCount:0},Bi=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=xU++}systemCheck(){if(!Du())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(zu.textureCount=0,zu.uboCount=0,this.syncUniformGroup(t.uniformGroup,zu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Vg(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,zu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Zg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Kg(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Bi.extension={type:V.RendererSystem,name:"shader"};q.add(Bi);var li=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};li.defaultOptions={hello:!1},li.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(li);function sR(i,t=[]){return t[Z.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[i.ONE,i.ONE],t[Z.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[Z.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[Z.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[Z.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[Z.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[Z.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[Z.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var _U=0,yU=1,bU=2,vU=3,TU=4,SU=5,oR=class Qg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[_U]=this.setBlend,this.map[yU]=this.setOffset,this.map[bU]=this.setCullFace,this.map[vU]=this.setDepthTest,this.map[TU]=this.setFrontFace,this.map[SU]=this.setDepthMask,this.checks=[],this.defaultState=new Dr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=sR(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Qg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Qg.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};oR.extension={type:V.RendererSystem,name:"state"};var Jg=oR;q.add(Jg);var on=class extends hs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new jt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Dh=class $u{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=$u.defaultMaxIdle,this.checkCountMax=$u.defaultCheckCountMax,this.mode=$u.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==su.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,r=!0)}if(r){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Dh.defaultMode=su.AUTO,Dh.defaultMaxIdle=60*60,Dh.defaultCheckCountMax=60*10,Dh.extension={type:V.RendererSystem,name:"textureGC"};var Vr=Dh;q.add(Vr);var vs=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=rt.UNSIGNED_BYTE,this.internalFormat=U.RGBA,this.samplerType=0}};function nR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:N.FLOAT,[i.RGBA]:N.FLOAT,[i.ALPHA]:N.FLOAT,[i.LUMINANCE]:N.FLOAT,[i.LUMINANCE_ALPHA]:N.FLOAT,[i.R8]:N.FLOAT,[i.R8_SNORM]:N.FLOAT,[i.RG8]:N.FLOAT,[i.RG8_SNORM]:N.FLOAT,[i.RGB8]:N.FLOAT,[i.RGB8_SNORM]:N.FLOAT,[i.RGB565]:N.FLOAT,[i.RGBA4]:N.FLOAT,[i.RGB5_A1]:N.FLOAT,[i.RGBA8]:N.FLOAT,[i.RGBA8_SNORM]:N.FLOAT,[i.RGB10_A2]:N.FLOAT,[i.RGB10_A2UI]:N.FLOAT,[i.SRGB8]:N.FLOAT,[i.SRGB8_ALPHA8]:N.FLOAT,[i.R16F]:N.FLOAT,[i.RG16F]:N.FLOAT,[i.RGB16F]:N.FLOAT,[i.RGBA16F]:N.FLOAT,[i.R32F]:N.FLOAT,[i.RG32F]:N.FLOAT,[i.RGB32F]:N.FLOAT,[i.RGBA32F]:N.FLOAT,[i.R11F_G11F_B10F]:N.FLOAT,[i.RGB9_E5]:N.FLOAT,[i.R8I]:N.INT,[i.R8UI]:N.UINT,[i.R16I]:N.INT,[i.R16UI]:N.UINT,[i.R32I]:N.INT,[i.R32UI]:N.UINT,[i.RG8I]:N.INT,[i.RG8UI]:N.UINT,[i.RG16I]:N.INT,[i.RG16UI]:N.UINT,[i.RG32I]:N.INT,[i.RG32UI]:N.UINT,[i.RGB8I]:N.INT,[i.RGB8UI]:N.UINT,[i.RGB16I]:N.INT,[i.RGB16UI]:N.UINT,[i.RGB32I]:N.INT,[i.RGB32UI]:N.UINT,[i.RGBA8I]:N.INT,[i.RGBA8UI]:N.UINT,[i.RGBA16I]:N.INT,[i.RGBA16UI]:N.UINT,[i.RGBA32I]:N.INT,[i.RGBA32UI]:N.UINT,[i.DEPTH_COMPONENT16]:N.FLOAT,[i.DEPTH_COMPONENT24]:N.FLOAT,[i.DEPTH_COMPONENT32F]:N.FLOAT,[i.DEPTH_STENCIL]:N.FLOAT,[i.DEPTH24_STENCIL8]:N.FLOAT,[i.DEPTH32F_STENCIL8]:N.FLOAT}:t={[i.RGB]:N.FLOAT,[i.RGBA]:N.FLOAT,[i.ALPHA]:N.FLOAT,[i.LUMINANCE]:N.FLOAT,[i.LUMINANCE_ALPHA]:N.FLOAT,[i.DEPTH_STENCIL]:N.FLOAT},t}function aR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA8,[U.RGB]:i.RGB8,[U.RG]:i.RG8,[U.RED]:i.R8,[U.RGBA_INTEGER]:i.RGBA8UI,[U.RGB_INTEGER]:i.RGB8UI,[U.RG_INTEGER]:i.RG8UI,[U.RED_INTEGER]:i.R8UI,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.BYTE]:{[U.RGBA]:i.RGBA8_SNORM,[U.RGB]:i.RGB8_SNORM,[U.RG]:i.RG8_SNORM,[U.RED]:i.R8_SNORM,[U.RGBA_INTEGER]:i.RGBA8I,[U.RGB_INTEGER]:i.RGB8I,[U.RG_INTEGER]:i.RG8I,[U.RED_INTEGER]:i.R8I},[rt.UNSIGNED_SHORT]:{[U.RGBA_INTEGER]:i.RGBA16UI,[U.RGB_INTEGER]:i.RGB16UI,[U.RG_INTEGER]:i.RG16UI,[U.RED_INTEGER]:i.R16UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[rt.SHORT]:{[U.RGBA_INTEGER]:i.RGBA16I,[U.RGB_INTEGER]:i.RGB16I,[U.RG_INTEGER]:i.RG16I,[U.RED_INTEGER]:i.R16I},[rt.UNSIGNED_INT]:{[U.RGBA_INTEGER]:i.RGBA32UI,[U.RGB_INTEGER]:i.RGB32UI,[U.RG_INTEGER]:i.RG32UI,[U.RED_INTEGER]:i.R32UI,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[rt.INT]:{[U.RGBA_INTEGER]:i.RGBA32I,[U.RGB_INTEGER]:i.RGB32I,[U.RG_INTEGER]:i.RG32I,[U.RED_INTEGER]:i.R32I},[rt.FLOAT]:{[U.RGBA]:i.RGBA32F,[U.RGB]:i.RGB32F,[U.RG]:i.RG32F,[U.RED]:i.R32F,[U.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[rt.HALF_FLOAT]:{[U.RGBA]:i.RGBA16F,[U.RGB]:i.RGB16F,[U.RG]:i.RG16F,[U.RED]:i.R16F},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB565},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA4},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGB5_A1},[rt.UNSIGNED_INT_2_10_10_10_REV]:{[U.RGBA]:i.RGB10_A2,[U.RGBA_INTEGER]:i.RGB10_A2UI},[rt.UNSIGNED_INT_10F_11F_11F_REV]:{[U.RGB]:i.R11F_G11F_B10F},[rt.UNSIGNED_INT_5_9_9_9_REV]:{[U.RGB]:i.RGB9_E5},[rt.UNSIGNED_INT_24_8]:{[U.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[rt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[U.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[rt.UNSIGNED_BYTE]:{[U.RGBA]:i.RGBA,[U.RGB]:i.RGB,[U.ALPHA]:i.ALPHA,[U.LUMINANCE]:i.LUMINANCE,[U.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.UNSIGNED_SHORT_5_6_5]:{[U.RGB]:i.RGB},[rt.UNSIGNED_SHORT_4_4_4_4]:{[U.RGBA]:i.RGBA},[rt.UNSIGNED_SHORT_5_5_5_1]:{[U.RGBA]:i.RGBA}},t}var nn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=aR(t),this.samplerTypes=nR(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let r=new vs(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new vs(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==N.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new vs(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??N.FLOAT,this.webGLVersion===2&&t.type===rt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==N.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&Pg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===yr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ih.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==yr.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===ar.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"texture"};q.add(nn);var an=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(r.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};an.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(an);var ci=class{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};ci.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ci.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(ci);Y.PREFER_ENV=$e.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...hi.defaultOptions,...ai.defaultOptions,...ci.defaultOptions,...li.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Hr.defaultResolution},set(i){Hr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Hr.defaultMultisample},set(i){Hr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ni.defaultMaxTextures},set(i){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ni.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ni.defaultBatchSize},set(i){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ni.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ni.canUploadSameBuffer},set(i){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ni.canUploadSameBuffer=i}},GC_MODE:{get(){return Vr.defaultMode},set(i){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Vr.defaultMode=i}},GC_MAX_IDLE:{get(){return Vr.defaultMaxIdle},set(i){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Vr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Vr.defaultCheckCountMax},set(i){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Vr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return cr.defaultVertexPrecision},set(i){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),cr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return cr.defaultFragmentPrecision},set(i){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),cr.defaultFragmentPrecision=i}}});var Ts=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ts||{});var hn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var hR=class Ke{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new hn(null,null,1/0),this.deltaMS=1/Ke.targetFPMS,this.elapsedMS=1/Ke.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r))}addOnce(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ke.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ke.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ke._shared){let t=Ke._shared=new Ke;t.autoStart=!0,t._protected=!0}return Ke._shared}static get system(){if(!Ke._system){let t=Ke._system=new Ke;t.autoStart=!0,t._protected=!0}return Ke._system}};hR.targetFPMS=.06;var ur=hR;Object.defineProperties(Y,{TARGET_FPMS:{get(){return ur.targetFPMS},set(i){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ur.targetFPMS=i}}});var Nh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ts.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ur.shared:new ur,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nh.extension=V.Application;q.add(Nh);var EU=[];q.handleByList(V.Renderer,EU);var Hh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=Ct.HIGH?this.multisample=Ct.HIGH:e>=Ct.MEDIUM?this.multisample=Ct.MEDIUM:e>=Ct.LOW?this.multisample=Ct.LOW:this.multisample=Ct.NONE}destroy(){}};Hh.extension={type:V.RendererSystem,name:"_multisample"};q.add(Hh);var Xu=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Vh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new Xu(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Vh.extension={type:V.RendererSystem,name:"buffer"};q.add(Vh);var Wh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(Wh);var ju=class tx extends on{constructor(t){super(),this.type=Wm.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new qe({projectionMatrix:new Bt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:tx.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=tx.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:wg()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ju.extension={type:V.Renderer,priority:1},ju.__plugins={},ju.__systems={};var Yu=ju;q.handleByMap(V.RendererPlugin,Yu.__plugins);q.handleByMap(V.RendererSystem,Yu.__systems);q.add(Yu);var Ii=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof Ye?this.addResourceAt(t[r],r):this.addResourceAt(Vo(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var zh=class extends Ii{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ei.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var $h=class extends ne{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var lR=class Xh extends Ii{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Xh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Xh.SIDES;a++)this.items[a].target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=ei.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){let s=this.itemDirtyIds;for(let o=0;o<Xh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xh.SIDES}};lR.SIDES=6;var ex=lR;var jh=class i extends ne{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let r=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return i._EMPTY=i._EMPTY??Y.ADAPTER.createCanvas(0,0),i._EMPTY}};var rx=class qu extends ne{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},qu.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;ne.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${ii()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=qu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&qu.SVG_XML.test(t)}};rx.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,rx.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ix=rx;var Ku=class extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var sx=class ox extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ne.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ox.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=ur.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ur.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||ox.TYPES.includes(e)}};sx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],sx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var nx=sx;_h.push(jh,xs,$h,nx,Ku,ix,ls,ex,zh);var AU={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},wU={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function cR(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,h.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],h.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,h.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?AU:wU)[c.type].call(null,h,d.location,d.value,u)}}function CU(){Object.assign(Bi.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;cR(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}CU();var Yh=new(window.AudioContext||window.webkitAudioContext),PU=(i,t)=>{let e,r=Yh.createGain();r.gain.value=t.volume??1,r.connect(Yh.destination);let s={id:i,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Ao.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Yh.createBufferSource(),e.buffer=m,e.loop=s.loop,r.gain.setValueAtTime(s.volume,Yh.currentTime),e.connect(r),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),r.disconnect(),r.connect(Yh.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,r.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:r}},uR=()=>{let i=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=i.find(c=>c.id===h.id);if(!l){let c=PU(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});i.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of i)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));i=i.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of i)a.stop();i=[],t=[]}}};var RU=({JSONObject:i,parserPlugins:t=[]})=>i.map(r=>{let s=t.find(o=>o.type===r.type);return s?s.parse({state:r,parserPlugins:t}):i}),ax=RU;var dR=({type:i,parse:t})=>({type:i,parse:t});var MU=i=>i.split("/").pop(),BU=i=>({name:"advancedBufferLoader",priority:2,bufferMap:i,load:async t=>{let e=t.startsWith("file:")?t:MU(t),r=i[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}},test:async t=>!0,testParse:async t=>!0,parse:async t=>{if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)},unload:async t=>t.destroy(!0)}),IU=()=>{let i,t=uR(),e={elements:[],animations:[],audio:[]},r,s={animations:[],elements:[],audio:[],parsers:[]},o,n=!1,a,h=d=>d?d.startsWith("audio/")?"audio":d.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(d)?"font":"texture":"texture",l=(d,f,p)=>{d.renderer.events.cursorStyles||(d.renderer.events.cursorStyles={}),d.renderer.events.cursorStyles.default||(d.renderer.events.cursorStyles.default="default"),d.renderer.events.cursorStyles.hover||(d.renderer.events.cursorStyles.hover="pointer");let m=f?.cursorStyles,g=p?.cursorStyles;JSON.stringify(m)!==JSON.stringify(g)&&(g?(g.default&&(d.renderer.events.cursorStyles.default=g.default,d.canvas.style.cursor=g.default),g.hover&&(d.renderer.events.cursorStyles.hover=g.hover)):m&&(d.renderer.events.cursorStyles.default="default",d.renderer.events.cursorStyles.hover="pointer"))},c=async(d,f,p,m)=>{l(d,e.global,p.global),o&&n&&o.abort(),o=new AbortController;let g=o.signal;for(;n;)await new Promise(b=>setTimeout(b,0));n=!0,await rh({app:d,parent:f,prevASTTree:e.elements,nextASTTree:p.elements,animations:p.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:m,signal:g}),await Vm({app:d,prevAudioTree:e.audio,nextAudioTree:p.audio,audioPlugins:s.audio,signal:g}),n=!1,e=p},u={rendererName:"pixi",get canvas(){return i.canvas},get ticker(){return i.ticker},findElementByLabel:d=>{if(i.stage.children&&i.stage.children.length>0)for(let f of i.stage.children){let p=findElementByLabel(f,d);if(p)return p}return null},extractBase64:async d=>{await i.renderer.extract.base64(d)},assignStageEvent:(d,f)=>{i.stage.eventMode="static",i.stage.on(d,f)},init:async d=>{let{eventHandler:f,plugins:p,width:m,height:g,backgroundColor:b,useCustomTicker:_=!1}=d,v=[];p?.elements?.forEach(A=>{A?.parse&&v.push(dR({type:A.type,parse:A.parse}))}),s={animations:p.animations??[],elements:p.elements??[],audio:p.audio??[],parsers:v},r=f,i=new Ja,i.audioStage=t,await i.init({width:m,height:g,backgroundColor:b,preference:"webgl"}),i.useCustomTicker=_;let T=new xr;return T.rect(0,0,m,g),T.fill(b||0),i.stage.addChild(T),i.stage.width=m,i.stage.height=g,i.ticker.add(i.audioStage.tick),u},destroy:()=>{i.audioStage.destroy(),i.destroy()},loadAssets:async d=>{if(!d)throw new Error("assetBufferMap is required");let f={audio:{},font:{},texture:{}};for(let[m,g]of Object.entries(d)){let b=h(g.type);f[b][m]=g}await Promise.all(Object.entries(f.audio).map(([m,g])=>Ao.load(m,g.buffer))),await Promise.all(Object.entries(f.font).map(async([m,g])=>{let b=new Blob([g.buffer],{type:g.type}),_=URL.createObjectURL(b),v=new FontFace(m,`url(${_})`);try{await v.load(),document.fonts.add(v)}catch(T){console.error(`Failed to load font ${m}:`,T)}finally{URL.revokeObjectURL(_)}})),a?Object.assign(a.bufferMap,f.texture):(a=BU(f.texture),or.loader.parsers.length=0,or.reset(),G.add({name:"advanced-buffer-loader",extension:y.Asset,priority:le.High,loader:a}),typeof or.registerPlugin=="function"&&or.registerPlugin(a));let p=Object.keys(f.texture);return Promise.all(p.map(m=>or.load(m)))},loadAudioAssets:async d=>Promise.all(d.map(async f=>{let m=await(await fetch(f)).arrayBuffer();return Ao.load(f,m)})),updatedBackgroundColor:d=>{i.renderer.background.color=d},render:d=>{let f=ax({JSONObject:d.elements,parserPlugins:s.parsers}),p={...d,elements:f};c(i,i.stage,p,r)},parse:d=>{let f=ax({JSONObject:d.elements,parserPlugins:s.parsers});return{...d,elements:f}}};return u},fR=IU;var pbt=fR;export{Ja as Application,or as Assets,Ao as AudioAsset,jI as containerPlugin,Dm as createAnimationPlugin,TR as createAssetBufferManager,Nm as createAudioPlugin,ze as createElementPlugin,pbt as default,VI as rectPlugin,Vm as renderAudio,rh as renderElements,zI as sliderPlugin,oF as soundPlugin,WI as spritePlugin,HI as textPlugin,KI as textRevealingPlugin,sF as tweenPlugin};
|
|
1629
1629
|
/*! Bundled license information:
|
|
1630
1630
|
|
|
1631
1631
|
punycode/punycode.js:
|