@prefecthq/graphs 0.1.8 → 0.1.10

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.
@@ -1,17 +1,17 @@
1
- (function(Rt,it){typeof exports=="object"&&typeof module<"u"?it(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],it):(Rt=typeof globalThis<"u"?globalThis:Rt||self,it(Rt["prefect-graphs"]={},Rt.Vue))})(this,function(Rt,it){"use strict";var Wv=Object.defineProperty;var zv=(Rt,it,Xt)=>it in Rt?Wv(Rt,it,{enumerable:!0,configurable:!0,writable:!0,value:Xt}):Rt[it]=Xt;var et=(Rt,it,Xt)=>(zv(Rt,typeof it!="symbol"?it+"":it,Xt),Xt);var Xt=Math.PI*2,fo=180/Math.PI,co=Math.PI/180,xt;(function(r){r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC"})(xt||(xt={}));var W=function(){function r(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.x=0,this.y=0,this.x=e,this.y=t}return r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.copyFrom=function(e){return this.set(e.x,e.y),this},r.prototype.copyTo=function(e){return e.set(this.x,this.y),e},r.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x=e,this.y=t,this},r.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},r}(),_i=[new W,new W,new W,new W],z=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(n),this.type=xt.RECT}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r,"EMPTY",{get:function(){return new r(0,0,0,0)},enumerable:!1,configurable:!0}),r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},r.prototype.copyTo=function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},r.prototype.contains=function(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height},r.prototype.intersects=function(e,t){if(!t){var i=this.x<e.x?e.x:this.x,n=this.right>e.right?e.right:this.right;if(n<=i)return!1;var s=this.y<e.y?e.y:this.y,a=this.bottom>e.bottom?e.bottom:this.bottom;return a>s}var o=this.left,h=this.right,u=this.top,l=this.bottom;if(h<=o||l<=u)return!1;var f=_i[0].set(e.left,e.top),c=_i[1].set(e.left,e.bottom),d=_i[2].set(e.right,e.top),p=_i[3].set(e.right,e.bottom);if(d.x<=f.x||c.y<=f.y)return!1;var v=Math.sign(t.a*t.d-t.b*t.c);if(v===0||(t.apply(f,f),t.apply(c,c),t.apply(d,d),t.apply(p,p),Math.max(f.x,c.x,d.x,p.x)<=o||Math.min(f.x,c.x,d.x,p.x)>=h||Math.max(f.y,c.y,d.y,p.y)<=u||Math.min(f.y,c.y,d.y,p.y)>=l))return!1;var _=v*(c.y-f.y),m=v*(f.x-c.x),y=_*o+m*u,g=_*h+m*u,b=_*o+m*l,x=_*h+m*l;if(Math.max(y,g,b,x)<=_*f.x+m*f.y||Math.min(y,g,b,x)>=_*p.x+m*p.y)return!1;var T=v*(f.y-d.y),w=v*(d.x-f.x),A=T*o+w*u,E=T*h+w*u,S=T*o+w*l,D=T*h+w*l;return!(Math.max(A,E,S,D)<=T*f.x+w*f.y||Math.min(A,E,S,D)>=T*p.x+w*p.y)},r.prototype.pad=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this},r.prototype.fit=function(e){var t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=n,this.height=Math.max(s-n,0),this},r.prototype.ceil=function(e,t){e===void 0&&(e=1),t===void 0&&(t=.001);var i=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=n-this.y,this},r.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=n,this.height=s-n,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),po=function(){function r(e,t,i){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),this.x=e,this.y=t,this.radius=i,this.type=xt.CIRC}return r.prototype.clone=function(){return new r(this.x,this.y,this.radius)},r.prototype.contains=function(e,t){if(this.radius<=0)return!1;var i=this.radius*this.radius,n=this.x-e,s=this.y-t;return n*=n,s*=s,n+s<=i},r.prototype.getBounds=function(){return new z(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)},r.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},r}(),vo=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=e,this.y=t,this.width=i,this.height=n,this.type=xt.ELIP}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var i=(e-this.x)/this.width,n=(t-this.y)/this.height;return i*=i,n*=n,i+n<=1},r.prototype.getBounds=function(){return new z(this.x-this.width,this.y-this.height,this.width,this.height)},r.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),mi=function(){function r(){for(var e=arguments,t=[],i=0;i<arguments.length;i++)t[i]=e[i];var n=Array.isArray(t[0])?t[0]:t;if(typeof n[0]!="number"){for(var s=[],a=0,o=n.length;a<o;a++)s.push(n[a].x,n[a].y);n=s}this.points=n,this.type=xt.POLY,this.closeStroke=!0}return r.prototype.clone=function(){var e=this.points.slice(),t=new r(e);return t.closeStroke=this.closeStroke,t},r.prototype.contains=function(e,t){for(var i=!1,n=this.points.length/2,s=0,a=n-1;s<n;a=s++){var o=this.points[s*2],h=this.points[s*2+1],u=this.points[a*2],l=this.points[a*2+1],f=h>t!=l>t&&e<(u-o)*((t-h)/(l-h))+o;f&&(i=!i)}return i},r.prototype.toString=function(){return"[@pixi/math:Polygon"+("closeStroke="+this.closeStroke)+("points="+this.points.reduce(function(e,t){return e+", "+t},"")+"]")},r}(),_o=function(){function r(e,t,i,n,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),s===void 0&&(s=20),this.x=e,this.y=t,this.width=i,this.height=n,this.radius=s,this.type=xt.RREC}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height,this.radius)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;var n=e-(this.x+i),s=t-(this.y+i),a=i*i;if(n*n+s*s<=a||(n=e-(this.x+this.width-i),n*n+s*s<=a)||(s=t-(this.y+this.height-i),n*n+s*s<=a)||(n=e-(this.x+i),n*n+s*s<=a))return!0}return!1},r.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+("width="+this.width+" height="+this.height+" radius="+this.radius+"]")},r}(),Ae=function(){function r(e,t,i,n){i===void 0&&(i=0),n===void 0&&(n=0),this._x=i,this._y=n,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return e===void 0&&(e=this.cb),t===void 0&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x="+0+" y="+0+" scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),gt=function(){function r(e,t,i,n,s,a){e===void 0&&(e=1),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=0),a===void 0&&(a=0),this.array=null,this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=a}return r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.set=function(e,t,i,n,s,a){return this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=a,this},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},r.prototype.apply=function(e,t){t=t||new W;var i=e.x,n=e.y;return t.x=this.a*i+this.c*n+this.tx,t.y=this.b*i+this.d*n+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new W;var i=1/(this.a*this.d+this.c*-this.b),n=e.x,s=e.y;return t.x=this.d*i*n+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*s+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,a=this.tx;return this.a=n*t-this.b*i,this.b=n*i+this.b*t,this.c=s*t-this.d*i,this.d=s*i+this.d*t,this.tx=a*t-this.ty*i,this.ty=a*i+this.ty*t,this},r.prototype.append=function(e){var t=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*t+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this},r.prototype.setTransform=function(e,t,i,n,s,a,o,h,u){return this.a=Math.cos(o+u)*s,this.b=Math.sin(o+u)*s,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=e-(i*this.a+n*this.c),this.ty=t-(i*this.b+n*this.d),this},r.prototype.prepend=function(e){var t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.decompose=function(e){var t=this.a,i=this.b,n=this.c,s=this.d,a=e.pivot,o=-Math.atan2(-n,s),h=Math.atan2(i,t),u=Math.abs(o+h);return u<1e-5||Math.abs(Xt-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=h),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(a.x*t+a.y*n),e.position.y=this.ty+(a.x*i+a.y*s),e},r.prototype.invert=function(){var e=this.a,t=this.b,i=this.c,n=this.d,s=this.tx,a=e*n-t*i;return this.a=n/a,this.b=-t/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(e*this.ty-t*s)/a,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},r.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+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),fe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ce=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],de=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],pe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],lr=[],kn=[],gi=Math.sign;function mo(){for(var r=0;r<16;r++){var e=[];lr.push(e);for(var t=0;t<16;t++)for(var i=gi(fe[r]*fe[t]+de[r]*ce[t]),n=gi(ce[r]*fe[t]+pe[r]*ce[t]),s=gi(fe[r]*de[t]+de[r]*pe[t]),a=gi(ce[r]*de[t]+pe[r]*pe[t]),o=0;o<16;o++)if(fe[o]===i&&ce[o]===n&&de[o]===s&&pe[o]===a){e.push(o);break}}for(var r=0;r<16;r++){var h=new gt;h.set(fe[r],ce[r],de[r],pe[r],0,0),kn.push(h)}}mo();var ht={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:function(r){return fe[r]},uY:function(r){return ce[r]},vX:function(r){return de[r]},vY:function(r){return pe[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return lr[r][e]},sub:function(r,e){return lr[r][ht.inv(e)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,e){return Math.abs(r)*2<=Math.abs(e)?e>=0?ht.S:ht.N:Math.abs(e)*2<=Math.abs(r)?r>0?ht.E:ht.W:e>0?r>0?ht.SE:ht.SW:r>0?ht.NE:ht.NW},matrixAppendRotationInv:function(r,e,t,i){t===void 0&&(t=0),i===void 0&&(i=0);var n=kn[ht.inv(e)];n.tx=t,n.ty=i,r.append(n)}},Hn=function(){function r(){this.worldTransform=new gt,this.localTransform=new gt,this.position=new Ae(this.onChange,this,0,0),this.scale=new Ae(this.onChange,this,1,1),this.pivot=new Ae(this.onChange,this,0,0),this.skew=new Ae(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}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){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++},r.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+") ")+"]"},r.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(e){var 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!==e._worldID){var i=e.worldTransform,n=this.worldTransform;n.a=t.a*i.a+t.b*i.c,n.b=t.a*i.b+t.b*i.d,n.c=t.c*i.a+t.d*i.c,n.d=t.c*i.b+t.d*i.d,n.tx=t.tx*i.a+t.ty*i.c+i.tx,n.ty=t.tx*i.b+t.ty*i.d+i.ty,this._parentID=e._worldID,this._worldID++}},r.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();const ve=new z;class go{constructor(e={}){this._recursive=typeof e.recursive=="boolean"?e.recursive:!0,this._toggle=e.toggle||"visible",this._targetList=new Set}add(e){return this._targetList.add(e),this}addAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.add(e[t]);return this}remove(e){return this._targetList.delete(e),this}removeAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.delete(e[t]);return this}clear(){return this._targetList.clear(),this}cull(e,t=!1){return t||this.uncull(),this._targetList.forEach(i=>{t||i.getBounds(!1,ve),this._recursive?this.cullRecursive(e,i,t):(t&&i._bounds.getRectangle(e),i[this._toggle]=ve.right>e.left&&ve.left<e.right&&ve.bottom>e.top&&ve.top<e.bottom)}),this}uncull(){return this._targetList.forEach(e=>{this._recursive?this.uncullRecursive(e):e[this._toggle]=!1}),this}cullRecursive(e,t,i){const n=i?t._bounds.getRectangle(ve):t.getBounds(!0,ve);if(t[this._toggle]=n.right>e.left&&n.left<e.right&&n.bottom>e.top&&n.top<e.bottom,!(n.left>=e.left&&n.top>=e.top&&n.right<=e.right&&n.bottom<=e.bottom)&&t[this._toggle]&&t.children&&t.children.length){const a=t.children;for(let o=0,h=a.length;o<h;o++)this.cullRecursive(e,a[o])}}uncullRecursive(e){if(e[this._toggle]=!0,e.children&&e.children.length){const t=e.children;for(let i=0,n=t.length;i<n;i++)this.uncullRecursive(t[i])}}}function yo(r){var e=this.constructor;return this.then(function(t){return e.resolve(r()).then(function(){return t})},function(t){return e.resolve(r()).then(function(){return e.reject(t)})})}function xo(r){var e=this;return new e(function(t,i){if(!(r&&typeof r.length<"u"))return i(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(r);if(n.length===0)return t([]);var s=n.length;function a(h,u){if(u&&(typeof u=="object"||typeof u=="function")){var l=u.then;if(typeof l=="function"){l.call(u,function(f){a(h,f)},function(f){n[h]={status:"rejected",reason:f},--s===0&&t(n)});return}}n[h]={status:"fulfilled",value:u},--s===0&&t(n)}for(var o=0;o<n.length;o++)a(o,n[o])})}var bo=setTimeout;function Xn(r){return Boolean(r&&typeof r.length<"u")}function To(){}function wo(r,e){return function(){r.apply(e,arguments)}}function ft(r){if(!(this instanceof ft))throw new TypeError("Promises must be constructed via new");if(typeof r!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],zn(r,this)}function Wn(r,e){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(e);return}r._handled=!0,ft._immediateFn(function(){var t=r._state===1?e.onFulfilled:e.onRejected;if(t===null){(r._state===1?fr:We)(e.promise,r._value);return}var i;try{i=t(r._value)}catch(n){We(e.promise,n);return}fr(e.promise,i)})}function fr(r,e){try{if(e===r)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e=="object"||typeof e=="function")){var t=e.then;if(e instanceof ft){r._state=3,r._value=e,cr(r);return}else if(typeof t=="function"){zn(wo(t,e),r);return}}r._state=1,r._value=e,cr(r)}catch(i){We(r,i)}}function We(r,e){r._state=2,r._value=e,cr(r)}function cr(r){r._state===2&&r._deferreds.length===0&&ft._immediateFn(function(){r._handled||ft._unhandledRejectionFn(r._value)});for(var e=0,t=r._deferreds.length;e<t;e++)Wn(r,r._deferreds[e]);r._deferreds=null}function Eo(r,e,t){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function zn(r,e){var t=!1;try{r(function(i){t||(t=!0,fr(e,i))},function(i){t||(t=!0,We(e,i))})}catch(i){if(t)return;t=!0,We(e,i)}}ft.prototype.catch=function(r){return this.then(null,r)},ft.prototype.then=function(r,e){var t=new this.constructor(To);return Wn(this,new Eo(r,e,t)),t},ft.prototype.finally=yo,ft.all=function(r){return new ft(function(e,t){if(!Xn(r))return t(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return e([]);var n=i.length;function s(o,h){try{if(h&&(typeof h=="object"||typeof h=="function")){var u=h.then;if(typeof u=="function"){u.call(h,function(l){s(o,l)},t);return}}i[o]=h,--n===0&&e(i)}catch(l){t(l)}}for(var a=0;a<i.length;a++)s(a,i[a])})},ft.allSettled=xo,ft.resolve=function(r){return r&&typeof r=="object"&&r.constructor===ft?r:new ft(function(e){e(r)})},ft.reject=function(r){return new ft(function(e,t){t(r)})},ft.race=function(r){return new ft(function(e,t){if(!Xn(r))return t(new TypeError("Promise.race accepts an array"));for(var i=0,n=r.length;i<n;i++)ft.resolve(r[i]).then(e,t)})},ft._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){bo(r,0)},ft._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var jn=Object.getOwnPropertySymbols,So=Object.prototype.hasOwnProperty,Po=Object.prototype.propertyIsEnumerable;function Co(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Ro(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var e={},t=0;t<10;t++)e["_"+String.fromCharCode(t)]=t;var i=Object.getOwnPropertyNames(e).map(function(s){return e[s]});if(i.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(s){n[s]=s}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var Ao=Ro()?Object.assign:function(r,e){for(var t,i=Co(r),n,s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var a in t)So.call(t,a)&&(i[a]=t[a]);if(jn){n=jn(t);for(var o=0;o<n.length;o++)Po.call(t,n[o])&&(i[n[o]]=t[n[o]])}}return i};typeof globalThis>"u"&&(typeof self<"u"?self.globalThis=self:typeof global<"u"&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=ft),Object.assign||(Object.assign=Ao);var Io=16;if(Date.now&&Date.prototype.getTime||(Date.now=function(){return new Date().getTime()}),!(globalThis.performance&&globalThis.performance.now)){var Oo=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-Oo}}for(var pr=Date.now(),Yn=["ms","moz","webkit","o"],vr=0;vr<Yn.length&&!globalThis.requestAnimationFrame;++vr){var _r=Yn[vr];globalThis.requestAnimationFrame=globalThis[_r+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[_r+"CancelAnimationFrame"]||globalThis[_r+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(r){if(typeof r!="function")throw new TypeError(r+"is not a function");var e=Date.now(),t=Io+pr-e;return t<0&&(t=0),pr=e,globalThis.self.setTimeout(function(){pr=Date.now(),r(performance.now())},t)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(r){return clearTimeout(r)}),Math.sign||(Math.sign=function(e){return e=Number(e),e===0||isNaN(e)?e:e>0?1:-1}),Number.isInteger||(Number.isInteger=function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array);var Zt;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(Zt||(Zt={}));var ze;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(ze||(ze={}));var yi;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(yi||(yi={}));var U;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(U||(U={}));var Ot;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(Ot||(Ot={}));var R;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(R||(R={}));var _e;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(_e||(_e={}));var L;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})(L||(L={}));var xi;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(xi||(xi={}));var Wt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Wt||(Wt={}));var zt;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(zt||(zt={}));var Mt;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(Mt||(Mt={}));var Dt;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(Dt||(Dt={}));var Ft;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(Ft||(Ft={}));var bi;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(bi||(bi={}));var At;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(At||(At={}));var mt;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(mt||(mt={}));var Vn;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(Vn||(Vn={}));var ct;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(ct||(ct={}));var jt;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(jt||(jt={}));var Mo={createCanvas:function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,t},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,e){return fetch(r,e)}},mr=/iPhone/i,qn=/iPod/i,$n=/iPad/i,Zn=/\biOS-universal(?:.+)Mac\b/i,gr=/\bAndroid(?:.+)Mobile\b/i,Kn=/Android/i,Ie=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ti=/Silk/i,Kt=/Windows Phone/i,Qn=/\bWindows(?:.+)ARM\b/i,Jn=/BlackBerry/i,ts=/BB10/i,es=/Opera Mini/i,is=/\b(CriOS|Chrome)(?:.+)Mobile/i,rs=/Mobile(?:.+)Firefox\b/i,ns=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Do(r){return function(e){return e.test(r)}}function Fo(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=Do(t),s={apple:{phone:n(mr)&&!n(Kt),ipod:n(qn),tablet:!n(mr)&&(n($n)||ns(e))&&!n(Kt),universal:n(Zn),device:(n(mr)||n(qn)||n($n)||n(Zn)||ns(e))&&!n(Kt)},amazon:{phone:n(Ie),tablet:!n(Ie)&&n(Ti),device:n(Ie)||n(Ti)},android:{phone:!n(Kt)&&n(Ie)||!n(Kt)&&n(gr),tablet:!n(Kt)&&!n(Ie)&&!n(gr)&&(n(Ti)||n(Kn)),device:!n(Kt)&&(n(Ie)||n(Ti)||n(gr)||n(Kn))||n(/\bokhttp\b/i)},windows:{phone:n(Kt),tablet:n(Qn),device:n(Kt)||n(Qn)},other:{blackberry:n(Jn),blackberry10:n(ts),opera:n(es),firefox:n(rs),chrome:n(is),device:n(Jn)||n(ts)||n(es)||n(rs)||n(is)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var Yt=Fo(globalThis.navigator);function No(){return!Yt.apple.device}function Bo(r){var e=!0;if(Yt.tablet||Yt.phone){if(Yt.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var i=parseInt(t[1],10);i<11&&(e=!1)}}if(Yt.android.device){var t=navigator.userAgent.match(/Android\s([0-9.]*)/);if(t){var i=parseInt(t[1],10);i<7&&(e=!1)}}}return e?r:4}var F={ADAPTER:Mo,MIPMAP_TEXTURES:Mt.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:ct.NONE,SPRITE_MAX_TEXTURES:Bo(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:bi.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:zt.CLAMP,SCALE_MODE:Wt.LINEAR,PRECISION_VERTEX:At.HIGH,PRECISION_FRAGMENT:Yt.apple.device?At.HIGH:At.MEDIUM,CAN_UPLOAD_SAME_BUFFER:No(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},ss={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(h,u,l){this.fn=h,this.context=u,this.once=l||!1}function s(h,u,l,f,c){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new n(l,f||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],d]:h._events[p].push(d):(h._events[p]=d,h._eventsCount++),h}function a(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],l,f;if(this._eventsCount===0)return u;for(f in l=this._events)e.call(l,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},o.prototype.listeners=function(u){var l=t?t+u:u,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var c=0,d=f.length,p=new Array(d);c<d;c++)p[c]=f[c].fn;return p},o.prototype.listenerCount=function(u){var l=t?t+u:u,f=this._events[l];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,l,f,c,d,p){var v=t?t+u:u;if(!this._events[v])return!1;var _=this._events[v],m=arguments.length,y,g;if(_.fn){switch(_.once&&this.removeListener(u,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,l),!0;case 3:return _.fn.call(_.context,l,f),!0;case 4:return _.fn.call(_.context,l,f,c),!0;case 5:return _.fn.call(_.context,l,f,c,d),!0;case 6:return _.fn.call(_.context,l,f,c,d,p),!0}for(g=1,y=new Array(m-1);g<m;g++)y[g-1]=arguments[g];_.fn.apply(_.context,y)}else{var b=_.length,x;for(g=0;g<b;g++)switch(_[g].once&&this.removeListener(u,_[g].fn,void 0,!0),m){case 1:_[g].fn.call(_[g].context);break;case 2:_[g].fn.call(_[g].context,l);break;case 3:_[g].fn.call(_[g].context,l,f);break;case 4:_[g].fn.call(_[g].context,l,f,c);break;default:if(!y)for(x=1,y=new Array(m-1);x<m;x++)y[x-1]=arguments[x];_[g].fn.apply(_[g].context,y)}}return!0},o.prototype.on=function(u,l,f){return s(this,u,l,f,!1)},o.prototype.once=function(u,l,f){return s(this,u,l,f,!0)},o.prototype.removeListener=function(u,l,f,c){var d=t?t+u:u;if(!this._events[d])return this;if(!l)return a(this,d),this;var p=this._events[d];if(p.fn)p.fn===l&&(!c||p.once)&&(!f||p.context===f)&&a(this,d);else{for(var v=0,_=[],m=p.length;v<m;v++)(p[v].fn!==l||c&&!p[v].once||f&&p[v].context!==f)&&_.push(p[v]);_.length?this._events[d]=_.length===1?_[0]:_:a(this,d)}return this},o.prototype.removeAllListeners=function(u){var l;return u?(l=t?t+u:u,this._events[l]&&a(this,l)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,r.exports=o})(ss);const je=ss.exports;var wi={exports:{}};wi.exports=Ei,wi.exports.default=Ei;function Ei(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,s=as(r,0,n,t,!0),a=[];if(!s||s.next===s.prev)return a;var o,h,u,l,f,c,d;if(i&&(s=Ho(r,e,s,t)),r.length>80*t){o=u=r[0],h=l=r[1];for(var p=t;p<n;p+=t)f=r[p],c=r[p+1],f<o&&(o=f),c<h&&(h=c),f>u&&(u=f),c>l&&(l=c);d=Math.max(u-o,l-h),d=d!==0?32767/d:0}return Ye(s,a,t,o,h,d,0),a}function as(r,e,t,i,n){var s,a;if(n===br(r,e,t,i)>0)for(s=e;s<t;s+=i)a=us(s,r[s],r[s+1],a);else for(s=t-i;s>=e;s-=i)a=us(s,r[s],r[s+1],a);return a&&Si(a,a.next)&&(qe(a),a=a.next),a}function me(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(Si(t,t.next)||ut(t.prev,t,t.next)===0)){if(qe(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ye(r,e,t,i,n,s,a){if(r){!a&&s&&Yo(r,i,n,s);for(var o=r,h,u;r.prev!==r.next;){if(h=r.prev,u=r.next,s?Uo(r,i,n,s):Lo(r)){e.push(h.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),qe(r),r=u.next,o=u.next;continue}if(r=u,r===o){a?a===1?(r=Go(me(r),e,t),Ye(r,e,t,i,n,s,2)):a===2&&ko(r,e,t,i,n,s):Ye(me(r),e,t,i,n,s,1);break}}}}function Lo(r){var e=r.prev,t=r,i=r.next;if(ut(e,t,i)>=0)return!1;for(var n=e.x,s=t.x,a=i.x,o=e.y,h=t.y,u=i.y,l=n<s?n<a?n:a:s<a?s:a,f=o<h?o<u?o:u:h<u?h:u,c=n>s?n>a?n:a:s>a?s:a,d=o>h?o>u?o:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=l&&p.x<=c&&p.y>=f&&p.y<=d&&Oe(n,o,s,h,a,u,p.x,p.y)&&ut(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Uo(r,e,t,i){var n=r.prev,s=r,a=r.next;if(ut(n,s,a)>=0)return!1;for(var o=n.x,h=s.x,u=a.x,l=n.y,f=s.y,c=a.y,d=o<h?o<u?o:u:h<u?h:u,p=l<f?l<c?l:c:f<c?f:c,v=o>h?o>u?o:u:h>u?h:u,_=l>f?l>c?l:c:f>c?f:c,m=yr(d,p,e,t,i),y=yr(v,_,e,t,i),g=r.prevZ,b=r.nextZ;g&&g.z>=m&&b&&b.z<=y;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=_&&g!==n&&g!==a&&Oe(o,l,h,f,u,c,g.x,g.y)&&ut(g.prev,g,g.next)>=0||(g=g.prevZ,b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==a&&Oe(o,l,h,f,u,c,b.x,b.y)&&ut(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;g&&g.z>=m;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=_&&g!==n&&g!==a&&Oe(o,l,h,f,u,c,g.x,g.y)&&ut(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;b&&b.z<=y;){if(b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==a&&Oe(o,l,h,f,u,c,b.x,b.y)&&ut(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Go(r,e,t){var i=r;do{var n=i.prev,s=i.next.next;!Si(n,s)&&os(n,i,i.next,s)&&Ve(n,s)&&Ve(s,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),qe(i),qe(i.next),i=r=s),i=i.next}while(i!==r);return me(i)}function ko(r,e,t,i,n,s){var a=r;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&$o(a,o)){var h=hs(a,o);a=me(a,a.next),h=me(h,h.next),Ye(a,e,t,i,n,s,0),Ye(h,e,t,i,n,s,0);return}o=o.next}a=a.next}while(a!==r)}function Ho(r,e,t,i){var n=[],s,a,o,h,u;for(s=0,a=e.length;s<a;s++)o=e[s]*i,h=s<a-1?e[s+1]*i:r.length,u=as(r,o,h,i,!1),u===u.next&&(u.steiner=!0),n.push(qo(u));for(n.sort(Xo),s=0;s<n.length;s++)t=Wo(n[s],t);return t}function Xo(r,e){return r.x-e.x}function Wo(r,e){var t=zo(r,e);if(!t)return e;var i=hs(t,r);return me(i,i.next),me(t,t.next)}function zo(r,e){var t=e,i=r.x,n=r.y,s=-1/0,a;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var o=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=i&&o>s&&(s=o,a=t.x<t.next.x?t:t.next,o===i))return a}t=t.next}while(t!==e);if(!a)return null;var h=a,u=a.x,l=a.y,f=1/0,c;t=a;do i>=t.x&&t.x>=u&&i!==t.x&&Oe(n<l?i:s,n,u,l,n<l?s:i,n,t.x,t.y)&&(c=Math.abs(n-t.y)/(i-t.x),Ve(t,r)&&(c<f||c===f&&(t.x>a.x||t.x===a.x&&jo(a,t)))&&(a=t,f=c)),t=t.next;while(t!==h);return a}function jo(r,e){return ut(r.prev,r,e.prev)<0&&ut(e.next,r,r.next)<0}function Yo(r,e,t,i){var n=r;do n.z===0&&(n.z=yr(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,Vo(n)}function Vo(r){var e,t,i,n,s,a,o,h,u=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,i=t,o=0,e=0;e<u&&(o++,i=i.nextZ,!!i);e++);for(h=u;o>0||h>0&&i;)o!==0&&(h===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,o--):(n=i,i=i.nextZ,h--),s?s.nextZ=n:r=n,n.prevZ=s,s=n;t=i}s.nextZ=null,u*=2}while(a>1);return r}function yr(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function qo(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Oe(r,e,t,i,n,s,a,o){return(n-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(n-a)*(i-o)}function $o(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Zo(r,e)&&(Ve(r,e)&&Ve(e,r)&&Ko(r,e)&&(ut(r.prev,r,e.prev)||ut(r,e.prev,e))||Si(r,e)&&ut(r.prev,r,r.next)>0&&ut(e.prev,e,e.next)>0)}function ut(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Si(r,e){return r.x===e.x&&r.y===e.y}function os(r,e,t,i){var n=Ci(ut(r,e,t)),s=Ci(ut(r,e,i)),a=Ci(ut(t,i,r)),o=Ci(ut(t,i,e));return!!(n!==s&&a!==o||n===0&&Pi(r,t,e)||s===0&&Pi(r,i,e)||a===0&&Pi(t,r,i)||o===0&&Pi(t,e,i))}function Pi(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Ci(r){return r>0?1:r<0?-1:0}function Zo(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&os(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ve(r,e){return ut(r.prev,r,r.next)<0?ut(r,e,r.next)>=0&&ut(r,r.prev,e)>=0:ut(r,e,r.prev)<0||ut(r,r.next,e)<0}function Ko(r,e){var t=r,i=!1,n=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function hs(r,e){var t=new xr(r.i,r.x,r.y),i=new xr(e.i,e.x,e.y),n=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function us(r,e,t,i){var n=new xr(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function qe(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function xr(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ei.deviation=function(r,e,t,i){var n=e&&e.length,s=n?e[0]*t:r.length,a=Math.abs(br(r,0,s,t));if(n)for(var o=0,h=e.length;o<h;o++){var u=e[o]*t,l=o<h-1?e[o+1]*t:r.length;a-=Math.abs(br(r,u,l,t))}var f=0;for(o=0;o<i.length;o+=3){var c=i[o]*t,d=i[o+1]*t,p=i[o+2]*t;f+=Math.abs((r[c]-r[p])*(r[d+1]-r[c+1])-(r[c]-r[d])*(r[p+1]-r[c+1]))}return a===0&&f===0?0:Math.abs((f-a)/a)};function br(r,e,t,i){for(var n=0,s=e,a=t-i;s<t;s+=i)n+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return n}Ei.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,n=0;n<r.length;n++){for(var s=0;s<r[n].length;s++)for(var a=0;a<e;a++)t.vertices.push(r[n][s][a]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t};var Tr={exports:{}};(function(r,e){(function(t){var i=e&&!e.nodeType&&e,n=r&&!r.nodeType&&r,s=typeof dr=="object"&&dr;(s.global===s||s.window===s||s.self===s)&&(t=s);var a,o=2147483647,h=36,u=1,l=26,f=38,c=700,d=72,p=128,v="-",_=/^xn--/,m=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-u,x=Math.floor,T=String.fromCharCode,w;function A(I){throw RangeError(g[I])}function E(I,P){for(var B=I.length,$=[];B--;)$[B]=P(I[B]);return $}function S(I,P){var B=I.split("@"),$="";B.length>1&&($=B[0]+"@",I=B[1]),I=I.replace(y,".");var Z=I.split("."),vt=E(Z,P).join(".");return $+vt}function D(I){for(var P=[],B=0,$=I.length,Z,vt;B<$;)Z=I.charCodeAt(B++),Z>=55296&&Z<=56319&&B<$?(vt=I.charCodeAt(B++),(vt&64512)==56320?P.push(((Z&1023)<<10)+(vt&1023)+65536):(P.push(Z),B--)):P.push(Z);return P}function C(I){return E(I,function(P){var B="";return P>65535&&(P-=65536,B+=T(P>>>10&1023|55296),P=56320|P&1023),B+=T(P),B}).join("")}function N(I){return I-48<10?I-22:I-65<26?I-65:I-97<26?I-97:h}function H(I,P){return I+22+75*(I<26)-((P!=0)<<5)}function M(I,P,B){var $=0;for(I=B?x(I/c):I>>1,I+=x(I/P);I>b*l>>1;$+=h)I=x(I/b);return x($+(b+1)*I/(I+f))}function O(I){var P=[],B=I.length,$,Z=0,vt=p,st=d,at,Tt,Et,_t,tt,nt,ot,V,Pt;for(at=I.lastIndexOf(v),at<0&&(at=0),Tt=0;Tt<at;++Tt)I.charCodeAt(Tt)>=128&&A("not-basic"),P.push(I.charCodeAt(Tt));for(Et=at>0?at+1:0;Et<B;){for(_t=Z,tt=1,nt=h;Et>=B&&A("invalid-input"),ot=N(I.charCodeAt(Et++)),(ot>=h||ot>x((o-Z)/tt))&&A("overflow"),Z+=ot*tt,V=nt<=st?u:nt>=st+l?l:nt-st,!(ot<V);nt+=h)Pt=h-V,tt>x(o/Pt)&&A("overflow"),tt*=Pt;$=P.length+1,st=M(Z-_t,$,_t==0),x(Z/$)>o-vt&&A("overflow"),vt+=x(Z/$),Z%=$,P.splice(Z++,0,vt)}return C(P)}function G(I){var P,B,$,Z,vt,st,at,Tt,Et,_t,tt,nt=[],ot,V,Pt,Ct;for(I=D(I),ot=I.length,P=p,B=0,vt=d,st=0;st<ot;++st)tt=I[st],tt<128&&nt.push(T(tt));for($=Z=nt.length,Z&&nt.push(v);$<ot;){for(at=o,st=0;st<ot;++st)tt=I[st],tt>=P&&tt<at&&(at=tt);for(V=$+1,at-P>x((o-B)/V)&&A("overflow"),B+=(at-P)*V,P=at,st=0;st<ot;++st)if(tt=I[st],tt<P&&++B>o&&A("overflow"),tt==P){for(Tt=B,Et=h;_t=Et<=vt?u:Et>=vt+l?l:Et-vt,!(Tt<_t);Et+=h)Ct=Tt-_t,Pt=h-_t,nt.push(T(H(_t+Ct%Pt,0))),Tt=x(Ct/Pt);nt.push(T(H(Tt,0))),vt=M(B,V,$==Z),B=0,++$}++B,++P}return nt.join("")}function lt(I){return S(I,function(P){return _.test(P)?O(P.slice(4).toLowerCase()):P})}function j(I){return S(I,function(P){return m.test(P)?"xn--"+G(P):P})}if(a={version:"1.3.2",ucs2:{decode:D,encode:C},decode:O,encode:G,toASCII:j,toUnicode:lt},i&&n)if(r.exports==i)n.exports=a;else for(w in a)a.hasOwnProperty(w)&&(i[w]=a[w]);else t.punycode=a})(dr)})(Tr,Tr.exports);var Qo={isString:function(r){return typeof r=="string"},isObject:function(r){return typeof r=="object"&&r!==null},isNull:function(r){return r===null},isNullOrUndefined:function(r){return r==null}},$e={};function Jo(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var th=function(r,e,t,i){e=e||"&",t=t||"=";var n={};if(typeof r!="string"||r.length===0)return n;var s=/\+/g;r=r.split(e);var a=1e3;i&&typeof i.maxKeys=="number"&&(a=i.maxKeys);var o=r.length;a>0&&o>a&&(o=a);for(var h=0;h<o;++h){var u=r[h].replace(s,"%20"),l=u.indexOf(t),f,c,d,p;l>=0?(f=u.substr(0,l),c=u.substr(l+1)):(f=u,c=""),d=decodeURIComponent(f),p=decodeURIComponent(c),Jo(n,d)?Array.isArray(n[d])?n[d].push(p):n[d]=[n[d],p]:n[d]=p}return n},Ze=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}},eh=function(r,e,t,i){return e=e||"&",t=t||"=",r===null&&(r=void 0),typeof r=="object"?Object.keys(r).map(function(n){var s=encodeURIComponent(Ze(n))+t;return Array.isArray(r[n])?r[n].map(function(a){return s+encodeURIComponent(Ze(a))}).join(e):s+encodeURIComponent(Ze(r[n]))}).join(e):i?encodeURIComponent(Ze(i))+t+encodeURIComponent(Ze(r)):""};$e.decode=$e.parse=th,$e.encode=$e.stringify=eh;var ih=Tr.exports,Vt=Qo,rh=Ri,nh=vh,sh=ph;function Nt(){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 ah=/^([a-z0-9.+-]+:)/i,oh=/:[0-9]*$/,hh=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,uh=["<",">",'"',"`"," ","\r",`
2
- `," "],lh=["{","}","|","\\","^","`"].concat(uh),wr=["'"].concat(lh),ls=["%","/","?",";","#"].concat(wr),fs=["/","?","#"],fh=255,cs=/^[+a-z0-9A-Z_-]{0,63}$/,ch=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,dh={javascript:!0,"javascript:":!0},Er={javascript:!0,"javascript:":!0},Me={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sr=$e;function Ri(r,e,t){if(r&&Vt.isObject(r)&&r instanceof Nt)return r;var i=new Nt;return i.parse(r,e,t),i}Nt.prototype.parse=function(r,e,t){if(!Vt.isString(r))throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),n=i!==-1&&i<r.indexOf("#")?"?":"#",s=r.split(n),a=/\\/g;s[0]=s[0].replace(a,"/"),r=s.join(n);var o=r;if(o=o.trim(),!t&&r.split("#").length===1){var h=hh.exec(o);if(h)return this.path=o,this.href=o,this.pathname=h[1],h[2]?(this.search=h[2],e?this.query=Sr.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=ah.exec(o);if(u){u=u[0];var l=u.toLowerCase();this.protocol=l,o=o.substr(u.length)}if(t||u||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=o.substr(0,2)==="//";f&&!(u&&Er[u])&&(o=o.substr(2),this.slashes=!0)}if(!Er[u]&&(f||u&&!Me[u])){for(var c=-1,d=0;d<fs.length;d++){var p=o.indexOf(fs[d]);p!==-1&&(c===-1||p<c)&&(c=p)}var v,_;c===-1?_=o.lastIndexOf("@"):_=o.lastIndexOf("@",c),_!==-1&&(v=o.slice(0,_),o=o.slice(_+1),this.auth=decodeURIComponent(v)),c=-1;for(var d=0;d<ls.length;d++){var p=o.indexOf(ls[d]);p!==-1&&(c===-1||p<c)&&(c=p)}c===-1&&(c=o.length),this.host=o.slice(0,c),o=o.slice(c),this.parseHost(),this.hostname=this.hostname||"";var m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m)for(var y=this.hostname.split(/\./),d=0,g=y.length;d<g;d++){var b=y[d];if(b&&!b.match(cs)){for(var x="",T=0,w=b.length;T<w;T++)b.charCodeAt(T)>127?x+="x":x+=b[T];if(!x.match(cs)){var A=y.slice(0,d),E=y.slice(d+1),S=b.match(ch);S&&(A.push(S[1]),E.unshift(S[2])),E.length&&(o="/"+E.join(".")+o),this.hostname=A.join(".");break}}}this.hostname.length>fh?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=ih.toASCII(this.hostname));var D=this.port?":"+this.port:"",C=this.hostname||"";this.host=C+D,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!dh[l])for(var d=0,g=wr.length;d<g;d++){var N=wr[d];if(o.indexOf(N)!==-1){var H=encodeURIComponent(N);H===N&&(H=escape(N)),o=o.split(N).join(H)}}var M=o.indexOf("#");M!==-1&&(this.hash=o.substr(M),o=o.slice(0,M));var O=o.indexOf("?");if(O!==-1?(this.search=o.substr(O),this.query=o.substr(O+1),e&&(this.query=Sr.parse(this.query)),o=o.slice(0,O)):e&&(this.search="",this.query={}),o&&(this.pathname=o),Me[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var D=this.pathname||"",G=this.search||"";this.path=D+G}return this.href=this.format(),this};function ph(r){return Vt.isString(r)&&(r=Ri(r)),r instanceof Nt?r.format():Nt.prototype.format.call(r)}Nt.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",n=!1,s="";this.host?n=r+this.host:this.hostname&&(n=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&Vt.isObject(this.query)&&Object.keys(this.query).length&&(s=Sr.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Me[e])&&n!==!1?(n="//"+(n||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):n||(n=""),i&&i.charAt(0)!=="#"&&(i="#"+i),a&&a.charAt(0)!=="?"&&(a="?"+a),t=t.replace(/[?#]/g,function(o){return encodeURIComponent(o)}),a=a.replace("#","%23"),e+n+t+a+i};function vh(r,e){return Ri(r,!1,!0).resolve(e)}Nt.prototype.resolve=function(r){return this.resolveObject(Ri(r,!1,!0)).format()},Nt.prototype.resolveObject=function(r){if(Vt.isString(r)){var e=new Nt;e.parse(r,!1,!0),r=e}for(var t=new Nt,i=Object.keys(this),n=0;n<i.length;n++){var s=i[n];t[s]=this[s]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var a=Object.keys(r),o=0;o<a.length;o++){var h=a[o];h!=="protocol"&&(t[h]=r[h])}return Me[t.protocol]&&t.hostname&&!t.pathname&&(t.path=t.pathname="/"),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!Me[r.protocol]){for(var u=Object.keys(r),l=0;l<u.length;l++){var f=u[l];t[f]=r[f]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!Er[r.protocol]){for(var g=(r.pathname||"").split("/");g.length&&!(r.host=g.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),t.pathname=g.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var c=t.pathname||"",d=t.search||"";t.path=c+d}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var p=t.pathname&&t.pathname.charAt(0)==="/",v=r.host||r.pathname&&r.pathname.charAt(0)==="/",_=v||p||t.host&&r.pathname,m=_,y=t.pathname&&t.pathname.split("/")||[],g=r.pathname&&r.pathname.split("/")||[],b=t.protocol&&!Me[t.protocol];if(b&&(t.hostname="",t.port=null,t.host&&(y[0]===""?y[0]=t.host:y.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host=null),_=_&&(g[0]===""||y[0]==="")),v)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,y=g;else if(g.length)y||(y=[]),y.pop(),y=y.concat(g),t.search=r.search,t.query=r.query;else if(!Vt.isNullOrUndefined(r.search)){if(b){t.hostname=t.host=y.shift();var x=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;x&&(t.auth=x.shift(),t.host=t.hostname=x.shift())}return t.search=r.search,t.query=r.query,(!Vt.isNull(t.pathname)||!Vt.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!y.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var T=y.slice(-1)[0],w=(t.host||r.host||y.length>1)&&(T==="."||T==="..")||T==="",A=0,E=y.length;E>=0;E--)T=y[E],T==="."?y.splice(E,1):T===".."?(y.splice(E,1),A++):A&&(y.splice(E,1),A--);if(!_&&!m)for(;A--;A)y.unshift("..");_&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),w&&y.join("/").substr(-1)!=="/"&&y.push("");var S=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(b){t.hostname=t.host=S?"":y.length?y.shift():"";var x=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;x&&(t.auth=x.shift(),t.host=t.hostname=x.shift())}return _=_||t.host&&y.length,_&&!S&&y.unshift(""),y.length?t.pathname=y.join("/"):(t.pathname=null,t.path=null),(!Vt.isNull(t.pathname)||!Vt.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t},Nt.prototype.parseHost=function(){var r=this.host,e=oh.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};var De={parse:rh,format:sh,resolve:nh};F.RETINA_PREFIX=/@([0-9\.]+)x/,F.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ds=!1,ps="6.5.8";function _h(r){var e;if(!ds){if(F.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[`
3
- %c %c %c PixiJS `+ps+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥
1
+ (function(At,dt){typeof exports=="object"&&typeof module<"u"?dt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],dt):(At=typeof globalThis<"u"?globalThis:At||self,dt(At["prefect-graphs"]={},At.Vue))})(this,function(At,dt){"use strict";var zv=Object.defineProperty;var Yv=(At,dt,Wt)=>dt in At?zv(At,dt,{enumerable:!0,configurable:!0,writable:!0,value:Wt}):At[dt]=Wt;var K=(At,dt,Wt)=>(Yv(At,typeof dt!="symbol"?dt+"":dt,Wt),Wt);var Wt=Math.PI*2,po=180/Math.PI,vo=Math.PI/180,bt;(function(r){r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC"})(bt||(bt={}));var X=function(){function r(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.x=0,this.y=0,this.x=e,this.y=t}return r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.copyFrom=function(e){return this.set(e.x,e.y),this},r.prototype.copyTo=function(e){return e.set(this.x,this.y),e},r.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x=e,this.y=t,this},r.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},r}(),gi=[new X,new X,new X,new X],j=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(n),this.type=bt.RECT}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r,"EMPTY",{get:function(){return new r(0,0,0,0)},enumerable:!1,configurable:!0}),r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},r.prototype.copyTo=function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},r.prototype.contains=function(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height},r.prototype.intersects=function(e,t){if(!t){var i=this.x<e.x?e.x:this.x,n=this.right>e.right?e.right:this.right;if(n<=i)return!1;var s=this.y<e.y?e.y:this.y,a=this.bottom>e.bottom?e.bottom:this.bottom;return a>s}var o=this.left,h=this.right,u=this.top,l=this.bottom;if(h<=o||l<=u)return!1;var f=gi[0].set(e.left,e.top),c=gi[1].set(e.left,e.bottom),d=gi[2].set(e.right,e.top),p=gi[3].set(e.right,e.bottom);if(d.x<=f.x||c.y<=f.y)return!1;var v=Math.sign(t.a*t.d-t.b*t.c);if(v===0||(t.apply(f,f),t.apply(c,c),t.apply(d,d),t.apply(p,p),Math.max(f.x,c.x,d.x,p.x)<=o||Math.min(f.x,c.x,d.x,p.x)>=h||Math.max(f.y,c.y,d.y,p.y)<=u||Math.min(f.y,c.y,d.y,p.y)>=l))return!1;var _=v*(c.y-f.y),m=v*(f.x-c.x),g=_*o+m*u,y=_*h+m*u,b=_*o+m*l,x=_*h+m*l;if(Math.max(g,y,b,x)<=_*f.x+m*f.y||Math.min(g,y,b,x)>=_*p.x+m*p.y)return!1;var T=v*(f.y-d.y),w=v*(d.x-f.x),A=T*o+w*u,S=T*h+w*u,E=T*o+w*l,D=T*h+w*l;return!(Math.max(A,S,E,D)<=T*f.x+w*f.y||Math.min(A,S,E,D)>=T*p.x+w*p.y)},r.prototype.pad=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this},r.prototype.fit=function(e){var t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=n,this.height=Math.max(s-n,0),this},r.prototype.ceil=function(e,t){e===void 0&&(e=1),t===void 0&&(t=.001);var i=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=n-this.y,this},r.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=n,this.height=s-n,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),_o=function(){function r(e,t,i){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),this.x=e,this.y=t,this.radius=i,this.type=bt.CIRC}return r.prototype.clone=function(){return new r(this.x,this.y,this.radius)},r.prototype.contains=function(e,t){if(this.radius<=0)return!1;var i=this.radius*this.radius,n=this.x-e,s=this.y-t;return n*=n,s*=s,n+s<=i},r.prototype.getBounds=function(){return new j(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)},r.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},r}(),mo=function(){function r(e,t,i,n){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=e,this.y=t,this.width=i,this.height=n,this.type=bt.ELIP}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var i=(e-this.x)/this.width,n=(t-this.y)/this.height;return i*=i,n*=n,i+n<=1},r.prototype.getBounds=function(){return new j(this.x-this.width,this.y-this.height,this.width,this.height)},r.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),yi=function(){function r(){for(var e=arguments,t=[],i=0;i<arguments.length;i++)t[i]=e[i];var n=Array.isArray(t[0])?t[0]:t;if(typeof n[0]!="number"){for(var s=[],a=0,o=n.length;a<o;a++)s.push(n[a].x,n[a].y);n=s}this.points=n,this.type=bt.POLY,this.closeStroke=!0}return r.prototype.clone=function(){var e=this.points.slice(),t=new r(e);return t.closeStroke=this.closeStroke,t},r.prototype.contains=function(e,t){for(var i=!1,n=this.points.length/2,s=0,a=n-1;s<n;a=s++){var o=this.points[s*2],h=this.points[s*2+1],u=this.points[a*2],l=this.points[a*2+1],f=h>t!=l>t&&e<(u-o)*((t-h)/(l-h))+o;f&&(i=!i)}return i},r.prototype.toString=function(){return"[@pixi/math:Polygon"+("closeStroke="+this.closeStroke)+("points="+this.points.reduce(function(e,t){return e+", "+t},"")+"]")},r}(),go=function(){function r(e,t,i,n,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=0),s===void 0&&(s=20),this.x=e,this.y=t,this.width=i,this.height=n,this.radius=s,this.type=bt.RREC}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height,this.radius)},r.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){var i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;var n=e-(this.x+i),s=t-(this.y+i),a=i*i;if(n*n+s*s<=a||(n=e-(this.x+this.width-i),n*n+s*s<=a)||(s=t-(this.y+this.height-i),n*n+s*s<=a)||(n=e-(this.x+i),n*n+s*s<=a))return!0}return!1},r.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+("width="+this.width+" height="+this.height+" radius="+this.radius+"]")},r}(),Oe=function(){function r(e,t,i,n){i===void 0&&(i=0),n===void 0&&(n=0),this._x=i,this._y=n,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return e===void 0&&(e=this.cb),t===void 0&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x="+0+" y="+0+" scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),gt=function(){function r(e,t,i,n,s,a){e===void 0&&(e=1),t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=0),a===void 0&&(a=0),this.array=null,this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=a}return r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.set=function(e,t,i,n,s,a){return this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=a,this},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},r.prototype.apply=function(e,t){t=t||new X;var i=e.x,n=e.y;return t.x=this.a*i+this.c*n+this.tx,t.y=this.b*i+this.d*n+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new X;var i=1/(this.a*this.d+this.c*-this.b),n=e.x,s=e.y;return t.x=this.d*i*n+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*s+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,a=this.tx;return this.a=n*t-this.b*i,this.b=n*i+this.b*t,this.c=s*t-this.d*i,this.d=s*i+this.d*t,this.tx=a*t-this.ty*i,this.ty=a*i+this.ty*t,this},r.prototype.append=function(e){var t=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*t+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this},r.prototype.setTransform=function(e,t,i,n,s,a,o,h,u){return this.a=Math.cos(o+u)*s,this.b=Math.sin(o+u)*s,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=e-(i*this.a+n*this.c),this.ty=t-(i*this.b+n*this.d),this},r.prototype.prepend=function(e){var t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.decompose=function(e){var t=this.a,i=this.b,n=this.c,s=this.d,a=e.pivot,o=-Math.atan2(-n,s),h=Math.atan2(i,t),u=Math.abs(o+h);return u<1e-5||Math.abs(Wt-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=h),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(a.x*t+a.y*n),e.position.y=this.ty+(a.x*i+a.y*s),e},r.prototype.invert=function(){var e=this.a,t=this.b,i=this.c,n=this.d,s=this.tx,a=e*n-t*i;return this.a=n/a,this.b=-t/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(e*this.ty-t*s)/a,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},r.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+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),de=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],pe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ve=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],_e=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],cr=[],Xn=[],xi=Math.sign;function yo(){for(var r=0;r<16;r++){var e=[];cr.push(e);for(var t=0;t<16;t++)for(var i=xi(de[r]*de[t]+ve[r]*pe[t]),n=xi(pe[r]*de[t]+_e[r]*pe[t]),s=xi(de[r]*ve[t]+ve[r]*_e[t]),a=xi(pe[r]*ve[t]+_e[r]*_e[t]),o=0;o<16;o++)if(de[o]===i&&pe[o]===n&&ve[o]===s&&_e[o]===a){e.push(o);break}}for(var r=0;r<16;r++){var h=new gt;h.set(de[r],pe[r],ve[r],_e[r],0,0),Xn.push(h)}}yo();var ht={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:function(r){return de[r]},uY:function(r){return pe[r]},vX:function(r){return ve[r]},vY:function(r){return _e[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return cr[r][e]},sub:function(r,e){return cr[r][ht.inv(e)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,e){return Math.abs(r)*2<=Math.abs(e)?e>=0?ht.S:ht.N:Math.abs(e)*2<=Math.abs(r)?r>0?ht.E:ht.W:e>0?r>0?ht.SE:ht.SW:r>0?ht.NE:ht.NW},matrixAppendRotationInv:function(r,e,t,i){t===void 0&&(t=0),i===void 0&&(i=0);var n=Xn[ht.inv(e)];n.tx=t,n.ty=i,r.append(n)}},Wn=function(){function r(){this.worldTransform=new gt,this.localTransform=new gt,this.position=new Oe(this.onChange,this,0,0),this.scale=new Oe(this.onChange,this,1,1),this.pivot=new Oe(this.onChange,this,0,0),this.skew=new Oe(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}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){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++},r.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+") ")+"]"},r.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(e){var 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!==e._worldID){var i=e.worldTransform,n=this.worldTransform;n.a=t.a*i.a+t.b*i.c,n.b=t.a*i.b+t.b*i.d,n.c=t.c*i.a+t.d*i.c,n.d=t.c*i.b+t.d*i.d,n.tx=t.tx*i.a+t.ty*i.c+i.tx,n.ty=t.tx*i.b+t.ty*i.d+i.ty,this._parentID=e._worldID,this._worldID++}},r.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();const me=new j;class xo{constructor(e={}){this._recursive=typeof e.recursive=="boolean"?e.recursive:!0,this._toggle=e.toggle||"visible",this._targetList=new Set}add(e){return this._targetList.add(e),this}addAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.add(e[t]);return this}remove(e){return this._targetList.delete(e),this}removeAll(e){for(let t=0,i=e.length;t<i;t++)this._targetList.delete(e[t]);return this}clear(){return this._targetList.clear(),this}cull(e,t=!1){return t||this.uncull(),this._targetList.forEach(i=>{t||i.getBounds(!1,me),this._recursive?this.cullRecursive(e,i,t):(t&&i._bounds.getRectangle(e),i[this._toggle]=me.right>e.left&&me.left<e.right&&me.bottom>e.top&&me.top<e.bottom)}),this}uncull(){return this._targetList.forEach(e=>{this._recursive?this.uncullRecursive(e):e[this._toggle]=!1}),this}cullRecursive(e,t,i){const n=i?t._bounds.getRectangle(me):t.getBounds(!0,me);if(t[this._toggle]=n.right>e.left&&n.left<e.right&&n.bottom>e.top&&n.top<e.bottom,!(n.left>=e.left&&n.top>=e.top&&n.right<=e.right&&n.bottom<=e.bottom)&&t[this._toggle]&&t.children&&t.children.length){const a=t.children;for(let o=0,h=a.length;o<h;o++)this.cullRecursive(e,a[o])}}uncullRecursive(e){if(e[this._toggle]=!0,e.children&&e.children.length){const t=e.children;for(let i=0,n=t.length;i<n;i++)this.uncullRecursive(t[i])}}}function bo(r){var e=this.constructor;return this.then(function(t){return e.resolve(r()).then(function(){return t})},function(t){return e.resolve(r()).then(function(){return e.reject(t)})})}function To(r){var e=this;return new e(function(t,i){if(!(r&&typeof r.length<"u"))return i(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(r);if(n.length===0)return t([]);var s=n.length;function a(h,u){if(u&&(typeof u=="object"||typeof u=="function")){var l=u.then;if(typeof l=="function"){l.call(u,function(f){a(h,f)},function(f){n[h]={status:"rejected",reason:f},--s===0&&t(n)});return}}n[h]={status:"fulfilled",value:u},--s===0&&t(n)}for(var o=0;o<n.length;o++)a(o,n[o])})}var wo=setTimeout;function jn(r){return Boolean(r&&typeof r.length<"u")}function Eo(){}function So(r,e){return function(){r.apply(e,arguments)}}function lt(r){if(!(this instanceof lt))throw new TypeError("Promises must be constructed via new");if(typeof r!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],Yn(r,this)}function zn(r,e){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(e);return}r._handled=!0,lt._immediateFn(function(){var t=r._state===1?e.onFulfilled:e.onRejected;if(t===null){(r._state===1?dr:ze)(e.promise,r._value);return}var i;try{i=t(r._value)}catch(n){ze(e.promise,n);return}dr(e.promise,i)})}function dr(r,e){try{if(e===r)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e=="object"||typeof e=="function")){var t=e.then;if(e instanceof lt){r._state=3,r._value=e,pr(r);return}else if(typeof t=="function"){Yn(So(t,e),r);return}}r._state=1,r._value=e,pr(r)}catch(i){ze(r,i)}}function ze(r,e){r._state=2,r._value=e,pr(r)}function pr(r){r._state===2&&r._deferreds.length===0&&lt._immediateFn(function(){r._handled||lt._unhandledRejectionFn(r._value)});for(var e=0,t=r._deferreds.length;e<t;e++)zn(r,r._deferreds[e]);r._deferreds=null}function Po(r,e,t){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function Yn(r,e){var t=!1;try{r(function(i){t||(t=!0,dr(e,i))},function(i){t||(t=!0,ze(e,i))})}catch(i){if(t)return;t=!0,ze(e,i)}}lt.prototype.catch=function(r){return this.then(null,r)},lt.prototype.then=function(r,e){var t=new this.constructor(Eo);return zn(this,new Po(r,e,t)),t},lt.prototype.finally=bo,lt.all=function(r){return new lt(function(e,t){if(!jn(r))return t(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return e([]);var n=i.length;function s(o,h){try{if(h&&(typeof h=="object"||typeof h=="function")){var u=h.then;if(typeof u=="function"){u.call(h,function(l){s(o,l)},t);return}}i[o]=h,--n===0&&e(i)}catch(l){t(l)}}for(var a=0;a<i.length;a++)s(a,i[a])})},lt.allSettled=To,lt.resolve=function(r){return r&&typeof r=="object"&&r.constructor===lt?r:new lt(function(e){e(r)})},lt.reject=function(r){return new lt(function(e,t){t(r)})},lt.race=function(r){return new lt(function(e,t){if(!jn(r))return t(new TypeError("Promise.race accepts an array"));for(var i=0,n=r.length;i<n;i++)lt.resolve(r[i]).then(e,t)})},lt._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){wo(r,0)},lt._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var Vn=Object.getOwnPropertySymbols,Ro=Object.prototype.hasOwnProperty,Co=Object.prototype.propertyIsEnumerable;function Ao(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Io(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var e={},t=0;t<10;t++)e["_"+String.fromCharCode(t)]=t;var i=Object.getOwnPropertyNames(e).map(function(s){return e[s]});if(i.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(s){n[s]=s}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var Oo=Io()?Object.assign:function(r,e){for(var t,i=Ao(r),n,s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var a in t)Ro.call(t,a)&&(i[a]=t[a]);if(Vn){n=Vn(t);for(var o=0;o<n.length;o++)Co.call(t,n[o])&&(i[n[o]]=t[n[o]])}}return i};typeof globalThis>"u"&&(typeof self<"u"?self.globalThis=self:typeof global<"u"&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=lt),Object.assign||(Object.assign=Oo);var Mo=16;if(Date.now&&Date.prototype.getTime||(Date.now=function(){return new Date().getTime()}),!(globalThis.performance&&globalThis.performance.now)){var Do=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-Do}}for(var _r=Date.now(),qn=["ms","moz","webkit","o"],mr=0;mr<qn.length&&!globalThis.requestAnimationFrame;++mr){var gr=qn[mr];globalThis.requestAnimationFrame=globalThis[gr+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[gr+"CancelAnimationFrame"]||globalThis[gr+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(r){if(typeof r!="function")throw new TypeError(r+"is not a function");var e=Date.now(),t=Mo+_r-e;return t<0&&(t=0),_r=e,globalThis.self.setTimeout(function(){_r=Date.now(),r(performance.now())},t)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(r){return clearTimeout(r)}),Math.sign||(Math.sign=function(e){return e=Number(e),e===0||isNaN(e)?e:e>0?1:-1}),Number.isInteger||(Number.isInteger=function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array);var Qt;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(Qt||(Qt={}));var Ye;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Ye||(Ye={}));var bi;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(bi||(bi={}));var G;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(G||(G={}));var Dt;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(Dt||(Dt={}));var R;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(R||(R={}));var ge;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(ge||(ge={}));var L;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})(L||(L={}));var Ti;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(Ti||(Ti={}));var jt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(jt||(jt={}));var zt;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(zt||(zt={}));var Ft;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(Ft||(Ft={}));var Nt;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(Nt||(Nt={}));var Bt;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(Bt||(Bt={}));var wi;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(wi||(wi={}));var It;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(It||(It={}));var mt;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(mt||(mt={}));var $n;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})($n||($n={}));var ft;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(ft||(ft={}));var Yt;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(Yt||(Yt={}));var Fo={createCanvas:function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,t},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,e){return fetch(r,e)}},yr=/iPhone/i,Zn=/iPod/i,Kn=/iPad/i,Qn=/\biOS-universal(?:.+)Mac\b/i,xr=/\bAndroid(?:.+)Mobile\b/i,Jn=/Android/i,Me=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ei=/Silk/i,Jt=/Windows Phone/i,ts=/\bWindows(?:.+)ARM\b/i,es=/BlackBerry/i,is=/BB10/i,rs=/Opera Mini/i,ns=/\b(CriOS|Chrome)(?:.+)Mobile/i,ss=/Mobile(?:.+)Firefox\b/i,as=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function No(r){return function(e){return e.test(r)}}function Bo(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=No(t),s={apple:{phone:n(yr)&&!n(Jt),ipod:n(Zn),tablet:!n(yr)&&(n(Kn)||as(e))&&!n(Jt),universal:n(Qn),device:(n(yr)||n(Zn)||n(Kn)||n(Qn)||as(e))&&!n(Jt)},amazon:{phone:n(Me),tablet:!n(Me)&&n(Ei),device:n(Me)||n(Ei)},android:{phone:!n(Jt)&&n(Me)||!n(Jt)&&n(xr),tablet:!n(Jt)&&!n(Me)&&!n(xr)&&(n(Ei)||n(Jn)),device:!n(Jt)&&(n(Me)||n(Ei)||n(xr)||n(Jn))||n(/\bokhttp\b/i)},windows:{phone:n(Jt),tablet:n(ts),device:n(Jt)||n(ts)},other:{blackberry:n(es),blackberry10:n(is),opera:n(rs),firefox:n(ss),chrome:n(ns),device:n(es)||n(is)||n(rs)||n(ss)||n(ns)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var Vt=Bo(globalThis.navigator);function Lo(){return!Vt.apple.device}function Uo(r){var e=!0;if(Vt.tablet||Vt.phone){if(Vt.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var i=parseInt(t[1],10);i<11&&(e=!1)}}if(Vt.android.device){var t=navigator.userAgent.match(/Android\s([0-9.]*)/);if(t){var i=parseInt(t[1],10);i<7&&(e=!1)}}}return e?r:4}var F={ADAPTER:Fo,MIPMAP_TEXTURES:Ft.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:ft.NONE,SPRITE_MAX_TEXTURES:Uo(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:wi.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:zt.CLAMP,SCALE_MODE:jt.LINEAR,PRECISION_VERTEX:It.HIGH,PRECISION_FRAGMENT:Vt.apple.device?It.HIGH:It.MEDIUM,CAN_UPLOAD_SAME_BUFFER:Lo(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},os={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(h,u,l){this.fn=h,this.context=u,this.once=l||!1}function s(h,u,l,f,c){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new n(l,f||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],d]:h._events[p].push(d):(h._events[p]=d,h._eventsCount++),h}function a(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],l,f;if(this._eventsCount===0)return u;for(f in l=this._events)e.call(l,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},o.prototype.listeners=function(u){var l=t?t+u:u,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var c=0,d=f.length,p=new Array(d);c<d;c++)p[c]=f[c].fn;return p},o.prototype.listenerCount=function(u){var l=t?t+u:u,f=this._events[l];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,l,f,c,d,p){var v=t?t+u:u;if(!this._events[v])return!1;var _=this._events[v],m=arguments.length,g,y;if(_.fn){switch(_.once&&this.removeListener(u,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,l),!0;case 3:return _.fn.call(_.context,l,f),!0;case 4:return _.fn.call(_.context,l,f,c),!0;case 5:return _.fn.call(_.context,l,f,c,d),!0;case 6:return _.fn.call(_.context,l,f,c,d,p),!0}for(y=1,g=new Array(m-1);y<m;y++)g[y-1]=arguments[y];_.fn.apply(_.context,g)}else{var b=_.length,x;for(y=0;y<b;y++)switch(_[y].once&&this.removeListener(u,_[y].fn,void 0,!0),m){case 1:_[y].fn.call(_[y].context);break;case 2:_[y].fn.call(_[y].context,l);break;case 3:_[y].fn.call(_[y].context,l,f);break;case 4:_[y].fn.call(_[y].context,l,f,c);break;default:if(!g)for(x=1,g=new Array(m-1);x<m;x++)g[x-1]=arguments[x];_[y].fn.apply(_[y].context,g)}}return!0},o.prototype.on=function(u,l,f){return s(this,u,l,f,!1)},o.prototype.once=function(u,l,f){return s(this,u,l,f,!0)},o.prototype.removeListener=function(u,l,f,c){var d=t?t+u:u;if(!this._events[d])return this;if(!l)return a(this,d),this;var p=this._events[d];if(p.fn)p.fn===l&&(!c||p.once)&&(!f||p.context===f)&&a(this,d);else{for(var v=0,_=[],m=p.length;v<m;v++)(p[v].fn!==l||c&&!p[v].once||f&&p[v].context!==f)&&_.push(p[v]);_.length?this._events[d]=_.length===1?_[0]:_:a(this,d)}return this},o.prototype.removeAllListeners=function(u){var l;return u?(l=t?t+u:u,this._events[l]&&a(this,l)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,r.exports=o})(os);const Ve=os.exports;var Si={exports:{}};Si.exports=Pi,Si.exports.default=Pi;function Pi(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,s=hs(r,0,n,t,!0),a=[];if(!s||s.next===s.prev)return a;var o,h,u,l,f,c,d;if(i&&(s=Wo(r,e,s,t)),r.length>80*t){o=u=r[0],h=l=r[1];for(var p=t;p<n;p+=t)f=r[p],c=r[p+1],f<o&&(o=f),c<h&&(h=c),f>u&&(u=f),c>l&&(l=c);d=Math.max(u-o,l-h),d=d!==0?32767/d:0}return qe(s,a,t,o,h,d,0),a}function hs(r,e,t,i,n){var s,a;if(n===wr(r,e,t,i)>0)for(s=e;s<t;s+=i)a=fs(s,r[s],r[s+1],a);else for(s=t-i;s>=e;s-=i)a=fs(s,r[s],r[s+1],a);return a&&Ri(a,a.next)&&(Ze(a),a=a.next),a}function ye(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(Ri(t,t.next)||ut(t.prev,t,t.next)===0)){if(Ze(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function qe(r,e,t,i,n,s,a){if(r){!a&&s&&qo(r,i,n,s);for(var o=r,h,u;r.prev!==r.next;){if(h=r.prev,u=r.next,s?ko(r,i,n,s):Go(r)){e.push(h.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),Ze(r),r=u.next,o=u.next;continue}if(r=u,r===o){a?a===1?(r=Ho(ye(r),e,t),qe(r,e,t,i,n,s,2)):a===2&&Xo(r,e,t,i,n,s):qe(ye(r),e,t,i,n,s,1);break}}}}function Go(r){var e=r.prev,t=r,i=r.next;if(ut(e,t,i)>=0)return!1;for(var n=e.x,s=t.x,a=i.x,o=e.y,h=t.y,u=i.y,l=n<s?n<a?n:a:s<a?s:a,f=o<h?o<u?o:u:h<u?h:u,c=n>s?n>a?n:a:s>a?s:a,d=o>h?o>u?o:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=l&&p.x<=c&&p.y>=f&&p.y<=d&&De(n,o,s,h,a,u,p.x,p.y)&&ut(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function ko(r,e,t,i){var n=r.prev,s=r,a=r.next;if(ut(n,s,a)>=0)return!1;for(var o=n.x,h=s.x,u=a.x,l=n.y,f=s.y,c=a.y,d=o<h?o<u?o:u:h<u?h:u,p=l<f?l<c?l:c:f<c?f:c,v=o>h?o>u?o:u:h>u?h:u,_=l>f?l>c?l:c:f>c?f:c,m=br(d,p,e,t,i),g=br(v,_,e,t,i),y=r.prevZ,b=r.nextZ;y&&y.z>=m&&b&&b.z<=g;){if(y.x>=d&&y.x<=v&&y.y>=p&&y.y<=_&&y!==n&&y!==a&&De(o,l,h,f,u,c,y.x,y.y)&&ut(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==a&&De(o,l,h,f,u,c,b.x,b.y)&&ut(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=m;){if(y.x>=d&&y.x<=v&&y.y>=p&&y.y<=_&&y!==n&&y!==a&&De(o,l,h,f,u,c,y.x,y.y)&&ut(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=g;){if(b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==a&&De(o,l,h,f,u,c,b.x,b.y)&&ut(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ho(r,e,t){var i=r;do{var n=i.prev,s=i.next.next;!Ri(n,s)&&us(n,i,i.next,s)&&$e(n,s)&&$e(s,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Ze(i),Ze(i.next),i=r=s),i=i.next}while(i!==r);return ye(i)}function Xo(r,e,t,i,n,s){var a=r;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Ko(a,o)){var h=ls(a,o);a=ye(a,a.next),h=ye(h,h.next),qe(a,e,t,i,n,s,0),qe(h,e,t,i,n,s,0);return}o=o.next}a=a.next}while(a!==r)}function Wo(r,e,t,i){var n=[],s,a,o,h,u;for(s=0,a=e.length;s<a;s++)o=e[s]*i,h=s<a-1?e[s+1]*i:r.length,u=hs(r,o,h,i,!1),u===u.next&&(u.steiner=!0),n.push(Zo(u));for(n.sort(jo),s=0;s<n.length;s++)t=zo(n[s],t);return t}function jo(r,e){return r.x-e.x}function zo(r,e){var t=Yo(r,e);if(!t)return e;var i=ls(t,r);return ye(i,i.next),ye(t,t.next)}function Yo(r,e){var t=e,i=r.x,n=r.y,s=-1/0,a;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var o=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=i&&o>s&&(s=o,a=t.x<t.next.x?t:t.next,o===i))return a}t=t.next}while(t!==e);if(!a)return null;var h=a,u=a.x,l=a.y,f=1/0,c;t=a;do i>=t.x&&t.x>=u&&i!==t.x&&De(n<l?i:s,n,u,l,n<l?s:i,n,t.x,t.y)&&(c=Math.abs(n-t.y)/(i-t.x),$e(t,r)&&(c<f||c===f&&(t.x>a.x||t.x===a.x&&Vo(a,t)))&&(a=t,f=c)),t=t.next;while(t!==h);return a}function Vo(r,e){return ut(r.prev,r,e.prev)<0&&ut(e.next,r,r.next)<0}function qo(r,e,t,i){var n=r;do n.z===0&&(n.z=br(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,$o(n)}function $o(r){var e,t,i,n,s,a,o,h,u=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,i=t,o=0,e=0;e<u&&(o++,i=i.nextZ,!!i);e++);for(h=u;o>0||h>0&&i;)o!==0&&(h===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,o--):(n=i,i=i.nextZ,h--),s?s.nextZ=n:r=n,n.prevZ=s,s=n;t=i}s.nextZ=null,u*=2}while(a>1);return r}function br(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Zo(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function De(r,e,t,i,n,s,a,o){return(n-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(n-a)*(i-o)}function Ko(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Qo(r,e)&&($e(r,e)&&$e(e,r)&&Jo(r,e)&&(ut(r.prev,r,e.prev)||ut(r,e.prev,e))||Ri(r,e)&&ut(r.prev,r,r.next)>0&&ut(e.prev,e,e.next)>0)}function ut(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Ri(r,e){return r.x===e.x&&r.y===e.y}function us(r,e,t,i){var n=Ai(ut(r,e,t)),s=Ai(ut(r,e,i)),a=Ai(ut(t,i,r)),o=Ai(ut(t,i,e));return!!(n!==s&&a!==o||n===0&&Ci(r,t,e)||s===0&&Ci(r,i,e)||a===0&&Ci(t,r,i)||o===0&&Ci(t,e,i))}function Ci(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Ai(r){return r>0?1:r<0?-1:0}function Qo(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&us(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function $e(r,e){return ut(r.prev,r,r.next)<0?ut(r,e,r.next)>=0&&ut(r,r.prev,e)>=0:ut(r,e,r.prev)<0||ut(r,r.next,e)<0}function Jo(r,e){var t=r,i=!1,n=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function ls(r,e){var t=new Tr(r.i,r.x,r.y),i=new Tr(e.i,e.x,e.y),n=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function fs(r,e,t,i){var n=new Tr(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Ze(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Tr(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Pi.deviation=function(r,e,t,i){var n=e&&e.length,s=n?e[0]*t:r.length,a=Math.abs(wr(r,0,s,t));if(n)for(var o=0,h=e.length;o<h;o++){var u=e[o]*t,l=o<h-1?e[o+1]*t:r.length;a-=Math.abs(wr(r,u,l,t))}var f=0;for(o=0;o<i.length;o+=3){var c=i[o]*t,d=i[o+1]*t,p=i[o+2]*t;f+=Math.abs((r[c]-r[p])*(r[d+1]-r[c+1])-(r[c]-r[d])*(r[p+1]-r[c+1]))}return a===0&&f===0?0:Math.abs((f-a)/a)};function wr(r,e,t,i){for(var n=0,s=e,a=t-i;s<t;s+=i)n+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return n}Pi.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,n=0;n<r.length;n++){for(var s=0;s<r[n].length;s++)for(var a=0;a<e;a++)t.vertices.push(r[n][s][a]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t};var Er={exports:{}};(function(r,e){(function(t){var i=e&&!e.nodeType&&e,n=r&&!r.nodeType&&r,s=typeof vr=="object"&&vr;(s.global===s||s.window===s||s.self===s)&&(t=s);var a,o=2147483647,h=36,u=1,l=26,f=38,c=700,d=72,p=128,v="-",_=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-u,x=Math.floor,T=String.fromCharCode,w;function A(I){throw RangeError(y[I])}function S(I,P){for(var B=I.length,$=[];B--;)$[B]=P(I[B]);return $}function E(I,P){var B=I.split("@"),$="";B.length>1&&($=B[0]+"@",I=B[1]),I=I.replace(g,".");var Z=I.split("."),vt=S(Z,P).join(".");return $+vt}function D(I){for(var P=[],B=0,$=I.length,Z,vt;B<$;)Z=I.charCodeAt(B++),Z>=55296&&Z<=56319&&B<$?(vt=I.charCodeAt(B++),(vt&64512)==56320?P.push(((Z&1023)<<10)+(vt&1023)+65536):(P.push(Z),B--)):P.push(Z);return P}function C(I){return S(I,function(P){var B="";return P>65535&&(P-=65536,B+=T(P>>>10&1023|55296),P=56320|P&1023),B+=T(P),B}).join("")}function N(I){return I-48<10?I-22:I-65<26?I-65:I-97<26?I-97:h}function W(I,P){return I+22+75*(I<26)-((P!=0)<<5)}function M(I,P,B){var $=0;for(I=B?x(I/c):I>>1,I+=x(I/P);I>b*l>>1;$+=h)I=x(I/b);return x($+(b+1)*I/(I+f))}function O(I){var P=[],B=I.length,$,Z=0,vt=p,st=d,at,wt,St,_t,et,nt,ot,q,Rt;for(at=I.lastIndexOf(v),at<0&&(at=0),wt=0;wt<at;++wt)I.charCodeAt(wt)>=128&&A("not-basic"),P.push(I.charCodeAt(wt));for(St=at>0?at+1:0;St<B;){for(_t=Z,et=1,nt=h;St>=B&&A("invalid-input"),ot=N(I.charCodeAt(St++)),(ot>=h||ot>x((o-Z)/et))&&A("overflow"),Z+=ot*et,q=nt<=st?u:nt>=st+l?l:nt-st,!(ot<q);nt+=h)Rt=h-q,et>x(o/Rt)&&A("overflow"),et*=Rt;$=P.length+1,st=M(Z-_t,$,_t==0),x(Z/$)>o-vt&&A("overflow"),vt+=x(Z/$),Z%=$,P.splice(Z++,0,vt)}return C(P)}function U(I){var P,B,$,Z,vt,st,at,wt,St,_t,et,nt=[],ot,q,Rt,Ct;for(I=D(I),ot=I.length,P=p,B=0,vt=d,st=0;st<ot;++st)et=I[st],et<128&&nt.push(T(et));for($=Z=nt.length,Z&&nt.push(v);$<ot;){for(at=o,st=0;st<ot;++st)et=I[st],et>=P&&et<at&&(at=et);for(q=$+1,at-P>x((o-B)/q)&&A("overflow"),B+=(at-P)*q,P=at,st=0;st<ot;++st)if(et=I[st],et<P&&++B>o&&A("overflow"),et==P){for(wt=B,St=h;_t=St<=vt?u:St>=vt+l?l:St-vt,!(wt<_t);St+=h)Ct=wt-_t,Rt=h-_t,nt.push(T(W(_t+Ct%Rt,0))),wt=x(Ct/Rt);nt.push(T(W(wt,0))),vt=M(B,q,$==Z),B=0,++$}++B,++P}return nt.join("")}function rt(I){return E(I,function(P){return _.test(P)?O(P.slice(4).toLowerCase()):P})}function z(I){return E(I,function(P){return m.test(P)?"xn--"+U(P):P})}if(a={version:"1.3.2",ucs2:{decode:D,encode:C},decode:O,encode:U,toASCII:z,toUnicode:rt},i&&n)if(r.exports==i)n.exports=a;else for(w in a)a.hasOwnProperty(w)&&(i[w]=a[w]);else t.punycode=a})(vr)})(Er,Er.exports);var th={isString:function(r){return typeof r=="string"},isObject:function(r){return typeof r=="object"&&r!==null},isNull:function(r){return r===null},isNullOrUndefined:function(r){return r==null}},Ke={};function eh(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var ih=function(r,e,t,i){e=e||"&",t=t||"=";var n={};if(typeof r!="string"||r.length===0)return n;var s=/\+/g;r=r.split(e);var a=1e3;i&&typeof i.maxKeys=="number"&&(a=i.maxKeys);var o=r.length;a>0&&o>a&&(o=a);for(var h=0;h<o;++h){var u=r[h].replace(s,"%20"),l=u.indexOf(t),f,c,d,p;l>=0?(f=u.substr(0,l),c=u.substr(l+1)):(f=u,c=""),d=decodeURIComponent(f),p=decodeURIComponent(c),eh(n,d)?Array.isArray(n[d])?n[d].push(p):n[d]=[n[d],p]:n[d]=p}return n},Qe=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}},rh=function(r,e,t,i){return e=e||"&",t=t||"=",r===null&&(r=void 0),typeof r=="object"?Object.keys(r).map(function(n){var s=encodeURIComponent(Qe(n))+t;return Array.isArray(r[n])?r[n].map(function(a){return s+encodeURIComponent(Qe(a))}).join(e):s+encodeURIComponent(Qe(r[n]))}).join(e):i?encodeURIComponent(Qe(i))+t+encodeURIComponent(Qe(r)):""};Ke.decode=Ke.parse=ih,Ke.encode=Ke.stringify=rh;var nh=Er.exports,qt=th,sh=Ii,ah=mh,oh=_h;function Lt(){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 hh=/^([a-z0-9.+-]+:)/i,uh=/:[0-9]*$/,lh=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,fh=["<",">",'"',"`"," ","\r",`
2
+ `," "],ch=["{","}","|","\\","^","`"].concat(fh),Sr=["'"].concat(ch),cs=["%","/","?",";","#"].concat(Sr),ds=["/","?","#"],dh=255,ps=/^[+a-z0-9A-Z_-]{0,63}$/,ph=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,vh={javascript:!0,"javascript:":!0},Pr={javascript:!0,"javascript:":!0},Fe={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Rr=Ke;function Ii(r,e,t){if(r&&qt.isObject(r)&&r instanceof Lt)return r;var i=new Lt;return i.parse(r,e,t),i}Lt.prototype.parse=function(r,e,t){if(!qt.isString(r))throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),n=i!==-1&&i<r.indexOf("#")?"?":"#",s=r.split(n),a=/\\/g;s[0]=s[0].replace(a,"/"),r=s.join(n);var o=r;if(o=o.trim(),!t&&r.split("#").length===1){var h=lh.exec(o);if(h)return this.path=o,this.href=o,this.pathname=h[1],h[2]?(this.search=h[2],e?this.query=Rr.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=hh.exec(o);if(u){u=u[0];var l=u.toLowerCase();this.protocol=l,o=o.substr(u.length)}if(t||u||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=o.substr(0,2)==="//";f&&!(u&&Pr[u])&&(o=o.substr(2),this.slashes=!0)}if(!Pr[u]&&(f||u&&!Fe[u])){for(var c=-1,d=0;d<ds.length;d++){var p=o.indexOf(ds[d]);p!==-1&&(c===-1||p<c)&&(c=p)}var v,_;c===-1?_=o.lastIndexOf("@"):_=o.lastIndexOf("@",c),_!==-1&&(v=o.slice(0,_),o=o.slice(_+1),this.auth=decodeURIComponent(v)),c=-1;for(var d=0;d<cs.length;d++){var p=o.indexOf(cs[d]);p!==-1&&(c===-1||p<c)&&(c=p)}c===-1&&(c=o.length),this.host=o.slice(0,c),o=o.slice(c),this.parseHost(),this.hostname=this.hostname||"";var m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m)for(var g=this.hostname.split(/\./),d=0,y=g.length;d<y;d++){var b=g[d];if(b&&!b.match(ps)){for(var x="",T=0,w=b.length;T<w;T++)b.charCodeAt(T)>127?x+="x":x+=b[T];if(!x.match(ps)){var A=g.slice(0,d),S=g.slice(d+1),E=b.match(ph);E&&(A.push(E[1]),S.unshift(E[2])),S.length&&(o="/"+S.join(".")+o),this.hostname=A.join(".");break}}}this.hostname.length>dh?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=nh.toASCII(this.hostname));var D=this.port?":"+this.port:"",C=this.hostname||"";this.host=C+D,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!vh[l])for(var d=0,y=Sr.length;d<y;d++){var N=Sr[d];if(o.indexOf(N)!==-1){var W=encodeURIComponent(N);W===N&&(W=escape(N)),o=o.split(N).join(W)}}var M=o.indexOf("#");M!==-1&&(this.hash=o.substr(M),o=o.slice(0,M));var O=o.indexOf("?");if(O!==-1?(this.search=o.substr(O),this.query=o.substr(O+1),e&&(this.query=Rr.parse(this.query)),o=o.slice(0,O)):e&&(this.search="",this.query={}),o&&(this.pathname=o),Fe[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var D=this.pathname||"",U=this.search||"";this.path=D+U}return this.href=this.format(),this};function _h(r){return qt.isString(r)&&(r=Ii(r)),r instanceof Lt?r.format():Lt.prototype.format.call(r)}Lt.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",n=!1,s="";this.host?n=r+this.host:this.hostname&&(n=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&qt.isObject(this.query)&&Object.keys(this.query).length&&(s=Rr.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Fe[e])&&n!==!1?(n="//"+(n||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):n||(n=""),i&&i.charAt(0)!=="#"&&(i="#"+i),a&&a.charAt(0)!=="?"&&(a="?"+a),t=t.replace(/[?#]/g,function(o){return encodeURIComponent(o)}),a=a.replace("#","%23"),e+n+t+a+i};function mh(r,e){return Ii(r,!1,!0).resolve(e)}Lt.prototype.resolve=function(r){return this.resolveObject(Ii(r,!1,!0)).format()},Lt.prototype.resolveObject=function(r){if(qt.isString(r)){var e=new Lt;e.parse(r,!1,!0),r=e}for(var t=new Lt,i=Object.keys(this),n=0;n<i.length;n++){var s=i[n];t[s]=this[s]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var a=Object.keys(r),o=0;o<a.length;o++){var h=a[o];h!=="protocol"&&(t[h]=r[h])}return Fe[t.protocol]&&t.hostname&&!t.pathname&&(t.path=t.pathname="/"),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!Fe[r.protocol]){for(var u=Object.keys(r),l=0;l<u.length;l++){var f=u[l];t[f]=r[f]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!Pr[r.protocol]){for(var y=(r.pathname||"").split("/");y.length&&!(r.host=y.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),t.pathname=y.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var c=t.pathname||"",d=t.search||"";t.path=c+d}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var p=t.pathname&&t.pathname.charAt(0)==="/",v=r.host||r.pathname&&r.pathname.charAt(0)==="/",_=v||p||t.host&&r.pathname,m=_,g=t.pathname&&t.pathname.split("/")||[],y=r.pathname&&r.pathname.split("/")||[],b=t.protocol&&!Fe[t.protocol];if(b&&(t.hostname="",t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host=null),_=_&&(y[0]===""||g[0]==="")),v)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,g=y;else if(y.length)g||(g=[]),g.pop(),g=g.concat(y),t.search=r.search,t.query=r.query;else if(!qt.isNullOrUndefined(r.search)){if(b){t.hostname=t.host=g.shift();var x=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;x&&(t.auth=x.shift(),t.host=t.hostname=x.shift())}return t.search=r.search,t.query=r.query,(!qt.isNull(t.pathname)||!qt.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!g.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var T=g.slice(-1)[0],w=(t.host||r.host||g.length>1)&&(T==="."||T==="..")||T==="",A=0,S=g.length;S>=0;S--)T=g[S],T==="."?g.splice(S,1):T===".."?(g.splice(S,1),A++):A&&(g.splice(S,1),A--);if(!_&&!m)for(;A--;A)g.unshift("..");_&&g[0]!==""&&(!g[0]||g[0].charAt(0)!=="/")&&g.unshift(""),w&&g.join("/").substr(-1)!=="/"&&g.push("");var E=g[0]===""||g[0]&&g[0].charAt(0)==="/";if(b){t.hostname=t.host=E?"":g.length?g.shift():"";var x=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;x&&(t.auth=x.shift(),t.host=t.hostname=x.shift())}return _=_||t.host&&g.length,_&&!E&&g.unshift(""),g.length?t.pathname=g.join("/"):(t.pathname=null,t.path=null),(!qt.isNull(t.pathname)||!qt.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t},Lt.prototype.parseHost=function(){var r=this.host,e=uh.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};var Ne={parse:sh,format:oh,resolve:ah};F.RETINA_PREFIX=/@([0-9\.]+)x/,F.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Cr=!1,vs="6.5.8";function gh(){Cr=!0}function yh(r){var e;if(!Cr){if(F.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[`
3
+ %c %c %c PixiJS `+vs+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥
4
4
 
5
- `,"background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,t)}else globalThis.console&&globalThis.console.log("PixiJS "+ps+" - "+r+" - http://www.pixijs.com/");ds=!0}}var Pr;function mh(){return typeof Pr>"u"&&(Pr=function(){var e={stencil:!0,failIfMajorPerformanceCaveat:F.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!F.ADAPTER.getWebGLRenderingContext())return!1;var t=F.ADAPTER.createCanvas(),i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),n=!!(i&&i.getContextAttributes().stencil);if(i){var s=i.getExtension("WEBGL_lose_context");s&&s.loseContext()}return i=null,n}catch{return!1}}()),Pr}var gh="#f0f8ff",yh="#faebd7",xh="#00ffff",bh="#7fffd4",Th="#f0ffff",wh="#f5f5dc",Eh="#ffe4c4",Sh="#000000",Ph="#ffebcd",Ch="#0000ff",Rh="#8a2be2",Ah="#a52a2a",Ih="#deb887",Oh="#5f9ea0",Mh="#7fff00",Dh="#d2691e",Fh="#ff7f50",Nh="#6495ed",Bh="#fff8dc",Lh="#dc143c",Uh="#00ffff",Gh="#00008b",kh="#008b8b",Hh="#b8860b",Xh="#a9a9a9",Wh="#006400",zh="#a9a9a9",jh="#bdb76b",Yh="#8b008b",Vh="#556b2f",qh="#ff8c00",$h="#9932cc",Zh="#8b0000",Kh="#e9967a",Qh="#8fbc8f",Jh="#483d8b",tu="#2f4f4f",eu="#2f4f4f",iu="#00ced1",ru="#9400d3",nu="#ff1493",su="#00bfff",au="#696969",ou="#696969",hu="#1e90ff",uu="#b22222",lu="#fffaf0",fu="#228b22",cu="#ff00ff",du="#dcdcdc",pu="#f8f8ff",vu="#daa520",_u="#ffd700",mu="#808080",gu="#008000",yu="#adff2f",xu="#808080",bu="#f0fff0",Tu="#ff69b4",wu="#cd5c5c",Eu="#4b0082",Su="#fffff0",Pu="#f0e68c",Cu="#fff0f5",Ru="#e6e6fa",Au="#7cfc00",Iu="#fffacd",Ou="#add8e6",Mu="#f08080",Du="#e0ffff",Fu="#fafad2",Nu="#d3d3d3",Bu="#90ee90",Lu="#d3d3d3",Uu="#ffb6c1",Gu="#ffa07a",ku="#20b2aa",Hu="#87cefa",Xu="#778899",Wu="#778899",zu="#b0c4de",ju="#ffffe0",Yu="#00ff00",Vu="#32cd32",qu="#faf0e6",$u="#ff00ff",Zu="#800000",Ku="#66cdaa",Qu="#0000cd",Ju="#ba55d3",tl="#9370db",el="#3cb371",il="#7b68ee",rl="#00fa9a",nl="#48d1cc",sl="#c71585",al="#191970",ol="#f5fffa",hl="#ffe4e1",ul="#ffe4b5",ll="#ffdead",fl="#000080",cl="#fdf5e6",dl="#808000",pl="#6b8e23",vl="#ffa500",_l="#ff4500",ml="#da70d6",gl="#eee8aa",yl="#98fb98",xl="#afeeee",bl="#db7093",Tl="#ffefd5",wl="#ffdab9",El="#cd853f",Sl="#ffc0cb",Pl="#dda0dd",Cl="#b0e0e6",Rl="#800080",Al="#663399",Il="#ff0000",Ol="#bc8f8f",Ml="#4169e1",Dl="#8b4513",Fl="#fa8072",Nl="#f4a460",Bl="#2e8b57",Ll="#fff5ee",Ul="#a0522d",Gl="#c0c0c0",kl="#87ceeb",Hl="#6a5acd",Xl="#708090",Wl="#708090",zl="#fffafa",jl="#00ff7f",Yl="#4682b4",Vl="#d2b48c",ql="#008080",$l="#d8bfd8",Zl="#ff6347",Kl="#40e0d0",Ql="#ee82ee",Jl="#f5deb3",tf="#ffffff",ef="#f5f5f5",rf="#ffff00",nf="#9acd32",sf={aliceblue:gh,antiquewhite:yh,aqua:xh,aquamarine:bh,azure:Th,beige:wh,bisque:Eh,black:Sh,blanchedalmond:Ph,blue:Ch,blueviolet:Rh,brown:Ah,burlywood:Ih,cadetblue:Oh,chartreuse:Mh,chocolate:Dh,coral:Fh,cornflowerblue:Nh,cornsilk:Bh,crimson:Lh,cyan:Uh,darkblue:Gh,darkcyan:kh,darkgoldenrod:Hh,darkgray:Xh,darkgreen:Wh,darkgrey:zh,darkkhaki:jh,darkmagenta:Yh,darkolivegreen:Vh,darkorange:qh,darkorchid:$h,darkred:Zh,darksalmon:Kh,darkseagreen:Qh,darkslateblue:Jh,darkslategray:tu,darkslategrey:eu,darkturquoise:iu,darkviolet:ru,deeppink:nu,deepskyblue:su,dimgray:au,dimgrey:ou,dodgerblue:hu,firebrick:uu,floralwhite:lu,forestgreen:fu,fuchsia:cu,gainsboro:du,ghostwhite:pu,goldenrod:vu,gold:_u,gray:mu,green:gu,greenyellow:yu,grey:xu,honeydew:bu,hotpink:Tu,indianred:wu,indigo:Eu,ivory:Su,khaki:Pu,lavenderblush:Cu,lavender:Ru,lawngreen:Au,lemonchiffon:Iu,lightblue:Ou,lightcoral:Mu,lightcyan:Du,lightgoldenrodyellow:Fu,lightgray:Nu,lightgreen:Bu,lightgrey:Lu,lightpink:Uu,lightsalmon:Gu,lightseagreen:ku,lightskyblue:Hu,lightslategray:Xu,lightslategrey:Wu,lightsteelblue:zu,lightyellow:ju,lime:Yu,limegreen:Vu,linen:qu,magenta:$u,maroon:Zu,mediumaquamarine:Ku,mediumblue:Qu,mediumorchid:Ju,mediumpurple:tl,mediumseagreen:el,mediumslateblue:il,mediumspringgreen:rl,mediumturquoise:nl,mediumvioletred:sl,midnightblue:al,mintcream:ol,mistyrose:hl,moccasin:ul,navajowhite:ll,navy:fl,oldlace:cl,olive:dl,olivedrab:pl,orange:vl,orangered:_l,orchid:ml,palegoldenrod:gl,palegreen:yl,paleturquoise:xl,palevioletred:bl,papayawhip:Tl,peachpuff:wl,peru:El,pink:Sl,plum:Pl,powderblue:Cl,purple:Rl,rebeccapurple:Al,red:Il,rosybrown:Ol,royalblue:Ml,saddlebrown:Dl,salmon:Fl,sandybrown:Nl,seagreen:Bl,seashell:Ll,sienna:Ul,silver:Gl,skyblue:kl,slateblue:Hl,slategray:Xl,slategrey:Wl,snow:zl,springgreen:jl,steelblue:Yl,tan:Vl,teal:ql,thistle:$l,tomato:Zl,turquoise:Kl,violet:Ql,wheat:Jl,white:tf,whitesmoke:ef,yellow:rf,yellowgreen:nf};function Fe(r,e){return e===void 0&&(e=[]),e[0]=(r>>16&255)/255,e[1]=(r>>8&255)/255,e[2]=(r&255)/255,e}function vs(r){var e=r.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function _s(r){return typeof r=="string"&&(r=sf[r.toLowerCase()]||r,r[0]==="#"&&(r=r.slice(1))),parseInt(r,16)}function af(){for(var r=[],e=[],t=0;t<32;t++)r[t]=t,e[t]=t;r[U.NORMAL_NPM]=U.NORMAL,r[U.ADD_NPM]=U.ADD,r[U.SCREEN_NPM]=U.SCREEN,e[U.NORMAL]=U.NORMAL_NPM,e[U.ADD]=U.ADD_NPM,e[U.SCREEN]=U.SCREEN_NPM;var i=[];return i.push(e),i.push(r),i}var ms=af();function gs(r,e){return ms[e?1:0][r]}function of(r,e,t,i){return t=t||new Float32Array(4),i||i===void 0?(t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e):(t[0]=r[0],t[1]=r[1],t[2]=r[2]),t[3]=e,t}function Cr(r,e){if(e===1)return(e*255<<24)+r;if(e===0)return 0;var t=r>>16&255,i=r>>8&255,n=r&255;return t=t*e+.5|0,i=i*e+.5|0,n=n*e+.5|0,(e*255<<24)+(t<<16)+(i<<8)+n}function ys(r,e,t,i){return t=t||new Float32Array(4),t[0]=(r>>16&255)/255,t[1]=(r>>8&255)/255,t[2]=(r&255)/255,(i||i===void 0)&&(t[0]*=e,t[1]*=e,t[2]*=e),t[3]=e,t}function hf(r,e){e===void 0&&(e=null);var t=r*6;if(e=e||new Uint16Array(t),e.length!==t)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+t);for(var i=0,n=0;i<t;i+=6,n+=4)e[i+0]=n+0,e[i+1]=n+1,e[i+2]=n+2,e[i+3]=n+0,e[i+4]=n+2,e[i+5]=n+3;return e}function xs(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Ai(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function bs(r){return!(r&r-1)&&!!r}function Ts(r){var e=(r>65535?1:0)<<4;r>>>=e;var t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function Ne(r,e,t){var i=r.length,n;if(!(e>=i||t===0)){t=e+t>i?i-e:t;var s=i-t;for(n=e;n<s;++n)r[n]=r[n+t];r.length=s}}function Be(r){return r===0?0:r<0?-1:1}var uf=0;function ge(){return++uf}var ws={};function Bt(r,e,t){if(t===void 0&&(t=3),!ws[e]){var i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",e+`
5
+ `,"background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,t)}else globalThis.console&&globalThis.console.log("PixiJS "+vs+" - "+r+" - http://www.pixijs.com/");Cr=!0}}var Ar;function xh(){return typeof Ar>"u"&&(Ar=function(){var e={stencil:!0,failIfMajorPerformanceCaveat:F.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!F.ADAPTER.getWebGLRenderingContext())return!1;var t=F.ADAPTER.createCanvas(),i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),n=!!(i&&i.getContextAttributes().stencil);if(i){var s=i.getExtension("WEBGL_lose_context");s&&s.loseContext()}return i=null,n}catch{return!1}}()),Ar}var bh="#f0f8ff",Th="#faebd7",wh="#00ffff",Eh="#7fffd4",Sh="#f0ffff",Ph="#f5f5dc",Rh="#ffe4c4",Ch="#000000",Ah="#ffebcd",Ih="#0000ff",Oh="#8a2be2",Mh="#a52a2a",Dh="#deb887",Fh="#5f9ea0",Nh="#7fff00",Bh="#d2691e",Lh="#ff7f50",Uh="#6495ed",Gh="#fff8dc",kh="#dc143c",Hh="#00ffff",Xh="#00008b",Wh="#008b8b",jh="#b8860b",zh="#a9a9a9",Yh="#006400",Vh="#a9a9a9",qh="#bdb76b",$h="#8b008b",Zh="#556b2f",Kh="#ff8c00",Qh="#9932cc",Jh="#8b0000",tu="#e9967a",eu="#8fbc8f",iu="#483d8b",ru="#2f4f4f",nu="#2f4f4f",su="#00ced1",au="#9400d3",ou="#ff1493",hu="#00bfff",uu="#696969",lu="#696969",fu="#1e90ff",cu="#b22222",du="#fffaf0",pu="#228b22",vu="#ff00ff",_u="#dcdcdc",mu="#f8f8ff",gu="#daa520",yu="#ffd700",xu="#808080",bu="#008000",Tu="#adff2f",wu="#808080",Eu="#f0fff0",Su="#ff69b4",Pu="#cd5c5c",Ru="#4b0082",Cu="#fffff0",Au="#f0e68c",Iu="#fff0f5",Ou="#e6e6fa",Mu="#7cfc00",Du="#fffacd",Fu="#add8e6",Nu="#f08080",Bu="#e0ffff",Lu="#fafad2",Uu="#d3d3d3",Gu="#90ee90",ku="#d3d3d3",Hu="#ffb6c1",Xu="#ffa07a",Wu="#20b2aa",ju="#87cefa",zu="#778899",Yu="#778899",Vu="#b0c4de",qu="#ffffe0",$u="#00ff00",Zu="#32cd32",Ku="#faf0e6",Qu="#ff00ff",Ju="#800000",tl="#66cdaa",el="#0000cd",il="#ba55d3",rl="#9370db",nl="#3cb371",sl="#7b68ee",al="#00fa9a",ol="#48d1cc",hl="#c71585",ul="#191970",ll="#f5fffa",fl="#ffe4e1",cl="#ffe4b5",dl="#ffdead",pl="#000080",vl="#fdf5e6",_l="#808000",ml="#6b8e23",gl="#ffa500",yl="#ff4500",xl="#da70d6",bl="#eee8aa",Tl="#98fb98",wl="#afeeee",El="#db7093",Sl="#ffefd5",Pl="#ffdab9",Rl="#cd853f",Cl="#ffc0cb",Al="#dda0dd",Il="#b0e0e6",Ol="#800080",Ml="#663399",Dl="#ff0000",Fl="#bc8f8f",Nl="#4169e1",Bl="#8b4513",Ll="#fa8072",Ul="#f4a460",Gl="#2e8b57",kl="#fff5ee",Hl="#a0522d",Xl="#c0c0c0",Wl="#87ceeb",jl="#6a5acd",zl="#708090",Yl="#708090",Vl="#fffafa",ql="#00ff7f",$l="#4682b4",Zl="#d2b48c",Kl="#008080",Ql="#d8bfd8",Jl="#ff6347",tf="#40e0d0",ef="#ee82ee",rf="#f5deb3",nf="#ffffff",sf="#f5f5f5",af="#ffff00",of="#9acd32",hf={aliceblue:bh,antiquewhite:Th,aqua:wh,aquamarine:Eh,azure:Sh,beige:Ph,bisque:Rh,black:Ch,blanchedalmond:Ah,blue:Ih,blueviolet:Oh,brown:Mh,burlywood:Dh,cadetblue:Fh,chartreuse:Nh,chocolate:Bh,coral:Lh,cornflowerblue:Uh,cornsilk:Gh,crimson:kh,cyan:Hh,darkblue:Xh,darkcyan:Wh,darkgoldenrod:jh,darkgray:zh,darkgreen:Yh,darkgrey:Vh,darkkhaki:qh,darkmagenta:$h,darkolivegreen:Zh,darkorange:Kh,darkorchid:Qh,darkred:Jh,darksalmon:tu,darkseagreen:eu,darkslateblue:iu,darkslategray:ru,darkslategrey:nu,darkturquoise:su,darkviolet:au,deeppink:ou,deepskyblue:hu,dimgray:uu,dimgrey:lu,dodgerblue:fu,firebrick:cu,floralwhite:du,forestgreen:pu,fuchsia:vu,gainsboro:_u,ghostwhite:mu,goldenrod:gu,gold:yu,gray:xu,green:bu,greenyellow:Tu,grey:wu,honeydew:Eu,hotpink:Su,indianred:Pu,indigo:Ru,ivory:Cu,khaki:Au,lavenderblush:Iu,lavender:Ou,lawngreen:Mu,lemonchiffon:Du,lightblue:Fu,lightcoral:Nu,lightcyan:Bu,lightgoldenrodyellow:Lu,lightgray:Uu,lightgreen:Gu,lightgrey:ku,lightpink:Hu,lightsalmon:Xu,lightseagreen:Wu,lightskyblue:ju,lightslategray:zu,lightslategrey:Yu,lightsteelblue:Vu,lightyellow:qu,lime:$u,limegreen:Zu,linen:Ku,magenta:Qu,maroon:Ju,mediumaquamarine:tl,mediumblue:el,mediumorchid:il,mediumpurple:rl,mediumseagreen:nl,mediumslateblue:sl,mediumspringgreen:al,mediumturquoise:ol,mediumvioletred:hl,midnightblue:ul,mintcream:ll,mistyrose:fl,moccasin:cl,navajowhite:dl,navy:pl,oldlace:vl,olive:_l,olivedrab:ml,orange:gl,orangered:yl,orchid:xl,palegoldenrod:bl,palegreen:Tl,paleturquoise:wl,palevioletred:El,papayawhip:Sl,peachpuff:Pl,peru:Rl,pink:Cl,plum:Al,powderblue:Il,purple:Ol,rebeccapurple:Ml,red:Dl,rosybrown:Fl,royalblue:Nl,saddlebrown:Bl,salmon:Ll,sandybrown:Ul,seagreen:Gl,seashell:kl,sienna:Hl,silver:Xl,skyblue:Wl,slateblue:jl,slategray:zl,slategrey:Yl,snow:Vl,springgreen:ql,steelblue:$l,tan:Zl,teal:Kl,thistle:Ql,tomato:Jl,turquoise:tf,violet:ef,wheat:rf,white:nf,whitesmoke:sf,yellow:af,yellowgreen:of};function Be(r,e){return e===void 0&&(e=[]),e[0]=(r>>16&255)/255,e[1]=(r>>8&255)/255,e[2]=(r&255)/255,e}function _s(r){var e=r.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function ms(r){return typeof r=="string"&&(r=hf[r.toLowerCase()]||r,r[0]==="#"&&(r=r.slice(1))),parseInt(r,16)}function uf(){for(var r=[],e=[],t=0;t<32;t++)r[t]=t,e[t]=t;r[G.NORMAL_NPM]=G.NORMAL,r[G.ADD_NPM]=G.ADD,r[G.SCREEN_NPM]=G.SCREEN,e[G.NORMAL]=G.NORMAL_NPM,e[G.ADD]=G.ADD_NPM,e[G.SCREEN]=G.SCREEN_NPM;var i=[];return i.push(e),i.push(r),i}var gs=uf();function ys(r,e){return gs[e?1:0][r]}function lf(r,e,t,i){return t=t||new Float32Array(4),i||i===void 0?(t[0]=r[0]*e,t[1]=r[1]*e,t[2]=r[2]*e):(t[0]=r[0],t[1]=r[1],t[2]=r[2]),t[3]=e,t}function Ir(r,e){if(e===1)return(e*255<<24)+r;if(e===0)return 0;var t=r>>16&255,i=r>>8&255,n=r&255;return t=t*e+.5|0,i=i*e+.5|0,n=n*e+.5|0,(e*255<<24)+(t<<16)+(i<<8)+n}function xs(r,e,t,i){return t=t||new Float32Array(4),t[0]=(r>>16&255)/255,t[1]=(r>>8&255)/255,t[2]=(r&255)/255,(i||i===void 0)&&(t[0]*=e,t[1]*=e,t[2]*=e),t[3]=e,t}function ff(r,e){e===void 0&&(e=null);var t=r*6;if(e=e||new Uint16Array(t),e.length!==t)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+t);for(var i=0,n=0;i<t;i+=6,n+=4)e[i+0]=n+0,e[i+1]=n+1,e[i+2]=n+2,e[i+3]=n+0,e[i+4]=n+2,e[i+5]=n+3;return e}function bs(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Oi(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Ts(r){return!(r&r-1)&&!!r}function ws(r){var e=(r>65535?1:0)<<4;r>>>=e;var t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function Le(r,e,t){var i=r.length,n;if(!(e>=i||t===0)){t=e+t>i?i-e:t;var s=i-t;for(n=e;n<s;++n)r[n]=r[n+t];r.length=s}}function Ue(r){return r===0?0:r<0?-1:1}var cf=0;function xe(){return++cf}var Es={};function Ut(r,e,t){if(t===void 0&&(t=3),!Es[e]){var i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",e+`
6
6
  Deprecated since v`+r):(i=i.split(`
7
7
  `).splice(t).join(`
8
8
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+`
9
9
  Deprecated since v`+r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+`
10
- Deprecated since v`+r),console.warn(i))),ws[e]=!0}}var Es={},Qt=Object.create(null),ye=Object.create(null),Ss=function(){function r(e,t,i){this.canvas=F.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=i||F.RESOLUTION,this.resize(e,t)}return r.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},r.prototype.resize=function(e,t){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(t*this.resolution)},r.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(r.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),r}();function lf(r){var e=r.width,t=r.height,i=r.getContext("2d",{willReadFrequently:!0}),n=i.getImageData(0,0,e,t),s=n.data,a=s.length,o={top:null,left:null,right:null,bottom:null},h=null,u,l,f;for(u=0;u<a;u+=4)s[u+3]!==0&&(l=u/4%e,f=~~(u/4/e),o.top===null&&(o.top=f),(o.left===null||l<o.left)&&(o.left=l),(o.right===null||o.right<l)&&(o.right=l+1),(o.bottom===null||o.bottom<f)&&(o.bottom=f));return o.top!==null&&(e=o.right-o.left,t=o.bottom-o.top+1,h=i.getImageData(o.left,o.top,e,t)),{height:t,width:e,data:h}}var Ii;function ff(r,e){if(e===void 0&&(e=globalThis.location),r.indexOf("data:")===0)return"";e=e||globalThis.location,Ii||(Ii=document.createElement("a")),Ii.href=r;var t=De.parse(Ii.href),i=!t.port&&e.port===""||t.port===e.port;return t.hostname!==e.hostname||!i||t.protocol!==e.protocol?"anonymous":""}function Oi(r,e){var t=F.RETINA_PREFIX.exec(r);return t?parseFloat(t[1]):e!==void 0?e:1}F.SORTABLE_CHILDREN=!1;var Mi=function(){function r(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return r.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},r.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},r.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?z.EMPTY:(e=e||new z(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},r.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},r.prototype.addPointMatrix=function(e,t){var i=e.a,n=e.b,s=e.c,a=e.d,o=e.tx,h=e.ty,u=i*t.x+s*t.y+o,l=n*t.x+a*t.y+h;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},r.prototype.addQuad=function(e){var t=this.minX,i=this.minY,n=this.maxX,s=this.maxY,a=e[0],o=e[1];t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=e[2],o=e[3],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=e[4],o=e[5],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=e[6],o=e[7],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,this.minX=t,this.minY=i,this.maxX=n,this.maxY=s},r.prototype.addFrame=function(e,t,i,n,s){this.addFrameMatrix(e.worldTransform,t,i,n,s)},r.prototype.addFrameMatrix=function(e,t,i,n,s){var a=e.a,o=e.b,h=e.c,u=e.d,l=e.tx,f=e.ty,c=this.minX,d=this.minY,p=this.maxX,v=this.maxY,_=a*t+h*i+l,m=o*t+u*i+f;c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*n+h*i+l,m=o*n+u*i+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*t+h*s+l,m=o*t+u*s+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*n+h*s+l,m=o*n+u*s+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,this.minX=c,this.minY=d,this.maxX=p,this.maxY=v},r.prototype.addVertexData=function(e,t,i){for(var n=this.minX,s=this.minY,a=this.maxX,o=this.maxY,h=t;h<i;h+=2){var u=e[h],l=e[h+1];n=u<n?u:n,s=l<s?l:s,a=u>a?u:a,o=l>o?l:o}this.minX=n,this.minY=s,this.maxX=a,this.maxY=o},r.prototype.addVertices=function(e,t,i,n){this.addVerticesMatrix(e.worldTransform,t,i,n)},r.prototype.addVerticesMatrix=function(e,t,i,n,s,a){s===void 0&&(s=0),a===void 0&&(a=s);for(var o=e.a,h=e.b,u=e.c,l=e.d,f=e.tx,c=e.ty,d=this.minX,p=this.minY,v=this.maxX,_=this.maxY,m=i;m<n;m+=2){var y=t[m],g=t[m+1],b=o*y+u*g+f,x=l*g+h*y+c;d=Math.min(d,b-s),v=Math.max(v,b+s),p=Math.min(p,x-a),_=Math.max(_,x+a)}this.minX=d,this.minY=p,this.maxX=v,this.maxY=_},r.prototype.addBounds=function(e){var t=this.minX,i=this.minY,n=this.maxX,s=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<i?e.minY:i,this.maxX=e.maxX>n?e.maxX:n,this.maxY=e.maxY>s?e.maxY:s},r.prototype.addBoundsMask=function(e,t){var i=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,s=e.maxX<t.maxX?e.maxX:t.maxX,a=e.maxY<t.maxY?e.maxY:t.maxY;if(i<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},r.prototype.addBoundsMatrix=function(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)},r.prototype.addBoundsArea=function(e,t){var i=e.minX>t.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,s=e.maxX<t.x+t.width?e.maxX:t.x+t.width,a=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(i<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},r.prototype.pad=function(e,t){e===void 0&&(e=0),t===void 0&&(t=e),this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)},r.prototype.addFramePad=function(e,t,i,n,s,a){e-=s,t-=a,i+=s,n+=a,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>n?this.maxY:n},r}();var Rr=function(r,e){return Rr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Rr(r,e)};function Ar(r,e){Rr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var pt=function(r){Ar(e,r);function e(){var t=r.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new Hn,t.alpha=1,t.visible=!0,t.renderable=!0,t.cullable=!1,t.cullArea=null,t.parent=null,t.worldAlpha=1,t._lastSortedIndex=0,t._zIndex=0,t.filterArea=null,t.filters=null,t._enabledFilters=null,t._bounds=new Mi,t._localBounds=null,t._boundsID=0,t._boundsRect=null,t._localBoundsRect=null,t._mask=null,t._maskRefCount=0,t._destroyed=!1,t.isSprite=!1,t.isMask=!1,t}return e.mixin=function(t){for(var i=Object.keys(t),n=0;n<i.length;++n){var s=i[n];Object.defineProperty(e.prototype,s,Object.getOwnPropertyDescriptor(t,s))}},Object.defineProperty(e.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),e.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},e.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},e.prototype.getBounds=function(t,i){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),i||(this._boundsRect||(this._boundsRect=new z),i=this._boundsRect),this._bounds.getRectangle(i)},e.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new z),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Mi);var i=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var s=this._bounds,a=this._boundsID;this._bounds=this._localBounds;var o=this.getBounds(!1,t);return this.parent=n,this.transform=i,this._bounds=s,this._bounds.updateID+=this._boundsID-a,o},e.prototype.toGlobal=function(t,i,n){return n===void 0&&(n=!1),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,i)},e.prototype.toLocal=function(t,i,n,s){return i&&(t=i.toGlobal(t,n,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,n)},e.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},e.prototype.setTransform=function(t,i,n,s,a,o,h,u,l){return t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=1),a===void 0&&(a=0),o===void 0&&(o=0),h===void 0&&(h=0),u===void 0&&(u=0),l===void 0&&(l=0),this.position.x=t,this.position.y=i,this.scale.x=n||1,this.scale.y=s||1,this.rotation=a,this.skew.x=o,this.skew.y=h,this.pivot.x=u,this.pivot.y=l,this},e.prototype.destroy=function(t){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Ps),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},e.prototype.disableTempParent=function(t){this.parent=t},Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.rotation=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.transform.rotation*fo},set:function(t){this.transform.rotation=t*co},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(t){if(this._mask!==t){if(this._mask){var i=this._mask.isMaskData?this._mask.maskObject:this._mask;i&&(i._maskRefCount--,i._maskRefCount===0&&(i.renderable=!0,i.isMask=!1))}if(this._mask=t,this._mask){var i=this._mask.isMaskData?this._mask.maskObject:this._mask;i&&(i._maskRefCount===0&&(i.renderable=!1,i.isMask=!0),i._maskRefCount++)}}},enumerable:!1,configurable:!0}),e}(je),Ps=function(r){Ar(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.sortDirty=null,t}return e}(pt);pt.prototype.displayObjectUpdateTransform=pt.prototype.updateTransform;function cf(r,e){return r.zIndex===e.zIndex?r._lastSortedIndex-e._lastSortedIndex:r.zIndex-e.zIndex}var St=function(r){Ar(e,r);function e(){var t=r.call(this)||this;return t.children=[],t.sortableChildren=F.SORTABLE_CHILDREN,t.sortDirty=!1,t}return e.prototype.onChildrenChange=function(t){},e.prototype.addChild=function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];if(i.length>1)for(var s=0;s<i.length;s++)this.addChild(i[s]);else{var a=i[0];a.parent&&a.parent.removeChild(a),a.parent=this,this.sortDirty=!0,a.transform._parentID=-1,this.children.push(a),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",a,this,this.children.length-1),a.emit("added",this)}return i[0]},e.prototype.addChildAt=function(t,i){if(i<0||i>this.children.length)throw new Error(t+"addChildAt: The index "+i+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(i,0,t),this._boundsID++,this.onChildrenChange(i),t.emit("added",this),this.emit("childAdded",t,this,i),t},e.prototype.swapChildren=function(t,i){if(t!==i){var n=this.getChildIndex(t),s=this.getChildIndex(i);this.children[n]=i,this.children[s]=t,this.onChildrenChange(n<s?n:s)}},e.prototype.getChildIndex=function(t){var i=this.children.indexOf(t);if(i===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return i},e.prototype.setChildIndex=function(t,i){if(i<0||i>=this.children.length)throw new Error("The index "+i+" supplied is out of bounds "+this.children.length);var n=this.getChildIndex(t);Ne(this.children,n,1),this.children.splice(i,0,t),this.onChildrenChange(i)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];if(i.length>1)for(var s=0;s<i.length;s++)this.removeChild(i[s]);else{var a=i[0],o=this.children.indexOf(a);if(o===-1)return null;a.parent=null,a.transform._parentID=-1,Ne(this.children,o,1),this._boundsID++,this.onChildrenChange(o),a.emit("removed",this),this.emit("childRemoved",a,this,o)}return i[0]},e.prototype.removeChildAt=function(t){var i=this.getChildAt(t);return i.parent=null,i.transform._parentID=-1,Ne(this.children,t,1),this._boundsID++,this.onChildrenChange(t),i.emit("removed",this),this.emit("childRemoved",i,this,t),i},e.prototype.removeChildren=function(t,i){t===void 0&&(t=0),i===void 0&&(i=this.children.length);var n=t,s=i,a=s-n,o;if(a>0&&a<=s){o=this.children.splice(n,a);for(var h=0;h<o.length;++h)o[h].parent=null,o[h].transform&&(o[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(var h=0;h<o.length;++h)o[h].emit("removed",this),this.emit("childRemoved",o[h],this,h);return o}else if(a===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var t=!1,i=0,n=this.children.length;i<n;++i){var s=this.children[i];s._lastSortedIndex=i,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(cf),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,i=this.children.length;t<i;++t){var n=this.children[t];n.visible&&n.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var i=this.children[t];if(!(!i.visible||!i.renderable))if(i.calculateBounds(),i._mask){var n=i._mask.isMaskData?i._mask.maskObject:i._mask;n?(n.calculateBounds(),this._bounds.addBoundsMask(i._bounds,n._bounds)):this._bounds.addBounds(i._bounds)}else i.filterArea?this._bounds.addBoundsArea(i._bounds,i.filterArea):this._bounds.addBounds(i._bounds)}this._bounds.updateID=this._boundsID},e.prototype.getLocalBounds=function(t,i){i===void 0&&(i=!1);var n=r.prototype.getLocalBounds.call(this,t);if(!i)for(var s=0,a=this.children.length;s<a;++s){var o=this.children[s];o.visible&&o.updateTransform()}return n},e.prototype._calculateBounds=function(){},e.prototype._renderWithCulling=function(t){var i=t.renderTexture.sourceFrame;if(i.width>0&&i.height>0){var n,s;if(this.cullArea?(n=this.cullArea,s=this.worldTransform):this._render!==e.prototype._render&&(n=this.getBounds(!0)),n&&i.intersects(n,s))this._render(t);else if(this.cullArea)return;for(var a=0,o=this.children.length;a<o;++a){var h=this.children[a],u=h.cullable;h.cullable=u||!this.cullArea,h.render(t),h.cullable=u}}},e.prototype.render=function(t){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(var i=0,n=this.children.length;i<n;++i)this.children[i].render(t)}},e.prototype.renderAdvanced=function(t){var i=this.filters,n=this._mask;if(i){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var s=0;s<i.length;s++)i[s].enabled&&this._enabledFilters.push(i[s])}var a=i&&this._enabledFilters&&this._enabledFilters.length||n&&(!n.isMaskData||n.enabled&&(n.autoDetect||n.type!==mt.NONE));if(a&&t.batch.flush(),i&&this._enabledFilters&&this._enabledFilters.length&&t.filter.push(this,this._enabledFilters),n&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(var s=0,o=this.children.length;s<o;++s)this.children[s].render(t)}a&&t.batch.flush(),n&&t.mask.pop(this),i&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},e.prototype._render=function(t){},e.prototype.destroy=function(t){r.prototype.destroy.call(this),this.sortDirty=!1;var i=typeof t=="boolean"?t:t&&t.children,n=this.removeChildren(0,this.children.length);if(i)for(var s=0;s<n.length;++s)n[s].destroy(t)},Object.defineProperty(e.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(t){var i=this.getLocalBounds().width;i!==0?this.scale.x=t/i:this.scale.x=1,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(t){var i=this.getLocalBounds().height;i!==0?this.scale.y=t/i:this.scale.y=1,this._height=t},enumerable:!1,configurable:!0}),e}(pt);St.prototype.containerUpdateTransform=St.prototype.updateTransform;var Ke=function(){return Ke=Object.assign||function(e){for(var t=arguments,i,n=1,s=arguments.length;n<s;n++){i=t[n];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},Ke.apply(this,arguments)},J;(function(r){r.Application="application",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Loader="loader",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser"})(J||(J={}));var Cs=function(r){if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");var e=typeof r.extension!="object"?{type:r.extension}:r.extension;r=Ke(Ke({},e),{ref:r})}if(typeof r=="object")r=Ke({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Jt={_addHandlers:null,_removeHandlers:null,_queue:{},remove:function(){for(var r=arguments,e=this,t=[],i=0;i<arguments.length;i++)t[i]=r[i];return t.map(Cs).forEach(function(n){n.type.forEach(function(s){var a,o;return(o=(a=e._removeHandlers)[s])===null||o===void 0?void 0:o.call(a,n)})}),this},add:function(){for(var r=arguments,e=this,t=[],i=0;i<arguments.length;i++)t[i]=r[i];return t.map(Cs).forEach(function(n){n.type.forEach(function(s){var a=e._addHandlers,o=e._queue;a[s]?a[s](n):(o[s]=o[s]||[],o[s].push(n))})}),this},handle:function(r,e,t){var i=this._addHandlers=this._addHandlers||{},n=this._removeHandlers=this._removeHandlers||{};if(i[r]||n[r])throw new Error("Extension type "+r+" already has a handler");i[r]=e,n[r]=t;var s=this._queue;return s[r]&&(s[r].forEach(function(a){return e(a)}),delete s[r]),this},handleByMap:function(r,e){return this.handle(r,function(t){e[t.name]=t.ref},function(t){delete e[t.name]})},handleByList:function(r,e){return this.handle(r,function(t){var i,n;e.push(t.ref),r===J.Loader&&((n=(i=t.ref).add)===null||n===void 0||n.call(i))},function(t){var i=e.indexOf(t.ref);i!==-1&&e.splice(i,1)})}};var wt=function(){function r(e){this.items=[],this._name=e,this._aliasCount=0}return r.prototype.emit=function(e,t,i,n,s,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");var u=this,l=u.name,f=u.items;this._aliasCount++;for(var c=0,d=f.length;c<d;c++)f[c][l](e,t,i,n,s,a,o,h);return f===this.items&&this._aliasCount--,this},r.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},r.prototype.add=function(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this},r.prototype.remove=function(e){var t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this},r.prototype.contains=function(e){return this.items.indexOf(e)!==-1},r.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},r.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(r.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r}();Object.defineProperties(wt.prototype,{dispatch:{value:wt.prototype.emit},run:{value:wt.prototype.emit}});F.TARGET_FPMS=.06;var te;(function(r){r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY"})(te||(te={}));var Ir=function(){function r(e,t,i,n){t===void 0&&(t=null),i===void 0&&(i=0),n===void 0&&(n=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=n}return r.prototype.match=function(e,t){return t===void 0&&(t=null),this.fn===e&&this.context===t},r.prototype.emit=function(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));var t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t},r.prototype.connect=function(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this},r.prototype.destroy=function(e){e===void 0&&(e=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var t=this.next;return this.next=e?null:t,this.previous=null,t},r}(),bt=function(){function r(){var e=this;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 Ir(null,null,1/0),this.deltaMS=1/F.TARGET_FPMS,this.elapsedMS=1/F.TARGET_FPMS,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&e._requestId===null&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return r.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},r.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},r.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},r.prototype.add=function(e,t,i){return i===void 0&&(i=te.NORMAL),this._addListener(new Ir(e,t,i))},r.prototype.addOnce=function(e,t,i){return i===void 0&&(i=te.NORMAL),this._addListener(new Ir(e,t,i,!0))},r.prototype._addListener=function(e){var t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this},r.prototype.remove=function(e,t){for(var i=this._head.next;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(r.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},r.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},r.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(e){e===void 0&&(e=performance.now());var t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var i=e-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=e-i%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*F.TARGET_FPMS;for(var n=this._head,s=n.next;s;)s=s.emit(this.deltaTime);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e},Object.defineProperty(r.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(e){var t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,F.TARGET_FPMS);this._maxElapsedMS=1/i},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(e){if(e===0)this._minElapsedMS=0;else{var t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(r,"shared",{get:function(){if(!r._shared){var e=r._shared=new r;e.autoStart=!0,e._protected=!0}return r._shared},enumerable:!1,configurable:!0}),Object.defineProperty(r,"system",{get:function(){if(!r._system){var e=r._system=new r;e.autoStart=!0,e._protected=!0}return r._system},enumerable:!1,configurable:!0}),r}(),df=function(){function r(){}return r.init=function(e){var t=this;e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set:function(i){this._ticker&&this._ticker.remove(this.render,this),this._ticker=i,i&&i.add(this.render,this,te.LOW)},get:function(){return this._ticker}}),this.stop=function(){t._ticker.stop()},this.start=function(){t._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?bt.shared:new bt,e.autoStart&&this.start()},r.destroy=function(){if(this._ticker){var e=this._ticker;this.ticker=null,e.destroy()}},r.extension=J.Application,r}();F.PREFER_ENV=Yt.any?Zt.WEBGL:Zt.WEBGL2,F.STRICT_TEXTURE_CACHE=!1;var Or=[];function Rs(r,e){if(!r)return null;var t="";if(typeof r=="string"){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(t=i[1].toLowerCase())}for(var n=Or.length-1;n>=0;--n){var s=Or[n];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var Mr=function(r,e){return Mr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Mr(r,e)};function rt(r,e){Mr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Dr=function(){return Dr=Object.assign||function(e){for(var t=arguments,i,n=1,s=arguments.length;n<s;n++){i=t[n];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},Dr.apply(this,arguments)};function pf(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}var Qe=function(){function r(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new wt("setRealSize"),this.onUpdate=new wt("update"),this.onError=new wt("onError")}return r.prototype.bind=function(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},r.prototype.unbind=function(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)},r.prototype.resize=function(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))},Object.defineProperty(r.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),r.prototype.update=function(){this.destroyed||this.onUpdate.emit()},r.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(r.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),r.prototype.style=function(e,t,i){return!1},r.prototype.dispose=function(){},r.prototype.destroy=function(){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)},r.test=function(e,t){return!1},r}(),Je=function(r){rt(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height;if(!a||!o)throw new Error("BufferResource width or height invalid");return n=r.call(this,a,o)||this,n.data=t,n}return e.prototype.upload=function(t,i,n){var s=t.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===Dt.UNPACK);var a=i.realWidth,o=i.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(i.target,0,0,0,a,o,i.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(i.target,0,n.internalFormat,a,o,0,i.format,n.type,this.data)),!0},e.prototype.dispose=function(){this.data=null},e.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},e}(Qe),vf={scaleMode:Wt.NEAREST,format:R.RGBA,alphaMode:Dt.NPM},Y=function(r){rt(e,r);function e(t,i){t===void 0&&(t=null),i===void 0&&(i=null);var n=r.call(this)||this;i=i||{};var s=i.alphaMode,a=i.mipmap,o=i.anisotropicLevel,h=i.scaleMode,u=i.width,l=i.height,f=i.wrapMode,c=i.format,d=i.type,p=i.target,v=i.resolution,_=i.resourceOptions;return t&&!(t instanceof Qe)&&(t=Rs(t,_),t.internal=!0),n.resolution=v||F.RESOLUTION,n.width=Math.round((u||0)*n.resolution)/n.resolution,n.height=Math.round((l||0)*n.resolution)/n.resolution,n._mipmap=a!==void 0?a:F.MIPMAP_TEXTURES,n.anisotropicLevel=o!==void 0?o:F.ANISOTROPIC_LEVEL,n._wrapMode=f||F.WRAP_MODE,n._scaleMode=h!==void 0?h:F.SCALE_MODE,n.format=c||R.RGBA,n.type=d||L.UNSIGNED_BYTE,n.target=p||_e.TEXTURE_2D,n.alphaMode=s!==void 0?s:Dt.UNPACK,n.uid=ge(),n.touched=0,n.isPowerOfTwo=!1,n._refreshPOT(),n._glTextures={},n.dirtyId=0,n.dirtyStyleId=0,n.cacheId=null,n.valid=u>0&&l>0,n.textureCacheIds=[],n.destroyed=!1,n.resource=null,n._batchEnabled=0,n._batchLocation=0,n.parentTextureArray=null,n.setResource(t),n}return Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,i){var n;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,n=!0),i!==void 0&&i!==this.mipmap&&(this.mipmap=i,n=!0),n&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,i,n){return n=n||this.resolution,this.setRealSize(t*n,i*n,n)},e.prototype.setRealSize=function(t,i,n){return this.resolution=n||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(i)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=bs(this.realWidth)&&bs(this.realHeight)},e.prototype.setResolution=function(t){var i=this.resolution;return i===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*i)/t,this.height=Math.round(this.height*i)/t,this.emit("update",this)),this._refreshPOT(),this)},e.prototype.setResource=function(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},e.prototype.update=function(){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))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ye[this.cacheId],delete Qt[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,i,n){n===void 0&&(n=F.STRICT_TEXTURE_CACHE);var s=typeof t=="string",a=null;if(s)a=t;else{if(!t._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+ge()}a=t._pixiId}var h=ye[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return h||(h=new e(t,i),h.cacheId=a,e.addToCache(h,a)),h},e.fromBuffer=function(t,i,n,s){t=t||new Float32Array(i*n*4);var a=new Je(t,{width:i,height:n}),o=t instanceof Float32Array?L.FLOAT:L.UNSIGNED_BYTE;return new e(a,Object.assign({},vf,s||{width:i,height:n,type:o}))},e.addToCache=function(t,i){i&&(t.textureCacheIds.indexOf(i)===-1&&t.textureCacheIds.push(i),ye[i]&&console.warn("BaseTexture added to the cache with an id ["+i+"] that already had an entry"),ye[i]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var i=ye[t];if(i){var n=i.textureCacheIds.indexOf(t);return n>-1&&i.textureCacheIds.splice(n,1),delete ye[t],i}}else if(t&&t.textureCacheIds){for(var s=0;s<t.textureCacheIds.length;++s)delete ye[t.textureCacheIds[s]];return t.textureCacheIds.length=0,t}return null},e._globalBatch=0,e}(je),As=function(r){rt(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height;n=r.call(this,a,o)||this,n.items=[],n.itemDirtyIds=[];for(var h=0;h<t;h++){var u=new Y;n.items.push(u),n.itemDirtyIds.push(-2)}return n.length=t,n._load=null,n.baseTexture=null,n}return e.prototype.initFromArray=function(t,i){for(var n=0;n<this.length;n++)t[n]&&(t[n].castToBaseTexture?this.addBaseTextureAt(t[n].castToBaseTexture(),n):t[n]instanceof Qe?this.addResourceAt(t[n],n):this.addResourceAt(Rs(t[n],i),n))},e.prototype.dispose=function(){for(var t=0,i=this.length;t<i;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},e.prototype.addResourceAt=function(t,i){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[i].setResource(t),this},e.prototype.bind=function(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");r.prototype.bind.call(this,t);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=t,this.items[i].on("update",t.update,t)},e.prototype.unbind=function(t){r.prototype.unbind.call(this,t);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",t.update,t)},e.prototype.load=function(){var t=this;if(this._load)return this._load;var i=this.items.map(function(s){return s.resource}).filter(function(s){return s}),n=i.map(function(s){return s.load()});return this._load=Promise.all(n).then(function(){var s=t.items[0],a=s.realWidth,o=s.realHeight;return t.resize(a,o),Promise.resolve(t)}),this._load},e}(Qe),_f=function(r){rt(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height,h,u;return Array.isArray(t)?(h=t,u=t.length):u=t,n=r.call(this,u,{width:a,height:o})||this,h&&n.initFromArray(h,i),n}return e.prototype.addBaseTextureAt=function(t,i){if(t.resource)this.addResourceAt(t.resource,i);else throw new Error("ArrayResource does not support RenderTexture");return this},e.prototype.bind=function(t){r.prototype.bind.call(this,t),t.target=_e.TEXTURE_2D_ARRAY},e.prototype.upload=function(t,i,n){var s=this,a=s.length,o=s.itemDirtyIds,h=s.items,u=t.gl;n.dirtyId<0&&u.texImage3D(u.TEXTURE_2D_ARRAY,0,n.internalFormat,this._width,this._height,a,0,i.format,n.type,null);for(var l=0;l<a;l++){var f=h[l];o[l]<f.dirtyId&&(o[l]=f.dirtyId,f.valid&&u.texSubImage3D(u.TEXTURE_2D_ARRAY,0,0,0,l,f.resource.width,f.resource.height,1,i.format,n.type,f.resource.source))}return!0},e}(As),ne=function(r){rt(e,r);function e(t){var i=this,n=t,s=n.naturalWidth||n.videoWidth||n.width,a=n.naturalHeight||n.videoHeight||n.height;return i=r.call(this,s,a)||this,i.source=t,i.noSubImage=!1,i}return e.crossOrigin=function(t,i,n){n===void 0&&i.indexOf("data:")!==0?t.crossOrigin=ff(i):n!==!1&&(t.crossOrigin=typeof n=="string"?n:"anonymous")},e.prototype.upload=function(t,i,n,s){var a=t.gl,o=i.realWidth,h=i.realHeight;if(s=s||this.source,s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===Dt.UNPACK),!this.noSubImage&&i.target===a.TEXTURE_2D&&n.width===o&&n.height===h?a.texSubImage2D(a.TEXTURE_2D,0,0,0,i.format,n.type,s):(n.width=o,n.height=h,a.texImage2D(i.target,0,n.internalFormat,i.format,n.type,s)),!0},e.prototype.update=function(){if(!this.destroyed){var t=this.source,i=t.naturalWidth||t.videoWidth||t.width,n=t.naturalHeight||t.videoHeight||t.height;this.resize(i,n),r.prototype.update.call(this)}},e.prototype.dispose=function(){this.source=null},e}(Qe),mf=function(r){rt(e,r);function e(t){return r.call(this,t)||this}return e.test=function(t){var i=globalThis.OffscreenCanvas;return i&&t instanceof i?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement},e}(ne),gf=function(r){rt(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height,h=s.autoLoad,u=s.linkBaseTexture;if(t&&t.length!==e.SIDES)throw new Error("Invalid length. Got "+t.length+", expected 6");n=r.call(this,6,{width:a,height:o})||this;for(var l=0;l<e.SIDES;l++)n.items[l].target=_e.TEXTURE_CUBE_MAP_POSITIVE_X+l;return n.linkBaseTexture=u!==!1,t&&n.initFromArray(t,i),h!==!1&&n.load(),n}return e.prototype.bind=function(t){r.prototype.bind.call(this,t),t.target=_e.TEXTURE_CUBE_MAP},e.prototype.addBaseTextureAt=function(t,i,n){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,i);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=_e.TEXTURE_CUBE_MAP_POSITIVE_X+i,t.parentTextureArray=this.baseTexture,this.items[i]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[i]=t,this},e.prototype.upload=function(t,i,n){for(var s=this.itemDirtyIds,a=0;a<e.SIDES;a++){var o=this.items[a];(s[a]<o.dirtyId||n.dirtyId<i.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,n),s[a]=o.dirtyId):s[a]<-1&&(t.gl.texImage2D(o.target,0,n.internalFormat,i.realWidth,i.realHeight,0,i.format,n.type,null),s[a]=-1))}return!0},e.test=function(t){return Array.isArray(t)&&t.length===e.SIDES},e.SIDES=6,e}(As),Is=function(r){rt(e,r);function e(t,i){var n=this;if(i=i||{},!(t instanceof HTMLImageElement)){var s=new Image;ne.crossOrigin(s,t,i.crossorigin),s.src=t,t=s}return n=r.call(this,t)||this,!t.complete&&n._width&&n._height&&(n._width=0,n._height=0),n.url=t.src,n._process=null,n.preserveBitmap=!1,n.createBitmap=(i.createBitmap!==void 0?i.createBitmap:F.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,n.alphaMode=typeof i.alphaMode=="number"?i.alphaMode:null,n.bitmap=null,n._load=null,i.autoLoad!==!1&&n.load(),n}return e.prototype.load=function(t){var i=this;return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise(function(n,s){var a=i.source;i.url=a.src;var o=function(){i.destroyed||(a.onload=null,a.onerror=null,i.resize(a.width,a.height),i._load=null,i.createBitmap?n(i.process()):n(i))};a.complete&&a.src?o():(a.onload=o,a.onerror=function(h){s(h),i.onError.emit(h)})}),this._load)},e.prototype.process=function(){var t=this,i=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);var n=globalThis.createImageBitmap,s=!i.crossOrigin||i.crossOrigin==="anonymous";return this._process=fetch(i.src,{mode:s?"cors":"no-cors"}).then(function(a){return a.blob()}).then(function(a){return n(a,0,0,i.width,i.height,{premultiplyAlpha:t.alphaMode===null||t.alphaMode===Dt.UNPACK?"premultiply":"none"})}).then(function(a){return t.destroyed?Promise.reject():(t.bitmap=a,t.update(),t._process=null,Promise.resolve(t))}),this._process},e.prototype.upload=function(t,i,n){if(typeof this.alphaMode=="number"&&(i.alphaMode=this.alphaMode),!this.createBitmap)return r.prototype.upload.call(this,t,i,n);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(r.prototype.upload.call(this,t,i,n,this.bitmap),!this.preserveBitmap){var s=!0,a=i._glTextures;for(var o in a){var h=a[o];if(h!==n&&h.dirtyId!==i.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},e.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,r.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},e.test=function(t){return typeof t=="string"||t instanceof HTMLImageElement},e}(ne),yf=function(r){rt(e,r);function e(t,i){var n=this;return i=i||{},n=r.call(this,F.ADAPTER.createCanvas())||this,n._width=0,n._height=0,n.svg=t,n.scale=i.scale||1,n._overrideWidth=i.width,n._overrideHeight=i.height,n._resolve=null,n._crossorigin=i.crossorigin,n._load=null,i.autoLoad!==!1&&n.load(),n}return e.prototype.load=function(){var t=this;return this._load?this._load:(this._load=new Promise(function(i){if(t._resolve=function(){t.resize(t.source.width,t.source.height),i(t)},e.SVG_XML.test(t.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");t.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t.svg)))}t._loadSvg()}),this._load)},e.prototype._loadSvg=function(){var t=this,i=new Image;ne.crossOrigin(i,this.svg,this._crossorigin),i.src=this.svg,i.onerror=function(n){t._resolve&&(i.onerror=null,t.onError.emit(n))},i.onload=function(){if(t._resolve){var n=i.width,s=i.height;if(!n||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var a=n*t.scale,o=s*t.scale;(t._overrideWidth||t._overrideHeight)&&(a=t._overrideWidth||t._overrideHeight/s*n,o=t._overrideHeight||t._overrideWidth/n*s),a=Math.round(a),o=Math.round(o);var h=t.source;h.width=a,h.height=o,h._pixiId="canvas_"+ge(),h.getContext("2d").drawImage(i,0,0,n,s,0,0,a,o),t._resolve(),t._resolve=null}}},e.getSize=function(t){var i=e.SVG_SIZE.exec(t),n={};return i&&(n[i[1]]=Math.round(parseFloat(i[3])),n[i[5]]=Math.round(parseFloat(i[7]))),n},e.prototype.dispose=function(){r.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},e.test=function(t,i){return i==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&e.SVG_XML.test(t)},e.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,e.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(ne),xf=function(r){rt(e,r);function e(t,i){var n=this;if(i=i||{},!(t instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof t=="string"&&(t=[t]);var a=t[0].src||t[0];ne.crossOrigin(s,a,i.crossorigin);for(var o=0;o<t.length;++o){var h=document.createElement("source"),u=t[o],l=u.src,f=u.mime;l=l||t[o];var c=l.split("?").shift().toLowerCase(),d=c.slice(c.lastIndexOf(".")+1);f=f||e.MIME_TYPES[d]||"video/"+d,h.src=l,h.type=f,s.appendChild(h)}t=s}return n=r.call(this,t)||this,n.noSubImage=!0,n._autoUpdate=!0,n._isConnectedToTicker=!1,n._updateFPS=i.updateFPS||0,n._msToNextUpdate=0,n.autoPlay=i.autoPlay!==!1,n._load=null,n._resolve=null,n._onCanPlay=n._onCanPlay.bind(n),n._onError=n._onError.bind(n),i.autoLoad!==!1&&n.load(),n}return e.prototype.update=function(t){if(!this.destroyed){var i=bt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-i),(!this._updateFPS||this._msToNextUpdate<=0)&&(r.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},e.prototype.load=function(){var t=this;if(this._load)return this._load;var i=this.source;return(i.readyState===i.HAVE_ENOUGH_DATA||i.readyState===i.HAVE_FUTURE_DATA)&&i.width&&i.height&&(i.complete=!0),i.addEventListener("play",this._onPlayStart.bind(this)),i.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(i.addEventListener("canplay",this._onCanPlay),i.addEventListener("canplaythrough",this._onCanPlay),i.addEventListener("error",this._onError,!0)),this._load=new Promise(function(n){t.valid?n(t):(t._resolve=n,i.load())}),this._load},e.prototype._onError=function(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)},e.prototype._isSourcePlaying=function(){var t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()},e.prototype._isSourceReady=function(){var t=this.source;return t.readyState>2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(bt.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var i=this.valid;this.resize(t.videoWidth,t.videoHeight),!i&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),r.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(bt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,i){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(i)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(ne),bf=function(r){rt(e,r);function e(t){return r.call(this,t)||this}return e.test=function(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&t instanceof ImageBitmap},e}(ne);Or.push(Is,bf,mf,xf,yf,Je,gf,_f);var Tf=function(r){rt(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.upload=function(t,i,n){var s=t.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===Dt.UNPACK);var a=i.realWidth,o=i.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(i.target,0,0,0,a,o,i.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(i.target,0,n.internalFormat,a,o,0,i.format,n.type,this.data)),!0},e}(Je),Fr=function(){function r(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),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 wt("disposeFramebuffer"),this.multisample=ct.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(e,t){return e===void 0&&(e=0),this.colorTextures[e]=t||new Y(null,{scaleMode:Wt.NEAREST,resolution:1,mipmap:Mt.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(e){return this.depthTexture=e||new Y(new Tf(null,{width:this.width,height:this.height}),{scaleMode:Wt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Mt.OFF,format:R.DEPTH_COMPONENT,type:L.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var n=this.colorTextures[i],s=n.resolution;n.setSize(e/s,t/s)}if(this.depthTexture){var s=this.depthTexture.resolution;this.depthTexture.setSize(e/s,t/s)}}},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},r}(),Os=function(r){rt(e,r);function e(t){t===void 0&&(t={});var i=this;if(typeof t=="number"){var n=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3];t={width:n,height:s,scaleMode:a,resolution:o}}return t.width=t.width||100,t.height=t.height||100,t.multisample=t.multisample!==void 0?t.multisample:ct.NONE,i=r.call(this,null,t)||this,i.mipmap=Mt.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new Fr(i.realWidth,i.realHeight).addColorTexture(0,i),i.framebuffer.multisample=t.multisample,i.maskStack=[],i.filterStack=[{}],i}return e.prototype.resize=function(t,i){this.framebuffer.resize(t*this.resolution,i*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},e.prototype.dispose=function(){this.framebuffer.dispose(),r.prototype.dispose.call(this)},e.prototype.destroy=function(){r.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},e}(Y),Ms=function(){function r(){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)}return r.prototype.set=function(e,t,i){var n=t.width,s=t.height;if(i){var a=e.width/2/n,o=e.height/2/s,h=e.x/n+a,u=e.y/s+o;i=ht.add(i,ht.NW),this.x0=h+a*ht.uX(i),this.y0=u+o*ht.uY(i),i=ht.add(i,2),this.x1=h+a*ht.uX(i),this.y1=u+o*ht.uY(i),i=ht.add(i,2),this.x2=h+a*ht.uX(i),this.y2=u+o*ht.uY(i),i=ht.add(i,2),this.x3=h+a*ht.uX(i),this.y3=u+o*ht.uY(i)}else this.x0=e.x/n,this.y0=e.y/s,this.x1=(e.x+e.width)/n,this.y1=e.y/s,this.x2=(e.x+e.width)/n,this.y2=(e.y+e.height)/s,this.x3=e.x/n,this.y3=(e.y+e.height)/s;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},r.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)+"]"},r}(),Ds=new Ms;function Di(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var k=function(r){rt(e,r);function e(t,i,n,s,a,o){var h=r.call(this)||this;if(h.noFrame=!1,i||(h.noFrame=!0,i=new z(0,0,1,1)),t instanceof e&&(t=t.baseTexture),h.baseTexture=t,h._frame=i,h.trim=s,h.valid=!1,h._uvs=Ds,h.uvMatrix=null,h.orig=n||i,h._rotate=Number(a||0),a===!0)h._rotate=2;else if(h._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return h.defaultAnchor=o?new W(o.x,o.y):new W(0,0),h._updateID=0,h.textureCacheIds=[],t.valid?h.noFrame?t.valid&&h.onBaseTextureUpdated(t):h.frame=i:t.once("loaded",h.onBaseTextureUpdated,h),h.noFrame&&t.on("update",h.onBaseTextureUpdated,h),h}return e.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},e.prototype.onBaseTextureUpdated=function(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)},e.prototype.destroy=function(t){if(this.baseTexture){if(t){var i=this.baseTexture.resource;i&&i.url&&Qt[i.url]&&e.removeFromCache(i.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,e.removeFromCache(this),this.textureCacheIds=null},e.prototype.clone=function(){var t=this._frame.clone(),i=this._frame===this.orig?t:this.orig.clone(),n=new e(this.baseTexture,!this.noFrame&&t,i,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(n._frame=t),n},e.prototype.updateUvs=function(){this._uvs===Ds&&(this._uvs=new Ms),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},e.from=function(t,i,n){i===void 0&&(i={}),n===void 0&&(n=F.STRICT_TEXTURE_CACHE);var s=typeof t=="string",a=null;if(s)a=t;else if(t instanceof Y){if(!t.cacheId){var o=i&&i.pixiIdPrefix||"pixiid";t.cacheId=o+"-"+ge(),Y.addToCache(t,t.cacheId)}a=t.cacheId}else{if(!t._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+ge()}a=t._pixiId}var h=Qt[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in TextureCache.');return!h&&!(t instanceof Y)?(i.resolution||(i.resolution=Oi(t)),h=new e(new Y(t,i)),h.baseTexture.cacheId=a,Y.addToCache(h.baseTexture,a),e.addToCache(h,a)):!h&&t instanceof Y&&(h=new e(t),e.addToCache(h,a)),h},e.fromURL=function(t,i){var n=Object.assign({autoLoad:!1},i==null?void 0:i.resourceOptions),s=e.from(t,Object.assign({resourceOptions:n},i),!1),a=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):a.load().then(function(){return Promise.resolve(s)})},e.fromBuffer=function(t,i,n,s){return new e(Y.fromBuffer(t,i,n,s))},e.fromLoader=function(t,i,n,s){var a=new Y(t,Object.assign({scaleMode:F.SCALE_MODE,resolution:Oi(i)},s)),o=a.resource;o instanceof Is&&(o.url=i);var h=new e(a);return n||(n=i),Y.addToCache(h.baseTexture,n),e.addToCache(h,n),n!==i&&(Y.addToCache(h.baseTexture,i),e.addToCache(h,i)),h.baseTexture.valid?Promise.resolve(h):new Promise(function(u){h.baseTexture.once("loaded",function(){return u(h)})})},e.addToCache=function(t,i){i&&(t.textureCacheIds.indexOf(i)===-1&&t.textureCacheIds.push(i),Qt[i]&&console.warn("Texture added to the cache with an id ["+i+"] that already had an entry"),Qt[i]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var i=Qt[t];if(i){var n=i.textureCacheIds.indexOf(t);return n>-1&&i.textureCacheIds.splice(n,1),delete Qt[t],i}}else if(t&&t.textureCacheIds){for(var s=0;s<t.textureCacheIds.length;++s)Qt[t.textureCacheIds[s]]===t&&delete Qt[t.textureCacheIds[s]];return t.textureCacheIds.length=0,t}return null},Object.defineProperty(e.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame=t,this.noFrame=!1;var i=t.x,n=t.y,s=t.width,a=t.height,o=i+s>this.baseTexture.width,h=n+a>this.baseTexture.height;if(o||h){var u=o&&h?"and":"or",l="X: "+i+" + "+s+" = "+(i+s)+" > "+this.baseTexture.width,f="Y: "+n+" + "+a+" = "+(n+a)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(l+" "+u+" "+f))}this.valid=s&&a&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new Y),Di(e._EMPTY),Di(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=F.ADAPTER.createCanvas(16,16),i=t.getContext("2d");t.width=16,t.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),e._WHITE=new e(Y.from(t)),Di(e._WHITE),Di(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(je),xe=function(r){rt(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.valid=!0,n.filterFrame=null,n.filterPoolKey=null,n.updateUvs(),n}return Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,i,n){n===void 0&&(n=!0);var s=this.baseTexture.resolution,a=Math.round(t*s)/s,o=Math.round(i*s)/s;this.valid=a>0&&o>0,this._frame.width=this.orig.width=a,this._frame.height=this.orig.height=o,n&&this.baseTexture.resize(a,o),this.updateUvs()},e.prototype.setResolution=function(t){var i=this.baseTexture;i.resolution!==t&&(i.setResolution(t),this.resize(i.width,i.height,!1))},e.create=function(t){for(var i=arguments,n=[],s=1;s<arguments.length;s++)n[s-1]=i[s];return typeof t=="number"&&(Bt("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),t={width:t,height:n[0],scaleMode:n[1],resolution:n[2]}),new e(new Os(t))},e}(k),wf=function(){function r(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return r.prototype.createTexture=function(e,t,i){i===void 0&&(i=ct.NONE);var n=new Os(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new xe(n)},r.prototype.getOptimalTexture=function(e,t,i,n){i===void 0&&(i=1),n===void 0&&(n=ct.NONE);var s;e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=Ai(e),t=Ai(t),s=((e&65535)<<16|t&65535)>>>0,n>1&&(s+=n*4294967296)):s=n>1?-n:-1,this.texturePool[s]||(this.texturePool[s]=[]);var a=this.texturePool[s].pop();return a||(a=this.createTexture(e,t,n)),a.filterPoolKey=s,a.setResolution(i),a},r.prototype.getFilterTexture=function(e,t,i){var n=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||ct.NONE);return n.filterFrame=e.filterFrame,n},r.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},r.prototype.returnFilterTexture=function(e){this.returnTexture(e)},r.prototype.clear=function(e){if(e=e!==!1,e)for(var t in this.texturePool){var i=this.texturePool[t];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0)}this.texturePool={}},r.prototype.setScreenSize=function(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(var t in this.texturePool)if(Number(t)<0){var i=this.texturePool[t];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}},r.SCREEN_KEY=-1,r}(),Fs=function(){function r(e,t,i,n,s,a,o){t===void 0&&(t=0),i===void 0&&(i=!1),n===void 0&&(n=L.FLOAT),this.buffer=e,this.size=t,this.normalized=i,this.type=n,this.stride=s,this.start=a,this.instance=o}return r.prototype.destroy=function(){this.buffer=null},r.from=function(e,t,i,n,s){return new r(e,t,i,n,s)},r}(),Ef=0,yt=function(){function r(e,t,i){t===void 0&&(t=!0),i===void 0&&(i=!1),this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=t,this.id=Ef++,this.disposeRunner=new wt("disposeBuffer")}return r.prototype.update=function(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(r.prototype,"index",{get:function(){return this.type===jt.ELEMENT_ARRAY_BUFFER},set:function(e){this.type=e?jt.ELEMENT_ARRAY_BUFFER:jt.ARRAY_BUFFER},enumerable:!1,configurable:!0}),r.from=function(e){return e instanceof Array&&(e=new Float32Array(e)),new r(e)},r}(),Sf={Float32Array,Uint32Array,Int32Array,Uint8Array};function Pf(r,e){for(var t=0,i=0,n={},s=0;s<r.length;s++)i+=e[s],t+=r[s].length;for(var a=new ArrayBuffer(t*4),o=null,h=0,s=0;s<r.length;s++){var u=e[s],l=r[s],f=xs(l);n[f]||(n[f]=new Sf[f](a)),o=n[f];for(var c=0;c<l.length;c++){var d=(c/u|0)*i+h,p=c%u;o[d+p]=l[c]}h+=u}return new Float32Array(a)}var Ns={5126:4,5123:2,5121:1},Cf=0,Rf={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},ti=function(){function r(e,t){e===void 0&&(e=[]),t===void 0&&(t={}),this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=Cf++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new wt("disposeGeometry"),this.refCount=0}return r.prototype.addAttribute=function(e,t,i,n,s,a,o,h){if(i===void 0&&(i=0),n===void 0&&(n=!1),h===void 0&&(h=!1),!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof yt||(t instanceof Array&&(t=new Float32Array(t)),t=new yt(t));var u=e.split("|");if(u.length>1){for(var l=0;l<u.length;l++)this.addAttribute(u[l],t,i,n,s);return this}var f=this.buffers.indexOf(t);return f===-1&&(this.buffers.push(t),f=this.buffers.length-1),this.attributes[e]=new Fs(f,i,n,s,a,o,h),this.instanced=this.instanced||h,this},r.prototype.getAttribute=function(e){return this.attributes[e]},r.prototype.getBuffer=function(e){return this.buffers[this.getAttribute(e).buffer]},r.prototype.addIndex=function(e){return e instanceof yt||(e instanceof Array&&(e=new Uint16Array(e)),e=new yt(e)),e.type=jt.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.indexOf(e)===-1&&this.buffers.push(e),this},r.prototype.getIndex=function(){return this.indexBuffer},r.prototype.interleave=function(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;var e=[],t=[],i=new yt,n;for(n in this.attributes){var s=this.attributes[n],a=this.buffers[s.buffer];e.push(a.data),t.push(s.size*Ns[s.type]/4),s.buffer=0}for(i.data=Pf(e,t),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},r.prototype.getSize=function(){for(var e in this.attributes){var t=this.attributes[e],i=this.buffers[t.buffer];return i.data.length/(t.stride/4||t.size)}return 0},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},r.prototype.clone=function(){for(var e=new r,t=0;t<this.buffers.length;t++)e.buffers[t]=new yt(this.buffers[t].data.slice(0));for(var t in this.attributes){var i=this.attributes[t];e.attributes[t]=new Fs(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=jt.ELEMENT_ARRAY_BUFFER),e},r.merge=function(e){for(var t=new r,i=[],n=[],s=[],a,o=0;o<e.length;o++){a=e[o];for(var h=0;h<a.buffers.length;h++)n[h]=n[h]||0,n[h]+=a.buffers[h].data.length,s[h]=0}for(var o=0;o<a.buffers.length;o++)i[o]=new Rf[xs(a.buffers[o].data)](n[o]),t.buffers[o]=new yt(i[o]);for(var o=0;o<e.length;o++){a=e[o];for(var h=0;h<a.buffers.length;h++)i[h].set(a.buffers[h].data,s[h]),s[h]+=a.buffers[h].data.length}if(t.attributes=a.attributes,a.indexBuffer){t.indexBuffer=t.buffers[a.buffers.indexOf(a.indexBuffer)],t.indexBuffer.type=jt.ELEMENT_ARRAY_BUFFER;for(var u=0,l=0,f=0,c=0,o=0;o<a.buffers.length;o++)if(a.buffers[o]!==a.indexBuffer){c=o;break}for(var o in a.attributes){var d=a.attributes[o];(d.buffer|0)===c&&(l+=d.size*Ns[d.type]/4)}for(var o=0;o<e.length;o++){for(var p=e[o].indexBuffer.data,h=0;h<p.length;h++)t.indexBuffer.data[h+f]+=u;u+=e[o].buffers[c].data.length/l,f+=p.length}}return t},r}(),Af=function(r){rt(e,r);function e(){var t=r.call(this)||this;return t.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),t}return e}(ti),Bs=function(r){rt(e,r);function e(){var t=r.call(this)||this;return t.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),t.uvs=new Float32Array([0,0,1,0,1,1,0,1]),t.vertexBuffer=new yt(t.vertices),t.uvBuffer=new yt(t.uvs),t.addAttribute("aVertexPosition",t.vertexBuffer).addAttribute("aTextureCoord",t.uvBuffer).addIndex([0,1,2,0,2,3]),t}return e.prototype.map=function(t,i){var n=0,s=0;return this.uvs[0]=n,this.uvs[1]=s,this.uvs[2]=n+i.width/t.width,this.uvs[3]=s,this.uvs[4]=n+i.width/t.width,this.uvs[5]=s+i.height/t.height,this.uvs[6]=n,this.uvs[7]=s+i.height/t.height,n=i.x,s=i.y,this.vertices[0]=n,this.vertices[1]=s,this.vertices[2]=n+i.width,this.vertices[3]=s,this.vertices[4]=n+i.width,this.vertices[5]=s+i.height,this.vertices[6]=n,this.vertices[7]=s+i.height,this.invalidate(),this},e.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},e}(ti),If=0,be=function(){function r(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=If++,this.static=!!t,this.ubo=!!i,e instanceof yt?(this.buffer=e,this.buffer.type=jt.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new yt(new Float32Array(1)),this.buffer.type=jt.UNIFORM_BUFFER,this.autoManage=!0))}return r.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},r.prototype.add=function(e,t,i){if(!this.ubo)this.uniforms[e]=new r(t,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")},r.from=function(e,t,i){return new r(e,t,i)},r.uboFrom=function(e,t){return new r(e,t??!0,!0)},r}(),Of=function(){function r(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ct.NONE,this.sourceFrame=new z,this.destinationFrame=new z,this.bindingSourceFrame=new z,this.bindingDestinationFrame=new z,this.filters=[],this.transform=null}return r.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},r}(),Fi=[new W,new W,new W,new W],Nr=new gt,Mf=function(){function r(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new wf,this.texturePool.setScreenSize(e.view),this.statePool=[],this.quad=new Af,this.quadUv=new Bs,this.tempRect=new z,this.activeState={},this.globalUniforms=new be({outputFrame:new z,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}return r.prototype.push=function(e,t){for(var i,n,s=this.renderer,a=this.defaultFilterStack,o=this.statePool.pop()||new Of,h=this.renderer.renderTexture,u=t[0].resolution,l=t[0].multisample,f=t[0].padding,c=t[0].autoFit,d=(i=t[0].legacy)!==null&&i!==void 0?i:!0,p=1;p<t.length;p++){var v=t[p];u=Math.min(u,v.resolution),l=Math.min(l,v.multisample),f=this.useMaxPadding?Math.max(f,v.padding):f+v.padding,c=c&&v.autoFit,d=d||((n=v.legacy)!==null&&n!==void 0?n:!0)}a.length===1&&(this.defaultFilterStack[0].renderTexture=h.current),a.push(o),o.resolution=u,o.multisample=l,o.legacy=d,o.target=e,o.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),o.sourceFrame.pad(f);var _=this.tempRect.copyFrom(h.sourceFrame);s.projection.transform&&this.transformAABB(Nr.copyFrom(s.projection.transform).invert(),_),c?(o.sourceFrame.fit(_),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(_)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,h.current?h.current.resolution:s.resolution,h.sourceFrame,h.destinationFrame,s.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,u,l),o.filters=t,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;var 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(h.sourceFrame),o.bindingDestinationFrame.copyFrom(h.destinationFrame),o.transform=s.projection.transform,s.projection.transform=null,h.bind(o.renderTexture,o.sourceFrame,m),s.framebuffer.clear(0,0,0,0)},r.prototype.pop=function(){var e=this.defaultFilterStack,t=e.pop(),i=t.filters;this.activeState=t;var n=this.globalUniforms.uniforms;n.outputFrame=t.sourceFrame,n.resolution=t.resolution;var s=n.inputSize,a=n.inputPixel,o=n.inputClamp;if(s[0]=t.destinationFrame.width,s[1]=t.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],a[0]=Math.round(s[0]*t.resolution),a[1]=Math.round(s[1]*t.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=t.sourceFrame.width*s[2]-.5*a[2],o[3]=t.sourceFrame.height*s[3]-.5*a[3],t.legacy){var h=n.filterArea;h[0]=t.destinationFrame.width,h[1]=t.destinationFrame.height,h[2]=t.sourceFrame.x,h[3]=t.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();var u=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,t.renderTexture,u.renderTexture,Ft.BLEND,t),this.returnFilterTexture(t.renderTexture);else{var l=t.renderTexture,f=this.getOptimalFilterTexture(l.width,l.height,t.resolution);f.filterFrame=l.filterFrame;var c=0;for(c=0;c<i.length-1;++c){c===1&&t.multisample>1&&(f=this.getOptimalFilterTexture(l.width,l.height,t.resolution),f.filterFrame=l.filterFrame),i[c].apply(this,l,f,Ft.CLEAR,t);var d=l;l=f,f=d}i[c].apply(this,l,u.renderTexture,Ft.BLEND,t),c>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(f)}t.clear(),this.statePool.push(t)},r.prototype.bindAndClear=function(e,t){t===void 0&&(t=Ft.CLEAR);var i=this.renderer,n=i.renderTexture,s=i.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var a=this.tempRect;a.x=0,a.y=0,a.width=e.filterFrame.width,a.height=e.filterFrame.height,n.bind(e,e.filterFrame,a)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var o=s.stateId&1||this.forceClear;(t===Ft.CLEAR||t===Ft.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(e,t,i,n){var s=this.renderer;s.state.set(e.state),this.bindAndClear(i,n),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(Ot.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(Ot.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(e,t){var i=this.activeState,n=i.sourceFrame,s=i.destinationFrame,a=t._texture.orig,o=e.set(s.width,0,0,s.height,n.x,n.y),h=t.worldTransform.copyTo(gt.TEMP_MATRIX);return h.invert(),o.prepend(h),o.scale(1/a.width,1/a.height),o.translate(t.anchor.x,t.anchor.y),o},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(e,t,i,n){return i===void 0&&(i=1),n===void 0&&(n=ct.NONE),this.texturePool.getOptimalTexture(e,t,i,n)},r.prototype.getFilterTexture=function(e,t,i){if(typeof e=="number"){var n=e;e=t,t=n}e=e||this.activeState.renderTexture;var s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||ct.NONE);return s.filterFrame=e.filterFrame,s},r.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(e,t){var i=Fi[0],n=Fi[1],s=Fi[2],a=Fi[3];i.set(t.left,t.top),n.set(t.left,t.bottom),s.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(i,i),e.apply(n,n),e.apply(s,s),e.apply(a,a);var o=Math.min(i.x,n.x,s.x,a.x),h=Math.min(i.y,n.y,s.y,a.y),u=Math.max(i.x,n.x,s.x,a.x),l=Math.max(i.y,n.y,s.y,a.y);t.x=o,t.y=h,t.width=u-o,t.height=l-h},r.prototype.roundFrame=function(e,t,i,n,s){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(s){var a=s.a,o=s.b,h=s.c,u=s.d;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(u)>1e-4))return}s=s?Nr.copyFrom(s):Nr.identity(),s.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.transformAABB(s,e),e.ceil(t),this.transformAABB(s.invert(),e)}},r}(),Ni=function(){function r(e){this.renderer=e}return r.prototype.flush=function(){},r.prototype.destroy=function(){this.renderer=null},r.prototype.start=function(){},r.prototype.stop=function(){this.flush()},r.prototype.render=function(e){},r}(),Df=function(){function r(e){this.renderer=e,this.emptyRenderer=new Ni(e),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(e,t){for(var i=this.renderer.texture.boundTextures,n=t-1;n>=0;--n)e[n]=i[n]||null,e[n]&&(e[n]._batchLocation=n)},r.prototype.boundArray=function(e,t,i,n){for(var s=e.elements,a=e.ids,o=e.count,h=0,u=0;u<o;u++){var l=s[u],f=l._batchLocation;if(f>=0&&f<n&&t[f]===l){a[u]=f;continue}for(;h<n;){var c=t[h];if(c&&c._batchEnabled===i&&c._batchLocation===h){h++;continue}a[u]=h,l._batchLocation=h,t[h]=l;break}}},r.prototype.destroy=function(){this.renderer=null},r}(),Ls=0,Ff=function(){function r(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),e.view.addEventListener("webglcontextlost",this.handleContextLost,!1),e.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(r.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),r.prototype.contextChange=function(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=Ls++,e.isContextLost()&&e.getExtension("WEBGL_lose_context")&&e.getExtension("WEBGL_lose_context").restoreContext()},r.prototype.initFromContext=function(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=Ls++,this.renderer.runners.contextChange.emit(e)},r.prototype.initFromOptions=function(e){var t=this.createContext(this.renderer.view,e);this.initFromContext(t)},r.prototype.createContext=function(e,t){var i;if(F.PREFER_ENV>=Zt.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var e=this.gl,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(e){e.preventDefault()},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(e){var t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var n=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),Nf=function(){function r(e){this.framebuffer=e,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}return r}(),Bf=new z,Lf=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Fr(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new z,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),this.renderer.context.webGLVersion===1){var t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;F.PREFER_ENV===Zt.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=function(n){return t.drawBuffersWEBGL(n)}:(this.hasMRT=!1,e.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},r.prototype.bind=function(e,t,i){i===void 0&&(i=0);var n=this.gl;if(e){var s=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,s.mipLevel=i),s.dirtyId!==e.dirtyId&&(s.dirtyId=e.dirtyId,s.dirtyFormat!==e.dirtyFormat?(s.dirtyFormat=e.dirtyFormat,s.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):s.dirtySize!==e.dirtySize&&(s.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var a=0;a<e.colorTextures.length;a++){var o=e.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){var h=t.width>>i,u=t.height>>i,l=h/t.width;this.setViewport(t.x*l,t.y*l,h,u)}else{var h=e.width>>i,u=e.height>>i;this.setViewport(0,0,h,u)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(e,t,i,n){var s=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),n=Math.round(n),(s.width!==i||s.height!==n||s.x!==e||s.y!==t)&&(s.x=e,s.y=t,s.width=i,s.height=n,this.gl.viewport(e,t,i,n))},Object.defineProperty(r.prototype,"size",{get:function(){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}},enumerable:!1,configurable:!0}),r.prototype.clear=function(e,t,i,n,s){s===void 0&&(s=yi.COLOR|yi.DEPTH);var a=this.gl;a.clearColor(e,t,i,n),a.clear(s)},r.prototype.initFramebuffer=function(e){var t=this.gl,i=new Nf(t.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i},r.prototype.resizeFramebuffer=function(e){var t=this.gl,i=e.glFramebuffers[this.CONTEXT_UID];i.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,t.RGBA8,e.width,e.height)),i.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,i.stencil),i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var n=e.colorTextures,s=n.length;t.drawBuffers||(s=Math.min(s,1));for(var a=0;a<s;a++){var o=n[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0)}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)},r.prototype.updateFramebuffer=function(e,t){var i=this.gl,n=e.glFramebuffers[this.CONTEXT_UID],s=e.colorTextures,a=s.length;i.drawBuffers||(a=Math.min(a,1)),n.multisample>1&&this.canMultisampleFramebuffer(e)?(n.msaaBuffer=n.msaaBuffer||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,n.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,i.RGBA8,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,n.msaaBuffer)):n.msaaBuffer&&(i.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));for(var o=[],h=0;h<a;h++){var u=s[h],l=u.parentTextureArray||u;this.renderer.texture.bind(l,0),!(h===0&&n.msaaBuffer)&&(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,u.target,l._glTextures[this.CONTEXT_UID].texture,t),o.push(i.COLOR_ATTACHMENT0+h))}if(o.length>1&&i.drawBuffers(o),e.depthTexture){var f=this.writeDepthTexture;if(f){var c=e.depthTexture;this.renderer.texture.bind(c,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,t)}}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(n.stencil=n.stencil||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,n.stencil),n.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,i.DEPTH24_STENCIL8,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,n.stencil)):n.stencil&&(i.deleteRenderbuffer(n.stencil),n.stencil=null)},r.prototype.canMultisampleFramebuffer=function(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture},r.prototype.detectSamples=function(e){var t=this.msaaSamples,i=ct.NONE;if(e<=1||t===null)return i;for(var n=0;n<t.length;n++)if(t[n]<=e){i=t[n];break}return i===1&&(i=ct.NONE),i},r.prototype.blit=function(e,t,i){var n=this,s=n.current,a=n.renderer,o=n.gl,h=n.CONTEXT_UID;if(a.context.webGLVersion===2&&s){var u=s.glFramebuffers[h];if(u){if(!e){if(!u.msaaBuffer)return;var l=s.colorTextures[0];if(!l)return;u.blitFramebuffer||(u.blitFramebuffer=new Fr(s.width,s.height),u.blitFramebuffer.addColorTexture(0,l)),e=u.blitFramebuffer,e.colorTextures[0]!==l&&(e.colorTextures[0]=l,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}t||(t=Bf,t.width=s.width,t.height=s.height),i||(i=t);var f=t.width===i.width&&t.height===i.height;this.bind(e),o.bindFramebuffer(o.READ_FRAMEBUFFER,u.framebuffer),o.blitFramebuffer(t.left,t.top,t.right,t.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,f?o.NEAREST:o.LINEAR)}}},r.prototype.disposeFramebuffer=function(e,t){var i=e.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(i){delete e.glFramebuffers[this.CONTEXT_UID];var s=this.managedFramebuffers.indexOf(e);s>=0&&this.managedFramebuffers.splice(s,1),e.disposeRunner.remove(this),t||(n.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&n.deleteRenderbuffer(i.msaaBuffer),i.stencil&&n.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&i.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<t.length;i++)this.disposeFramebuffer(t[i],e)},r.prototype.forceStencil=function(){var e=this.current;if(e){var t=e.glFramebuffers[this.CONTEXT_UID];if(!(!t||t.stencil)){e.stencil=!0;var i=e.width,n=e.height,s=this.gl,a=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,a),t.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,t.multisample,s.DEPTH24_STENCIL8,i,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,i,n),t.stencil=a,s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)}}},r.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new z},r.prototype.destroy=function(){this.renderer=null},r}(),Br={5126:4,5123:2,5121:1},Uf=function(){function r(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return r.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){var i=this.renderer.context.extensions.vertexArrayObject;F.PREFER_ENV===Zt.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=function(){return i.createVertexArrayOES()},e.bindVertexArray=function(s){return i.bindVertexArrayOES(s)},e.deleteVertexArray=function(s){return i.deleteVertexArrayOES(s)}):(this.hasVao=!1,e.createVertexArray=function(){return null},e.bindVertexArray=function(){return null},e.deleteVertexArray=function(){return null})}if(t.webGLVersion!==2){var n=e.getExtension("ANGLE_instanced_arrays");n?(e.vertexAttribDivisor=function(s,a){return n.vertexAttribDivisorANGLE(s,a)},e.drawElementsInstanced=function(s,a,o,h,u){return n.drawElementsInstancedANGLE(s,a,o,h,u)},e.drawArraysInstanced=function(s,a,o,h){return n.drawArraysInstancedANGLE(s,a,o,h)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex},r.prototype.bind=function(e,t){t=t||this.renderer.shader.shader;var i=this.gl,n=e.glVertexArrayObjects[this.CONTEXT_UID],s=!1;n||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=n={},s=!0);var a=n[t.program.id]||this.initGeometryVao(e,t,s);this._activeGeometry=e,this._activeVao!==a&&(this._activeVao=a,this.hasVao?i.bindVertexArray(a):this.activateVao(e,t.program)),this.updateBuffers()},r.prototype.reset=function(){this.unbind()},r.prototype.updateBuffers=function(){for(var e=this._activeGeometry,t=this.renderer.buffer,i=0;i<e.buffers.length;i++){var n=e.buffers[i];t.update(n)}},r.prototype.checkCompatibility=function(e,t){var i=e.attributes,n=t.attributeData;for(var s in n)if(!i[s])throw new Error('shader and geometry incompatible, geometry missing the "'+s+'" attribute')},r.prototype.getSignature=function(e,t){var i=e.attributes,n=t.attributeData,s=["g",e.id];for(var a in i)n[a]&&s.push(a,n[a].location);return s.join("-")},r.prototype.initGeometryVao=function(e,t,i){i===void 0&&(i=!0);var n=this.gl,s=this.CONTEXT_UID,a=this.renderer.buffer,o=t.program;o.glPrograms[s]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,o);var h=this.getSignature(e,o),u=e.glVertexArrayObjects[this.CONTEXT_UID],l=u[h];if(l)return u[o.id]=l,l;var f=e.buffers,c=e.attributes,d={},p={};for(var v in f)d[v]=0,p[v]=0;for(var v in c)!c[v].size&&o.attributeData[v]?c[v].size=o.attributeData[v].size:c[v].size||console.warn("PIXI Geometry attribute '"+v+"' size cannot be determined (likely the bound shader does not have the attribute)"),d[c[v].buffer]+=c[v].size*Br[c[v].type];for(var v in c){var _=c[v],m=_.size;_.stride===void 0&&(d[_.buffer]===m*Br[_.type]?_.stride=0:_.stride=d[_.buffer]),_.start===void 0&&(_.start=p[_.buffer],p[_.buffer]+=m*Br[_.type])}l=n.createVertexArray(),n.bindVertexArray(l);for(var y=0;y<f.length;y++){var g=f[y];a.bind(g),i&&g._glBuffers[s].refCount++}return this.activateVao(e,o),this._activeVao=l,u[o.id]=l,u[h]=l,l},r.prototype.disposeGeometry=function(e,t){var i;if(this.managedGeometries[e.id]){delete this.managedGeometries[e.id];var n=e.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,a=e.buffers,o=(i=this.renderer)===null||i===void 0?void 0:i.buffer;if(e.disposeRunner.remove(this),!!n){if(o)for(var h=0;h<a.length;h++){var u=a[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!t&&o.dispose(a[h],t))}if(!t){for(var l in n)if(l[0]==="g"){var f=n[l];this._activeVao===f&&this.unbind(),s.deleteVertexArray(f)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}},r.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedGeometries),i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)},r.prototype.activateVao=function(e,t){var i=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,a=e.buffers,o=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);var h=null;for(var u in o){var l=o[u],f=a[l.buffer],c=f._glBuffers[n];if(t.attributeData[u]){h!==c&&(s.bind(f),h=c);var d=t.attributeData[u].location;if(i.enableVertexAttribArray(d),i.vertexAttribPointer(d,l.size,l.type||i.FLOAT,l.normalized,l.stride,l.start),l.instance)if(this.hasInstance)i.vertexAttribDivisor(d,1);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}},r.prototype.draw=function(e,t,i,n){var s=this.gl,a=this._activeGeometry;if(a.indexBuffer){var o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?s.drawElementsInstanced(e,t||a.indexBuffer.data.length,h,(i||0)*o,n||1):s.drawElements(e,t||a.indexBuffer.data.length,h,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?s.drawArraysInstanced(e,i,t||a.getSize(),n||1):s.drawArrays(e,i,t||a.getSize());return this},r.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},r.prototype.destroy=function(){this.renderer=null},r}(),Gf=function(){function r(e){e===void 0&&(e=null),this.type=mt.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=F.FILTER_MULTISAMPLE,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}return Object.defineProperty(r.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null},enumerable:!1,configurable:!0}),r.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=mt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},r.prototype.copyCountersOrReset=function(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},r}();function Us(r,e,t){var i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}function Gs(r,e){var t=r.getShaderSource(e).split(`
10
+ Deprecated since v`+r),console.warn(i))),Es[e]=!0}}var Ss={},te=Object.create(null),be=Object.create(null),Ps=function(){function r(e,t,i){this.canvas=F.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=i||F.RESOLUTION,this.resize(e,t)}return r.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},r.prototype.resize=function(e,t){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(t*this.resolution)},r.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(r.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),r}();function df(r){var e=r.width,t=r.height,i=r.getContext("2d",{willReadFrequently:!0}),n=i.getImageData(0,0,e,t),s=n.data,a=s.length,o={top:null,left:null,right:null,bottom:null},h=null,u,l,f;for(u=0;u<a;u+=4)s[u+3]!==0&&(l=u/4%e,f=~~(u/4/e),o.top===null&&(o.top=f),(o.left===null||l<o.left)&&(o.left=l),(o.right===null||o.right<l)&&(o.right=l+1),(o.bottom===null||o.bottom<f)&&(o.bottom=f));return o.top!==null&&(e=o.right-o.left,t=o.bottom-o.top+1,h=i.getImageData(o.left,o.top,e,t)),{height:t,width:e,data:h}}var Mi;function pf(r,e){if(e===void 0&&(e=globalThis.location),r.indexOf("data:")===0)return"";e=e||globalThis.location,Mi||(Mi=document.createElement("a")),Mi.href=r;var t=Ne.parse(Mi.href),i=!t.port&&e.port===""||t.port===e.port;return t.hostname!==e.hostname||!i||t.protocol!==e.protocol?"anonymous":""}function Di(r,e){var t=F.RETINA_PREFIX.exec(r);return t?parseFloat(t[1]):e!==void 0?e:1}F.SORTABLE_CHILDREN=!1;var Fi=function(){function r(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return r.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},r.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},r.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?j.EMPTY:(e=e||new j(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},r.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},r.prototype.addPointMatrix=function(e,t){var i=e.a,n=e.b,s=e.c,a=e.d,o=e.tx,h=e.ty,u=i*t.x+s*t.y+o,l=n*t.x+a*t.y+h;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},r.prototype.addQuad=function(e){var t=this.minX,i=this.minY,n=this.maxX,s=this.maxY,a=e[0],o=e[1];t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=e[2],o=e[3],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=e[4],o=e[5],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=e[6],o=e[7],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,this.minX=t,this.minY=i,this.maxX=n,this.maxY=s},r.prototype.addFrame=function(e,t,i,n,s){this.addFrameMatrix(e.worldTransform,t,i,n,s)},r.prototype.addFrameMatrix=function(e,t,i,n,s){var a=e.a,o=e.b,h=e.c,u=e.d,l=e.tx,f=e.ty,c=this.minX,d=this.minY,p=this.maxX,v=this.maxY,_=a*t+h*i+l,m=o*t+u*i+f;c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*n+h*i+l,m=o*n+u*i+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*t+h*s+l,m=o*t+u*s+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*n+h*s+l,m=o*n+u*s+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,this.minX=c,this.minY=d,this.maxX=p,this.maxY=v},r.prototype.addVertexData=function(e,t,i){for(var n=this.minX,s=this.minY,a=this.maxX,o=this.maxY,h=t;h<i;h+=2){var u=e[h],l=e[h+1];n=u<n?u:n,s=l<s?l:s,a=u>a?u:a,o=l>o?l:o}this.minX=n,this.minY=s,this.maxX=a,this.maxY=o},r.prototype.addVertices=function(e,t,i,n){this.addVerticesMatrix(e.worldTransform,t,i,n)},r.prototype.addVerticesMatrix=function(e,t,i,n,s,a){s===void 0&&(s=0),a===void 0&&(a=s);for(var o=e.a,h=e.b,u=e.c,l=e.d,f=e.tx,c=e.ty,d=this.minX,p=this.minY,v=this.maxX,_=this.maxY,m=i;m<n;m+=2){var g=t[m],y=t[m+1],b=o*g+u*y+f,x=l*y+h*g+c;d=Math.min(d,b-s),v=Math.max(v,b+s),p=Math.min(p,x-a),_=Math.max(_,x+a)}this.minX=d,this.minY=p,this.maxX=v,this.maxY=_},r.prototype.addBounds=function(e){var t=this.minX,i=this.minY,n=this.maxX,s=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<i?e.minY:i,this.maxX=e.maxX>n?e.maxX:n,this.maxY=e.maxY>s?e.maxY:s},r.prototype.addBoundsMask=function(e,t){var i=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,s=e.maxX<t.maxX?e.maxX:t.maxX,a=e.maxY<t.maxY?e.maxY:t.maxY;if(i<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},r.prototype.addBoundsMatrix=function(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)},r.prototype.addBoundsArea=function(e,t){var i=e.minX>t.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,s=e.maxX<t.x+t.width?e.maxX:t.x+t.width,a=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(i<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},r.prototype.pad=function(e,t){e===void 0&&(e=0),t===void 0&&(t=e),this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)},r.prototype.addFramePad=function(e,t,i,n,s,a){e-=s,t-=a,i+=s,n+=a,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>n?this.maxY:n},r}();var Or=function(r,e){return Or=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Or(r,e)};function Mr(r,e){Or(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var pt=function(r){Mr(e,r);function e(){var t=r.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new Wn,t.alpha=1,t.visible=!0,t.renderable=!0,t.cullable=!1,t.cullArea=null,t.parent=null,t.worldAlpha=1,t._lastSortedIndex=0,t._zIndex=0,t.filterArea=null,t.filters=null,t._enabledFilters=null,t._bounds=new Fi,t._localBounds=null,t._boundsID=0,t._boundsRect=null,t._localBoundsRect=null,t._mask=null,t._maskRefCount=0,t._destroyed=!1,t.isSprite=!1,t.isMask=!1,t}return e.mixin=function(t){for(var i=Object.keys(t),n=0;n<i.length;++n){var s=i[n];Object.defineProperty(e.prototype,s,Object.getOwnPropertyDescriptor(t,s))}},Object.defineProperty(e.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),e.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},e.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},e.prototype.getBounds=function(t,i){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),i||(this._boundsRect||(this._boundsRect=new j),i=this._boundsRect),this._bounds.getRectangle(i)},e.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Fi);var i=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var s=this._bounds,a=this._boundsID;this._bounds=this._localBounds;var o=this.getBounds(!1,t);return this.parent=n,this.transform=i,this._bounds=s,this._bounds.updateID+=this._boundsID-a,o},e.prototype.toGlobal=function(t,i,n){return n===void 0&&(n=!1),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,i)},e.prototype.toLocal=function(t,i,n,s){return i&&(t=i.toGlobal(t,n,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,n)},e.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},e.prototype.setTransform=function(t,i,n,s,a,o,h,u,l){return t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=1),a===void 0&&(a=0),o===void 0&&(o=0),h===void 0&&(h=0),u===void 0&&(u=0),l===void 0&&(l=0),this.position.x=t,this.position.y=i,this.scale.x=n||1,this.scale.y=s||1,this.rotation=a,this.skew.x=o,this.skew.y=h,this.pivot.x=u,this.pivot.y=l,this},e.prototype.destroy=function(t){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(e.prototype,"_tempDisplayObjectParent",{get:function(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Rs),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),e.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},e.prototype.disableTempParent=function(t){this.parent=t},Object.defineProperty(e.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.rotation=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.transform.rotation*po},set:function(t){this.transform.rotation=t*vo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mask",{get:function(){return this._mask},set:function(t){if(this._mask!==t){if(this._mask){var i=this._mask.isMaskData?this._mask.maskObject:this._mask;i&&(i._maskRefCount--,i._maskRefCount===0&&(i.renderable=!0,i.isMask=!1))}if(this._mask=t,this._mask){var i=this._mask.isMaskData?this._mask.maskObject:this._mask;i&&(i._maskRefCount===0&&(i.renderable=!1,i.isMask=!0),i._maskRefCount++)}}},enumerable:!1,configurable:!0}),e}(Ve),Rs=function(r){Mr(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.sortDirty=null,t}return e}(pt);pt.prototype.displayObjectUpdateTransform=pt.prototype.updateTransform;function vf(r,e){return r.zIndex===e.zIndex?r._lastSortedIndex-e._lastSortedIndex:r.zIndex-e.zIndex}var Pt=function(r){Mr(e,r);function e(){var t=r.call(this)||this;return t.children=[],t.sortableChildren=F.SORTABLE_CHILDREN,t.sortDirty=!1,t}return e.prototype.onChildrenChange=function(t){},e.prototype.addChild=function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];if(i.length>1)for(var s=0;s<i.length;s++)this.addChild(i[s]);else{var a=i[0];a.parent&&a.parent.removeChild(a),a.parent=this,this.sortDirty=!0,a.transform._parentID=-1,this.children.push(a),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",a,this,this.children.length-1),a.emit("added",this)}return i[0]},e.prototype.addChildAt=function(t,i){if(i<0||i>this.children.length)throw new Error(t+"addChildAt: The index "+i+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(i,0,t),this._boundsID++,this.onChildrenChange(i),t.emit("added",this),this.emit("childAdded",t,this,i),t},e.prototype.swapChildren=function(t,i){if(t!==i){var n=this.getChildIndex(t),s=this.getChildIndex(i);this.children[n]=i,this.children[s]=t,this.onChildrenChange(n<s?n:s)}},e.prototype.getChildIndex=function(t){var i=this.children.indexOf(t);if(i===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return i},e.prototype.setChildIndex=function(t,i){if(i<0||i>=this.children.length)throw new Error("The index "+i+" supplied is out of bounds "+this.children.length);var n=this.getChildIndex(t);Le(this.children,n,1),this.children.splice(i,0,t),this.onChildrenChange(i)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];if(i.length>1)for(var s=0;s<i.length;s++)this.removeChild(i[s]);else{var a=i[0],o=this.children.indexOf(a);if(o===-1)return null;a.parent=null,a.transform._parentID=-1,Le(this.children,o,1),this._boundsID++,this.onChildrenChange(o),a.emit("removed",this),this.emit("childRemoved",a,this,o)}return i[0]},e.prototype.removeChildAt=function(t){var i=this.getChildAt(t);return i.parent=null,i.transform._parentID=-1,Le(this.children,t,1),this._boundsID++,this.onChildrenChange(t),i.emit("removed",this),this.emit("childRemoved",i,this,t),i},e.prototype.removeChildren=function(t,i){t===void 0&&(t=0),i===void 0&&(i=this.children.length);var n=t,s=i,a=s-n,o;if(a>0&&a<=s){o=this.children.splice(n,a);for(var h=0;h<o.length;++h)o[h].parent=null,o[h].transform&&(o[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(var h=0;h<o.length;++h)o[h].emit("removed",this),this.emit("childRemoved",o[h],this,h);return o}else if(a===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var t=!1,i=0,n=this.children.length;i<n;++i){var s=this.children[i];s._lastSortedIndex=i,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(vf),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,i=this.children.length;t<i;++t){var n=this.children[t];n.visible&&n.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var i=this.children[t];if(!(!i.visible||!i.renderable))if(i.calculateBounds(),i._mask){var n=i._mask.isMaskData?i._mask.maskObject:i._mask;n?(n.calculateBounds(),this._bounds.addBoundsMask(i._bounds,n._bounds)):this._bounds.addBounds(i._bounds)}else i.filterArea?this._bounds.addBoundsArea(i._bounds,i.filterArea):this._bounds.addBounds(i._bounds)}this._bounds.updateID=this._boundsID},e.prototype.getLocalBounds=function(t,i){i===void 0&&(i=!1);var n=r.prototype.getLocalBounds.call(this,t);if(!i)for(var s=0,a=this.children.length;s<a;++s){var o=this.children[s];o.visible&&o.updateTransform()}return n},e.prototype._calculateBounds=function(){},e.prototype._renderWithCulling=function(t){var i=t.renderTexture.sourceFrame;if(i.width>0&&i.height>0){var n,s;if(this.cullArea?(n=this.cullArea,s=this.worldTransform):this._render!==e.prototype._render&&(n=this.getBounds(!0)),n&&i.intersects(n,s))this._render(t);else if(this.cullArea)return;for(var a=0,o=this.children.length;a<o;++a){var h=this.children[a],u=h.cullable;h.cullable=u||!this.cullArea,h.render(t),h.cullable=u}}},e.prototype.render=function(t){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(var i=0,n=this.children.length;i<n;++i)this.children[i].render(t)}},e.prototype.renderAdvanced=function(t){var i=this.filters,n=this._mask;if(i){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var s=0;s<i.length;s++)i[s].enabled&&this._enabledFilters.push(i[s])}var a=i&&this._enabledFilters&&this._enabledFilters.length||n&&(!n.isMaskData||n.enabled&&(n.autoDetect||n.type!==mt.NONE));if(a&&t.batch.flush(),i&&this._enabledFilters&&this._enabledFilters.length&&t.filter.push(this,this._enabledFilters),n&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(var s=0,o=this.children.length;s<o;++s)this.children[s].render(t)}a&&t.batch.flush(),n&&t.mask.pop(this),i&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},e.prototype._render=function(t){},e.prototype.destroy=function(t){r.prototype.destroy.call(this),this.sortDirty=!1;var i=typeof t=="boolean"?t:t&&t.children,n=this.removeChildren(0,this.children.length);if(i)for(var s=0;s<n.length;++s)n[s].destroy(t)},Object.defineProperty(e.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(t){var i=this.getLocalBounds().width;i!==0?this.scale.x=t/i:this.scale.x=1,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(t){var i=this.getLocalBounds().height;i!==0?this.scale.y=t/i:this.scale.y=1,this._height=t},enumerable:!1,configurable:!0}),e}(pt);Pt.prototype.containerUpdateTransform=Pt.prototype.updateTransform;var Je=function(){return Je=Object.assign||function(e){for(var t=arguments,i,n=1,s=arguments.length;n<s;n++){i=t[n];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},Je.apply(this,arguments)},tt;(function(r){r.Application="application",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Loader="loader",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser"})(tt||(tt={}));var Cs=function(r){if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");var e=typeof r.extension!="object"?{type:r.extension}:r.extension;r=Je(Je({},e),{ref:r})}if(typeof r=="object")r=Je({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},ee={_addHandlers:null,_removeHandlers:null,_queue:{},remove:function(){for(var r=arguments,e=this,t=[],i=0;i<arguments.length;i++)t[i]=r[i];return t.map(Cs).forEach(function(n){n.type.forEach(function(s){var a,o;return(o=(a=e._removeHandlers)[s])===null||o===void 0?void 0:o.call(a,n)})}),this},add:function(){for(var r=arguments,e=this,t=[],i=0;i<arguments.length;i++)t[i]=r[i];return t.map(Cs).forEach(function(n){n.type.forEach(function(s){var a=e._addHandlers,o=e._queue;a[s]?a[s](n):(o[s]=o[s]||[],o[s].push(n))})}),this},handle:function(r,e,t){var i=this._addHandlers=this._addHandlers||{},n=this._removeHandlers=this._removeHandlers||{};if(i[r]||n[r])throw new Error("Extension type "+r+" already has a handler");i[r]=e,n[r]=t;var s=this._queue;return s[r]&&(s[r].forEach(function(a){return e(a)}),delete s[r]),this},handleByMap:function(r,e){return this.handle(r,function(t){e[t.name]=t.ref},function(t){delete e[t.name]})},handleByList:function(r,e){return this.handle(r,function(t){var i,n;e.push(t.ref),r===tt.Loader&&((n=(i=t.ref).add)===null||n===void 0||n.call(i))},function(t){var i=e.indexOf(t.ref);i!==-1&&e.splice(i,1)})}};var Et=function(){function r(e){this.items=[],this._name=e,this._aliasCount=0}return r.prototype.emit=function(e,t,i,n,s,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");var u=this,l=u.name,f=u.items;this._aliasCount++;for(var c=0,d=f.length;c<d;c++)f[c][l](e,t,i,n,s,a,o,h);return f===this.items&&this._aliasCount--,this},r.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},r.prototype.add=function(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this},r.prototype.remove=function(e){var t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this},r.prototype.contains=function(e){return this.items.indexOf(e)!==-1},r.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},r.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(r.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r}();Object.defineProperties(Et.prototype,{dispatch:{value:Et.prototype.emit},run:{value:Et.prototype.emit}});F.TARGET_FPMS=.06;var $t;(function(r){r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY"})($t||($t={}));var Dr=function(){function r(e,t,i,n){t===void 0&&(t=null),i===void 0&&(i=0),n===void 0&&(n=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=n}return r.prototype.match=function(e,t){return t===void 0&&(t=null),this.fn===e&&this.context===t},r.prototype.emit=function(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));var t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t},r.prototype.connect=function(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this},r.prototype.destroy=function(e){e===void 0&&(e=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var t=this.next;return this.next=e?null:t,this.previous=null,t},r}(),Tt=function(){function r(){var e=this;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 Dr(null,null,1/0),this.deltaMS=1/F.TARGET_FPMS,this.elapsedMS=1/F.TARGET_FPMS,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&e._requestId===null&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return r.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},r.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},r.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},r.prototype.add=function(e,t,i){return i===void 0&&(i=$t.NORMAL),this._addListener(new Dr(e,t,i))},r.prototype.addOnce=function(e,t,i){return i===void 0&&(i=$t.NORMAL),this._addListener(new Dr(e,t,i,!0))},r.prototype._addListener=function(e){var t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this},r.prototype.remove=function(e,t){for(var i=this._head.next;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(r.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},r.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},r.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(e){e===void 0&&(e=performance.now());var t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var i=e-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=e-i%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*F.TARGET_FPMS;for(var n=this._head,s=n.next;s;)s=s.emit(this.deltaTime);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e},Object.defineProperty(r.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(e){var t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,F.TARGET_FPMS);this._maxElapsedMS=1/i},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(e){if(e===0)this._minElapsedMS=0;else{var t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(r,"shared",{get:function(){if(!r._shared){var e=r._shared=new r;e.autoStart=!0,e._protected=!0}return r._shared},enumerable:!1,configurable:!0}),Object.defineProperty(r,"system",{get:function(){if(!r._system){var e=r._system=new r;e.autoStart=!0,e._protected=!0}return r._system},enumerable:!1,configurable:!0}),r}(),_f=function(){function r(){}return r.init=function(e){var t=this;e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set:function(i){this._ticker&&this._ticker.remove(this.render,this),this._ticker=i,i&&i.add(this.render,this,$t.LOW)},get:function(){return this._ticker}}),this.stop=function(){t._ticker.stop()},this.start=function(){t._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Tt.shared:new Tt,e.autoStart&&this.start()},r.destroy=function(){if(this._ticker){var e=this._ticker;this.ticker=null,e.destroy()}},r.extension=tt.Application,r}();F.PREFER_ENV=Vt.any?Qt.WEBGL:Qt.WEBGL2,F.STRICT_TEXTURE_CACHE=!1;var Fr=[];function As(r,e){if(!r)return null;var t="";if(typeof r=="string"){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(t=i[1].toLowerCase())}for(var n=Fr.length-1;n>=0;--n){var s=Fr[n];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var Nr=function(r,e){return Nr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Nr(r,e)};function it(r,e){Nr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Br=function(){return Br=Object.assign||function(e){for(var t=arguments,i,n=1,s=arguments.length;n<s;n++){i=t[n];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},Br.apply(this,arguments)};function mf(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}var ti=function(){function r(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new Et("setRealSize"),this.onUpdate=new Et("update"),this.onError=new Et("onError")}return r.prototype.bind=function(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},r.prototype.unbind=function(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)},r.prototype.resize=function(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))},Object.defineProperty(r.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),r.prototype.update=function(){this.destroyed||this.onUpdate.emit()},r.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(r.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),r.prototype.style=function(e,t,i){return!1},r.prototype.dispose=function(){},r.prototype.destroy=function(){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)},r.test=function(e,t){return!1},r}(),ei=function(r){it(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height;if(!a||!o)throw new Error("BufferResource width or height invalid");return n=r.call(this,a,o)||this,n.data=t,n}return e.prototype.upload=function(t,i,n){var s=t.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===Nt.UNPACK);var a=i.realWidth,o=i.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(i.target,0,0,0,a,o,i.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(i.target,0,n.internalFormat,a,o,0,i.format,n.type,this.data)),!0},e.prototype.dispose=function(){this.data=null},e.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},e}(ti),gf={scaleMode:jt.NEAREST,format:R.RGBA,alphaMode:Nt.NPM},V=function(r){it(e,r);function e(t,i){t===void 0&&(t=null),i===void 0&&(i=null);var n=r.call(this)||this;i=i||{};var s=i.alphaMode,a=i.mipmap,o=i.anisotropicLevel,h=i.scaleMode,u=i.width,l=i.height,f=i.wrapMode,c=i.format,d=i.type,p=i.target,v=i.resolution,_=i.resourceOptions;return t&&!(t instanceof ti)&&(t=As(t,_),t.internal=!0),n.resolution=v||F.RESOLUTION,n.width=Math.round((u||0)*n.resolution)/n.resolution,n.height=Math.round((l||0)*n.resolution)/n.resolution,n._mipmap=a!==void 0?a:F.MIPMAP_TEXTURES,n.anisotropicLevel=o!==void 0?o:F.ANISOTROPIC_LEVEL,n._wrapMode=f||F.WRAP_MODE,n._scaleMode=h!==void 0?h:F.SCALE_MODE,n.format=c||R.RGBA,n.type=d||L.UNSIGNED_BYTE,n.target=p||ge.TEXTURE_2D,n.alphaMode=s!==void 0?s:Nt.UNPACK,n.uid=xe(),n.touched=0,n.isPowerOfTwo=!1,n._refreshPOT(),n._glTextures={},n.dirtyId=0,n.dirtyStyleId=0,n.cacheId=null,n.valid=u>0&&l>0,n.textureCacheIds=[],n.destroyed=!1,n.resource=null,n._batchEnabled=0,n._batchLocation=0,n.parentTextureArray=null,n.setResource(t),n}return Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,i){var n;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,n=!0),i!==void 0&&i!==this.mipmap&&(this.mipmap=i,n=!0),n&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,i,n){return n=n||this.resolution,this.setRealSize(t*n,i*n,n)},e.prototype.setRealSize=function(t,i,n){return this.resolution=n||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(i)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=Ts(this.realWidth)&&Ts(this.realHeight)},e.prototype.setResolution=function(t){var i=this.resolution;return i===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*i)/t,this.height=Math.round(this.height*i)/t,this.emit("update",this)),this._refreshPOT(),this)},e.prototype.setResource=function(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},e.prototype.update=function(){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))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete be[this.cacheId],delete te[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,i,n){n===void 0&&(n=F.STRICT_TEXTURE_CACHE);var s=typeof t=="string",a=null;if(s)a=t;else{if(!t._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+xe()}a=t._pixiId}var h=be[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return h||(h=new e(t,i),h.cacheId=a,e.addToCache(h,a)),h},e.fromBuffer=function(t,i,n,s){t=t||new Float32Array(i*n*4);var a=new ei(t,{width:i,height:n}),o=t instanceof Float32Array?L.FLOAT:L.UNSIGNED_BYTE;return new e(a,Object.assign({},gf,s||{width:i,height:n,type:o}))},e.addToCache=function(t,i){i&&(t.textureCacheIds.indexOf(i)===-1&&t.textureCacheIds.push(i),be[i]&&console.warn("BaseTexture added to the cache with an id ["+i+"] that already had an entry"),be[i]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var i=be[t];if(i){var n=i.textureCacheIds.indexOf(t);return n>-1&&i.textureCacheIds.splice(n,1),delete be[t],i}}else if(t&&t.textureCacheIds){for(var s=0;s<t.textureCacheIds.length;++s)delete be[t.textureCacheIds[s]];return t.textureCacheIds.length=0,t}return null},e._globalBatch=0,e}(Ve),Is=function(r){it(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height;n=r.call(this,a,o)||this,n.items=[],n.itemDirtyIds=[];for(var h=0;h<t;h++){var u=new V;n.items.push(u),n.itemDirtyIds.push(-2)}return n.length=t,n._load=null,n.baseTexture=null,n}return e.prototype.initFromArray=function(t,i){for(var n=0;n<this.length;n++)t[n]&&(t[n].castToBaseTexture?this.addBaseTextureAt(t[n].castToBaseTexture(),n):t[n]instanceof ti?this.addResourceAt(t[n],n):this.addResourceAt(As(t[n],i),n))},e.prototype.dispose=function(){for(var t=0,i=this.length;t<i;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},e.prototype.addResourceAt=function(t,i){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[i].setResource(t),this},e.prototype.bind=function(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");r.prototype.bind.call(this,t);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=t,this.items[i].on("update",t.update,t)},e.prototype.unbind=function(t){r.prototype.unbind.call(this,t);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",t.update,t)},e.prototype.load=function(){var t=this;if(this._load)return this._load;var i=this.items.map(function(s){return s.resource}).filter(function(s){return s}),n=i.map(function(s){return s.load()});return this._load=Promise.all(n).then(function(){var s=t.items[0],a=s.realWidth,o=s.realHeight;return t.resize(a,o),Promise.resolve(t)}),this._load},e}(ti),yf=function(r){it(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height,h,u;return Array.isArray(t)?(h=t,u=t.length):u=t,n=r.call(this,u,{width:a,height:o})||this,h&&n.initFromArray(h,i),n}return e.prototype.addBaseTextureAt=function(t,i){if(t.resource)this.addResourceAt(t.resource,i);else throw new Error("ArrayResource does not support RenderTexture");return this},e.prototype.bind=function(t){r.prototype.bind.call(this,t),t.target=ge.TEXTURE_2D_ARRAY},e.prototype.upload=function(t,i,n){var s=this,a=s.length,o=s.itemDirtyIds,h=s.items,u=t.gl;n.dirtyId<0&&u.texImage3D(u.TEXTURE_2D_ARRAY,0,n.internalFormat,this._width,this._height,a,0,i.format,n.type,null);for(var l=0;l<a;l++){var f=h[l];o[l]<f.dirtyId&&(o[l]=f.dirtyId,f.valid&&u.texSubImage3D(u.TEXTURE_2D_ARRAY,0,0,0,l,f.resource.width,f.resource.height,1,i.format,n.type,f.resource.source))}return!0},e}(Is),se=function(r){it(e,r);function e(t){var i=this,n=t,s=n.naturalWidth||n.videoWidth||n.width,a=n.naturalHeight||n.videoHeight||n.height;return i=r.call(this,s,a)||this,i.source=t,i.noSubImage=!1,i}return e.crossOrigin=function(t,i,n){n===void 0&&i.indexOf("data:")!==0?t.crossOrigin=pf(i):n!==!1&&(t.crossOrigin=typeof n=="string"?n:"anonymous")},e.prototype.upload=function(t,i,n,s){var a=t.gl,o=i.realWidth,h=i.realHeight;if(s=s||this.source,s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===Nt.UNPACK),!this.noSubImage&&i.target===a.TEXTURE_2D&&n.width===o&&n.height===h?a.texSubImage2D(a.TEXTURE_2D,0,0,0,i.format,n.type,s):(n.width=o,n.height=h,a.texImage2D(i.target,0,n.internalFormat,i.format,n.type,s)),!0},e.prototype.update=function(){if(!this.destroyed){var t=this.source,i=t.naturalWidth||t.videoWidth||t.width,n=t.naturalHeight||t.videoHeight||t.height;this.resize(i,n),r.prototype.update.call(this)}},e.prototype.dispose=function(){this.source=null},e}(ti),xf=function(r){it(e,r);function e(t){return r.call(this,t)||this}return e.test=function(t){var i=globalThis.OffscreenCanvas;return i&&t instanceof i?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement},e}(se),bf=function(r){it(e,r);function e(t,i){var n=this,s=i||{},a=s.width,o=s.height,h=s.autoLoad,u=s.linkBaseTexture;if(t&&t.length!==e.SIDES)throw new Error("Invalid length. Got "+t.length+", expected 6");n=r.call(this,6,{width:a,height:o})||this;for(var l=0;l<e.SIDES;l++)n.items[l].target=ge.TEXTURE_CUBE_MAP_POSITIVE_X+l;return n.linkBaseTexture=u!==!1,t&&n.initFromArray(t,i),h!==!1&&n.load(),n}return e.prototype.bind=function(t){r.prototype.bind.call(this,t),t.target=ge.TEXTURE_CUBE_MAP},e.prototype.addBaseTextureAt=function(t,i,n){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,i);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ge.TEXTURE_CUBE_MAP_POSITIVE_X+i,t.parentTextureArray=this.baseTexture,this.items[i]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[i]=t,this},e.prototype.upload=function(t,i,n){for(var s=this.itemDirtyIds,a=0;a<e.SIDES;a++){var o=this.items[a];(s[a]<o.dirtyId||n.dirtyId<i.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,n),s[a]=o.dirtyId):s[a]<-1&&(t.gl.texImage2D(o.target,0,n.internalFormat,i.realWidth,i.realHeight,0,i.format,n.type,null),s[a]=-1))}return!0},e.test=function(t){return Array.isArray(t)&&t.length===e.SIDES},e.SIDES=6,e}(Is),Os=function(r){it(e,r);function e(t,i){var n=this;if(i=i||{},!(t instanceof HTMLImageElement)){var s=new Image;se.crossOrigin(s,t,i.crossorigin),s.src=t,t=s}return n=r.call(this,t)||this,!t.complete&&n._width&&n._height&&(n._width=0,n._height=0),n.url=t.src,n._process=null,n.preserveBitmap=!1,n.createBitmap=(i.createBitmap!==void 0?i.createBitmap:F.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,n.alphaMode=typeof i.alphaMode=="number"?i.alphaMode:null,n.bitmap=null,n._load=null,i.autoLoad!==!1&&n.load(),n}return e.prototype.load=function(t){var i=this;return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise(function(n,s){var a=i.source;i.url=a.src;var o=function(){i.destroyed||(a.onload=null,a.onerror=null,i.resize(a.width,a.height),i._load=null,i.createBitmap?n(i.process()):n(i))};a.complete&&a.src?o():(a.onload=o,a.onerror=function(h){s(h),i.onError.emit(h)})}),this._load)},e.prototype.process=function(){var t=this,i=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);var n=globalThis.createImageBitmap,s=!i.crossOrigin||i.crossOrigin==="anonymous";return this._process=fetch(i.src,{mode:s?"cors":"no-cors"}).then(function(a){return a.blob()}).then(function(a){return n(a,0,0,i.width,i.height,{premultiplyAlpha:t.alphaMode===null||t.alphaMode===Nt.UNPACK?"premultiply":"none"})}).then(function(a){return t.destroyed?Promise.reject():(t.bitmap=a,t.update(),t._process=null,Promise.resolve(t))}),this._process},e.prototype.upload=function(t,i,n){if(typeof this.alphaMode=="number"&&(i.alphaMode=this.alphaMode),!this.createBitmap)return r.prototype.upload.call(this,t,i,n);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(r.prototype.upload.call(this,t,i,n,this.bitmap),!this.preserveBitmap){var s=!0,a=i._glTextures;for(var o in a){var h=a[o];if(h!==n&&h.dirtyId!==i.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},e.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,r.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},e.test=function(t){return typeof t=="string"||t instanceof HTMLImageElement},e}(se),Tf=function(r){it(e,r);function e(t,i){var n=this;return i=i||{},n=r.call(this,F.ADAPTER.createCanvas())||this,n._width=0,n._height=0,n.svg=t,n.scale=i.scale||1,n._overrideWidth=i.width,n._overrideHeight=i.height,n._resolve=null,n._crossorigin=i.crossorigin,n._load=null,i.autoLoad!==!1&&n.load(),n}return e.prototype.load=function(){var t=this;return this._load?this._load:(this._load=new Promise(function(i){if(t._resolve=function(){t.resize(t.source.width,t.source.height),i(t)},e.SVG_XML.test(t.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");t.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(t.svg)))}t._loadSvg()}),this._load)},e.prototype._loadSvg=function(){var t=this,i=new Image;se.crossOrigin(i,this.svg,this._crossorigin),i.src=this.svg,i.onerror=function(n){t._resolve&&(i.onerror=null,t.onError.emit(n))},i.onload=function(){if(t._resolve){var n=i.width,s=i.height;if(!n||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var a=n*t.scale,o=s*t.scale;(t._overrideWidth||t._overrideHeight)&&(a=t._overrideWidth||t._overrideHeight/s*n,o=t._overrideHeight||t._overrideWidth/n*s),a=Math.round(a),o=Math.round(o);var h=t.source;h.width=a,h.height=o,h._pixiId="canvas_"+xe(),h.getContext("2d").drawImage(i,0,0,n,s,0,0,a,o),t._resolve(),t._resolve=null}}},e.getSize=function(t){var i=e.SVG_SIZE.exec(t),n={};return i&&(n[i[1]]=Math.round(parseFloat(i[3])),n[i[5]]=Math.round(parseFloat(i[7]))),n},e.prototype.dispose=function(){r.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},e.test=function(t,i){return i==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&e.SVG_XML.test(t)},e.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,e.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(se),wf=function(r){it(e,r);function e(t,i){var n=this;if(i=i||{},!(t instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof t=="string"&&(t=[t]);var a=t[0].src||t[0];se.crossOrigin(s,a,i.crossorigin);for(var o=0;o<t.length;++o){var h=document.createElement("source"),u=t[o],l=u.src,f=u.mime;l=l||t[o];var c=l.split("?").shift().toLowerCase(),d=c.slice(c.lastIndexOf(".")+1);f=f||e.MIME_TYPES[d]||"video/"+d,h.src=l,h.type=f,s.appendChild(h)}t=s}return n=r.call(this,t)||this,n.noSubImage=!0,n._autoUpdate=!0,n._isConnectedToTicker=!1,n._updateFPS=i.updateFPS||0,n._msToNextUpdate=0,n.autoPlay=i.autoPlay!==!1,n._load=null,n._resolve=null,n._onCanPlay=n._onCanPlay.bind(n),n._onError=n._onError.bind(n),i.autoLoad!==!1&&n.load(),n}return e.prototype.update=function(t){if(!this.destroyed){var i=Tt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-i),(!this._updateFPS||this._msToNextUpdate<=0)&&(r.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},e.prototype.load=function(){var t=this;if(this._load)return this._load;var i=this.source;return(i.readyState===i.HAVE_ENOUGH_DATA||i.readyState===i.HAVE_FUTURE_DATA)&&i.width&&i.height&&(i.complete=!0),i.addEventListener("play",this._onPlayStart.bind(this)),i.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(i.addEventListener("canplay",this._onCanPlay),i.addEventListener("canplaythrough",this._onCanPlay),i.addEventListener("error",this._onError,!0)),this._load=new Promise(function(n){t.valid?n(t):(t._resolve=n,i.load())}),this._load},e.prototype._onError=function(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)},e.prototype._isSourcePlaying=function(){var t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()},e.prototype._isSourceReady=function(){var t=this.source;return t.readyState>2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Tt.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var i=this.valid;this.resize(t.videoWidth,t.videoHeight),!i&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),r.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Tt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,i){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(i)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(se),Ef=function(r){it(e,r);function e(t){return r.call(this,t)||this}return e.test=function(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&t instanceof ImageBitmap},e}(se);Fr.push(Os,Ef,xf,wf,Tf,ei,bf,yf);var Sf=function(r){it(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.upload=function(t,i,n){var s=t.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===Nt.UNPACK);var a=i.realWidth,o=i.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(i.target,0,0,0,a,o,i.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(i.target,0,n.internalFormat,a,o,0,i.format,n.type,this.data)),!0},e}(ei),Lr=function(){function r(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),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 Et("disposeFramebuffer"),this.multisample=ft.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(e,t){return e===void 0&&(e=0),this.colorTextures[e]=t||new V(null,{scaleMode:jt.NEAREST,resolution:1,mipmap:Ft.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(e){return this.depthTexture=e||new V(new Sf(null,{width:this.width,height:this.height}),{scaleMode:jt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ft.OFF,format:R.DEPTH_COMPONENT,type:L.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var n=this.colorTextures[i],s=n.resolution;n.setSize(e/s,t/s)}if(this.depthTexture){var s=this.depthTexture.resolution;this.depthTexture.setSize(e/s,t/s)}}},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},r}(),Ms=function(r){it(e,r);function e(t){t===void 0&&(t={});var i=this;if(typeof t=="number"){var n=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3];t={width:n,height:s,scaleMode:a,resolution:o}}return t.width=t.width||100,t.height=t.height||100,t.multisample=t.multisample!==void 0?t.multisample:ft.NONE,i=r.call(this,null,t)||this,i.mipmap=Ft.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new Lr(i.realWidth,i.realHeight).addColorTexture(0,i),i.framebuffer.multisample=t.multisample,i.maskStack=[],i.filterStack=[{}],i}return e.prototype.resize=function(t,i){this.framebuffer.resize(t*this.resolution,i*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},e.prototype.dispose=function(){this.framebuffer.dispose(),r.prototype.dispose.call(this)},e.prototype.destroy=function(){r.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},e}(V),Ds=function(){function r(){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)}return r.prototype.set=function(e,t,i){var n=t.width,s=t.height;if(i){var a=e.width/2/n,o=e.height/2/s,h=e.x/n+a,u=e.y/s+o;i=ht.add(i,ht.NW),this.x0=h+a*ht.uX(i),this.y0=u+o*ht.uY(i),i=ht.add(i,2),this.x1=h+a*ht.uX(i),this.y1=u+o*ht.uY(i),i=ht.add(i,2),this.x2=h+a*ht.uX(i),this.y2=u+o*ht.uY(i),i=ht.add(i,2),this.x3=h+a*ht.uX(i),this.y3=u+o*ht.uY(i)}else this.x0=e.x/n,this.y0=e.y/s,this.x1=(e.x+e.width)/n,this.y1=e.y/s,this.x2=(e.x+e.width)/n,this.y2=(e.y+e.height)/s,this.x3=e.x/n,this.y3=(e.y+e.height)/s;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},r.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)+"]"},r}(),Fs=new Ds;function Ni(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var k=function(r){it(e,r);function e(t,i,n,s,a,o){var h=r.call(this)||this;if(h.noFrame=!1,i||(h.noFrame=!0,i=new j(0,0,1,1)),t instanceof e&&(t=t.baseTexture),h.baseTexture=t,h._frame=i,h.trim=s,h.valid=!1,h._uvs=Fs,h.uvMatrix=null,h.orig=n||i,h._rotate=Number(a||0),a===!0)h._rotate=2;else if(h._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return h.defaultAnchor=o?new X(o.x,o.y):new X(0,0),h._updateID=0,h.textureCacheIds=[],t.valid?h.noFrame?t.valid&&h.onBaseTextureUpdated(t):h.frame=i:t.once("loaded",h.onBaseTextureUpdated,h),h.noFrame&&t.on("update",h.onBaseTextureUpdated,h),h}return e.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},e.prototype.onBaseTextureUpdated=function(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)},e.prototype.destroy=function(t){if(this.baseTexture){if(t){var i=this.baseTexture.resource;i&&i.url&&te[i.url]&&e.removeFromCache(i.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,e.removeFromCache(this),this.textureCacheIds=null},e.prototype.clone=function(){var t=this._frame.clone(),i=this._frame===this.orig?t:this.orig.clone(),n=new e(this.baseTexture,!this.noFrame&&t,i,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(n._frame=t),n},e.prototype.updateUvs=function(){this._uvs===Fs&&(this._uvs=new Ds),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},e.from=function(t,i,n){i===void 0&&(i={}),n===void 0&&(n=F.STRICT_TEXTURE_CACHE);var s=typeof t=="string",a=null;if(s)a=t;else if(t instanceof V){if(!t.cacheId){var o=i&&i.pixiIdPrefix||"pixiid";t.cacheId=o+"-"+xe(),V.addToCache(t,t.cacheId)}a=t.cacheId}else{if(!t._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";t._pixiId=o+"_"+xe()}a=t._pixiId}var h=te[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in TextureCache.');return!h&&!(t instanceof V)?(i.resolution||(i.resolution=Di(t)),h=new e(new V(t,i)),h.baseTexture.cacheId=a,V.addToCache(h.baseTexture,a),e.addToCache(h,a)):!h&&t instanceof V&&(h=new e(t),e.addToCache(h,a)),h},e.fromURL=function(t,i){var n=Object.assign({autoLoad:!1},i==null?void 0:i.resourceOptions),s=e.from(t,Object.assign({resourceOptions:n},i),!1),a=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):a.load().then(function(){return Promise.resolve(s)})},e.fromBuffer=function(t,i,n,s){return new e(V.fromBuffer(t,i,n,s))},e.fromLoader=function(t,i,n,s){var a=new V(t,Object.assign({scaleMode:F.SCALE_MODE,resolution:Di(i)},s)),o=a.resource;o instanceof Os&&(o.url=i);var h=new e(a);return n||(n=i),V.addToCache(h.baseTexture,n),e.addToCache(h,n),n!==i&&(V.addToCache(h.baseTexture,i),e.addToCache(h,i)),h.baseTexture.valid?Promise.resolve(h):new Promise(function(u){h.baseTexture.once("loaded",function(){return u(h)})})},e.addToCache=function(t,i){i&&(t.textureCacheIds.indexOf(i)===-1&&t.textureCacheIds.push(i),te[i]&&console.warn("Texture added to the cache with an id ["+i+"] that already had an entry"),te[i]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var i=te[t];if(i){var n=i.textureCacheIds.indexOf(t);return n>-1&&i.textureCacheIds.splice(n,1),delete te[t],i}}else if(t&&t.textureCacheIds){for(var s=0;s<t.textureCacheIds.length;++s)te[t.textureCacheIds[s]]===t&&delete te[t.textureCacheIds[s]];return t.textureCacheIds.length=0,t}return null},Object.defineProperty(e.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},set:function(t){this._frame=t,this.noFrame=!1;var i=t.x,n=t.y,s=t.width,a=t.height,o=i+s>this.baseTexture.width,h=n+a>this.baseTexture.height;if(o||h){var u=o&&h?"and":"or",l="X: "+i+" + "+s+" = "+(i+s)+" > "+this.baseTexture.width,f="Y: "+n+" + "+a+" = "+(n+a)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(l+" "+u+" "+f))}this.valid=s&&a&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new V),Ni(e._EMPTY),Ni(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=F.ADAPTER.createCanvas(16,16),i=t.getContext("2d");t.width=16,t.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),e._WHITE=new e(V.from(t)),Ni(e._WHITE),Ni(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(Ve),Te=function(r){it(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.valid=!0,n.filterFrame=null,n.filterPoolKey=null,n.updateUvs(),n}return Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,i,n){n===void 0&&(n=!0);var s=this.baseTexture.resolution,a=Math.round(t*s)/s,o=Math.round(i*s)/s;this.valid=a>0&&o>0,this._frame.width=this.orig.width=a,this._frame.height=this.orig.height=o,n&&this.baseTexture.resize(a,o),this.updateUvs()},e.prototype.setResolution=function(t){var i=this.baseTexture;i.resolution!==t&&(i.setResolution(t),this.resize(i.width,i.height,!1))},e.create=function(t){for(var i=arguments,n=[],s=1;s<arguments.length;s++)n[s-1]=i[s];return typeof t=="number"&&(Ut("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),t={width:t,height:n[0],scaleMode:n[1],resolution:n[2]}),new e(new Ms(t))},e}(k),Pf=function(){function r(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return r.prototype.createTexture=function(e,t,i){i===void 0&&(i=ft.NONE);var n=new Ms(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new Te(n)},r.prototype.getOptimalTexture=function(e,t,i,n){i===void 0&&(i=1),n===void 0&&(n=ft.NONE);var s;e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=Oi(e),t=Oi(t),s=((e&65535)<<16|t&65535)>>>0,n>1&&(s+=n*4294967296)):s=n>1?-n:-1,this.texturePool[s]||(this.texturePool[s]=[]);var a=this.texturePool[s].pop();return a||(a=this.createTexture(e,t,n)),a.filterPoolKey=s,a.setResolution(i),a},r.prototype.getFilterTexture=function(e,t,i){var n=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||ft.NONE);return n.filterFrame=e.filterFrame,n},r.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},r.prototype.returnFilterTexture=function(e){this.returnTexture(e)},r.prototype.clear=function(e){if(e=e!==!1,e)for(var t in this.texturePool){var i=this.texturePool[t];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0)}this.texturePool={}},r.prototype.setScreenSize=function(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(var t in this.texturePool)if(Number(t)<0){var i=this.texturePool[t];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}},r.SCREEN_KEY=-1,r}(),Ns=function(){function r(e,t,i,n,s,a,o){t===void 0&&(t=0),i===void 0&&(i=!1),n===void 0&&(n=L.FLOAT),this.buffer=e,this.size=t,this.normalized=i,this.type=n,this.stride=s,this.start=a,this.instance=o}return r.prototype.destroy=function(){this.buffer=null},r.from=function(e,t,i,n,s){return new r(e,t,i,n,s)},r}(),Rf=0,yt=function(){function r(e,t,i){t===void 0&&(t=!0),i===void 0&&(i=!1),this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=t,this.id=Rf++,this.disposeRunner=new Et("disposeBuffer")}return r.prototype.update=function(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(r.prototype,"index",{get:function(){return this.type===Yt.ELEMENT_ARRAY_BUFFER},set:function(e){this.type=e?Yt.ELEMENT_ARRAY_BUFFER:Yt.ARRAY_BUFFER},enumerable:!1,configurable:!0}),r.from=function(e){return e instanceof Array&&(e=new Float32Array(e)),new r(e)},r}(),Cf={Float32Array,Uint32Array,Int32Array,Uint8Array};function Af(r,e){for(var t=0,i=0,n={},s=0;s<r.length;s++)i+=e[s],t+=r[s].length;for(var a=new ArrayBuffer(t*4),o=null,h=0,s=0;s<r.length;s++){var u=e[s],l=r[s],f=bs(l);n[f]||(n[f]=new Cf[f](a)),o=n[f];for(var c=0;c<l.length;c++){var d=(c/u|0)*i+h,p=c%u;o[d+p]=l[c]}h+=u}return new Float32Array(a)}var Bs={5126:4,5123:2,5121:1},If=0,Of={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},ii=function(){function r(e,t){e===void 0&&(e=[]),t===void 0&&(t={}),this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=If++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Et("disposeGeometry"),this.refCount=0}return r.prototype.addAttribute=function(e,t,i,n,s,a,o,h){if(i===void 0&&(i=0),n===void 0&&(n=!1),h===void 0&&(h=!1),!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof yt||(t instanceof Array&&(t=new Float32Array(t)),t=new yt(t));var u=e.split("|");if(u.length>1){for(var l=0;l<u.length;l++)this.addAttribute(u[l],t,i,n,s);return this}var f=this.buffers.indexOf(t);return f===-1&&(this.buffers.push(t),f=this.buffers.length-1),this.attributes[e]=new Ns(f,i,n,s,a,o,h),this.instanced=this.instanced||h,this},r.prototype.getAttribute=function(e){return this.attributes[e]},r.prototype.getBuffer=function(e){return this.buffers[this.getAttribute(e).buffer]},r.prototype.addIndex=function(e){return e instanceof yt||(e instanceof Array&&(e=new Uint16Array(e)),e=new yt(e)),e.type=Yt.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.indexOf(e)===-1&&this.buffers.push(e),this},r.prototype.getIndex=function(){return this.indexBuffer},r.prototype.interleave=function(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;var e=[],t=[],i=new yt,n;for(n in this.attributes){var s=this.attributes[n],a=this.buffers[s.buffer];e.push(a.data),t.push(s.size*Bs[s.type]/4),s.buffer=0}for(i.data=Af(e,t),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},r.prototype.getSize=function(){for(var e in this.attributes){var t=this.attributes[e],i=this.buffers[t.buffer];return i.data.length/(t.stride/4||t.size)}return 0},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},r.prototype.clone=function(){for(var e=new r,t=0;t<this.buffers.length;t++)e.buffers[t]=new yt(this.buffers[t].data.slice(0));for(var t in this.attributes){var i=this.attributes[t];e.attributes[t]=new Ns(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=Yt.ELEMENT_ARRAY_BUFFER),e},r.merge=function(e){for(var t=new r,i=[],n=[],s=[],a,o=0;o<e.length;o++){a=e[o];for(var h=0;h<a.buffers.length;h++)n[h]=n[h]||0,n[h]+=a.buffers[h].data.length,s[h]=0}for(var o=0;o<a.buffers.length;o++)i[o]=new Of[bs(a.buffers[o].data)](n[o]),t.buffers[o]=new yt(i[o]);for(var o=0;o<e.length;o++){a=e[o];for(var h=0;h<a.buffers.length;h++)i[h].set(a.buffers[h].data,s[h]),s[h]+=a.buffers[h].data.length}if(t.attributes=a.attributes,a.indexBuffer){t.indexBuffer=t.buffers[a.buffers.indexOf(a.indexBuffer)],t.indexBuffer.type=Yt.ELEMENT_ARRAY_BUFFER;for(var u=0,l=0,f=0,c=0,o=0;o<a.buffers.length;o++)if(a.buffers[o]!==a.indexBuffer){c=o;break}for(var o in a.attributes){var d=a.attributes[o];(d.buffer|0)===c&&(l+=d.size*Bs[d.type]/4)}for(var o=0;o<e.length;o++){for(var p=e[o].indexBuffer.data,h=0;h<p.length;h++)t.indexBuffer.data[h+f]+=u;u+=e[o].buffers[c].data.length/l,f+=p.length}}return t},r}(),Mf=function(r){it(e,r);function e(){var t=r.call(this)||this;return t.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),t}return e}(ii),Ls=function(r){it(e,r);function e(){var t=r.call(this)||this;return t.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),t.uvs=new Float32Array([0,0,1,0,1,1,0,1]),t.vertexBuffer=new yt(t.vertices),t.uvBuffer=new yt(t.uvs),t.addAttribute("aVertexPosition",t.vertexBuffer).addAttribute("aTextureCoord",t.uvBuffer).addIndex([0,1,2,0,2,3]),t}return e.prototype.map=function(t,i){var n=0,s=0;return this.uvs[0]=n,this.uvs[1]=s,this.uvs[2]=n+i.width/t.width,this.uvs[3]=s,this.uvs[4]=n+i.width/t.width,this.uvs[5]=s+i.height/t.height,this.uvs[6]=n,this.uvs[7]=s+i.height/t.height,n=i.x,s=i.y,this.vertices[0]=n,this.vertices[1]=s,this.vertices[2]=n+i.width,this.vertices[3]=s,this.vertices[4]=n+i.width,this.vertices[5]=s+i.height,this.vertices[6]=n,this.vertices[7]=s+i.height,this.invalidate(),this},e.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},e}(ii),Df=0,we=function(){function r(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Df++,this.static=!!t,this.ubo=!!i,e instanceof yt?(this.buffer=e,this.buffer.type=Yt.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new yt(new Float32Array(1)),this.buffer.type=Yt.UNIFORM_BUFFER,this.autoManage=!0))}return r.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},r.prototype.add=function(e,t,i){if(!this.ubo)this.uniforms[e]=new r(t,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")},r.from=function(e,t,i){return new r(e,t,i)},r.uboFrom=function(e,t){return new r(e,t??!0,!0)},r}(),Ff=function(){function r(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ft.NONE,this.sourceFrame=new j,this.destinationFrame=new j,this.bindingSourceFrame=new j,this.bindingDestinationFrame=new j,this.filters=[],this.transform=null}return r.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},r}(),Bi=[new X,new X,new X,new X],Ur=new gt,Nf=function(){function r(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new Pf,this.texturePool.setScreenSize(e.view),this.statePool=[],this.quad=new Mf,this.quadUv=new Ls,this.tempRect=new j,this.activeState={},this.globalUniforms=new we({outputFrame:new j,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}return r.prototype.push=function(e,t){for(var i,n,s=this.renderer,a=this.defaultFilterStack,o=this.statePool.pop()||new Ff,h=this.renderer.renderTexture,u=t[0].resolution,l=t[0].multisample,f=t[0].padding,c=t[0].autoFit,d=(i=t[0].legacy)!==null&&i!==void 0?i:!0,p=1;p<t.length;p++){var v=t[p];u=Math.min(u,v.resolution),l=Math.min(l,v.multisample),f=this.useMaxPadding?Math.max(f,v.padding):f+v.padding,c=c&&v.autoFit,d=d||((n=v.legacy)!==null&&n!==void 0?n:!0)}a.length===1&&(this.defaultFilterStack[0].renderTexture=h.current),a.push(o),o.resolution=u,o.multisample=l,o.legacy=d,o.target=e,o.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),o.sourceFrame.pad(f);var _=this.tempRect.copyFrom(h.sourceFrame);s.projection.transform&&this.transformAABB(Ur.copyFrom(s.projection.transform).invert(),_),c?(o.sourceFrame.fit(_),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(_)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,h.current?h.current.resolution:s.resolution,h.sourceFrame,h.destinationFrame,s.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,u,l),o.filters=t,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;var 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(h.sourceFrame),o.bindingDestinationFrame.copyFrom(h.destinationFrame),o.transform=s.projection.transform,s.projection.transform=null,h.bind(o.renderTexture,o.sourceFrame,m),s.framebuffer.clear(0,0,0,0)},r.prototype.pop=function(){var e=this.defaultFilterStack,t=e.pop(),i=t.filters;this.activeState=t;var n=this.globalUniforms.uniforms;n.outputFrame=t.sourceFrame,n.resolution=t.resolution;var s=n.inputSize,a=n.inputPixel,o=n.inputClamp;if(s[0]=t.destinationFrame.width,s[1]=t.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],a[0]=Math.round(s[0]*t.resolution),a[1]=Math.round(s[1]*t.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=t.sourceFrame.width*s[2]-.5*a[2],o[3]=t.sourceFrame.height*s[3]-.5*a[3],t.legacy){var h=n.filterArea;h[0]=t.destinationFrame.width,h[1]=t.destinationFrame.height,h[2]=t.sourceFrame.x,h[3]=t.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();var u=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,t.renderTexture,u.renderTexture,Bt.BLEND,t),this.returnFilterTexture(t.renderTexture);else{var l=t.renderTexture,f=this.getOptimalFilterTexture(l.width,l.height,t.resolution);f.filterFrame=l.filterFrame;var c=0;for(c=0;c<i.length-1;++c){c===1&&t.multisample>1&&(f=this.getOptimalFilterTexture(l.width,l.height,t.resolution),f.filterFrame=l.filterFrame),i[c].apply(this,l,f,Bt.CLEAR,t);var d=l;l=f,f=d}i[c].apply(this,l,u.renderTexture,Bt.BLEND,t),c>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(f)}t.clear(),this.statePool.push(t)},r.prototype.bindAndClear=function(e,t){t===void 0&&(t=Bt.CLEAR);var i=this.renderer,n=i.renderTexture,s=i.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var a=this.tempRect;a.x=0,a.y=0,a.width=e.filterFrame.width,a.height=e.filterFrame.height,n.bind(e,e.filterFrame,a)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var o=s.stateId&1||this.forceClear;(t===Bt.CLEAR||t===Bt.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(e,t,i,n){var s=this.renderer;s.state.set(e.state),this.bindAndClear(i,n),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(Dt.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(Dt.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(e,t){var i=this.activeState,n=i.sourceFrame,s=i.destinationFrame,a=t._texture.orig,o=e.set(s.width,0,0,s.height,n.x,n.y),h=t.worldTransform.copyTo(gt.TEMP_MATRIX);return h.invert(),o.prepend(h),o.scale(1/a.width,1/a.height),o.translate(t.anchor.x,t.anchor.y),o},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(e,t,i,n){return i===void 0&&(i=1),n===void 0&&(n=ft.NONE),this.texturePool.getOptimalTexture(e,t,i,n)},r.prototype.getFilterTexture=function(e,t,i){if(typeof e=="number"){var n=e;e=t,t=n}e=e||this.activeState.renderTexture;var s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||ft.NONE);return s.filterFrame=e.filterFrame,s},r.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(e,t){var i=Bi[0],n=Bi[1],s=Bi[2],a=Bi[3];i.set(t.left,t.top),n.set(t.left,t.bottom),s.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(i,i),e.apply(n,n),e.apply(s,s),e.apply(a,a);var o=Math.min(i.x,n.x,s.x,a.x),h=Math.min(i.y,n.y,s.y,a.y),u=Math.max(i.x,n.x,s.x,a.x),l=Math.max(i.y,n.y,s.y,a.y);t.x=o,t.y=h,t.width=u-o,t.height=l-h},r.prototype.roundFrame=function(e,t,i,n,s){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(s){var a=s.a,o=s.b,h=s.c,u=s.d;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(u)>1e-4))return}s=s?Ur.copyFrom(s):Ur.identity(),s.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.transformAABB(s,e),e.ceil(t),this.transformAABB(s.invert(),e)}},r}(),Li=function(){function r(e){this.renderer=e}return r.prototype.flush=function(){},r.prototype.destroy=function(){this.renderer=null},r.prototype.start=function(){},r.prototype.stop=function(){this.flush()},r.prototype.render=function(e){},r}(),Bf=function(){function r(e){this.renderer=e,this.emptyRenderer=new Li(e),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(e,t){for(var i=this.renderer.texture.boundTextures,n=t-1;n>=0;--n)e[n]=i[n]||null,e[n]&&(e[n]._batchLocation=n)},r.prototype.boundArray=function(e,t,i,n){for(var s=e.elements,a=e.ids,o=e.count,h=0,u=0;u<o;u++){var l=s[u],f=l._batchLocation;if(f>=0&&f<n&&t[f]===l){a[u]=f;continue}for(;h<n;){var c=t[h];if(c&&c._batchEnabled===i&&c._batchLocation===h){h++;continue}a[u]=h,l._batchLocation=h,t[h]=l;break}}},r.prototype.destroy=function(){this.renderer=null},r}(),Us=0,Lf=function(){function r(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),e.view.addEventListener("webglcontextlost",this.handleContextLost,!1),e.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(r.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),r.prototype.contextChange=function(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=Us++,e.isContextLost()&&e.getExtension("WEBGL_lose_context")&&e.getExtension("WEBGL_lose_context").restoreContext()},r.prototype.initFromContext=function(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=Us++,this.renderer.runners.contextChange.emit(e)},r.prototype.initFromOptions=function(e){var t=this.createContext(this.renderer.view,e);this.initFromContext(t)},r.prototype.createContext=function(e,t){var i;if(F.PREFER_ENV>=Qt.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var e=this.gl,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(e){e.preventDefault()},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(e){var t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var n=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),Uf=function(){function r(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ft.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),Gf=new j,kf=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Lr(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new j,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),this.renderer.context.webGLVersion===1){var t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;F.PREFER_ENV===Qt.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=function(n){return t.drawBuffersWEBGL(n)}:(this.hasMRT=!1,e.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},r.prototype.bind=function(e,t,i){i===void 0&&(i=0);var n=this.gl;if(e){var s=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,s.mipLevel=i),s.dirtyId!==e.dirtyId&&(s.dirtyId=e.dirtyId,s.dirtyFormat!==e.dirtyFormat?(s.dirtyFormat=e.dirtyFormat,s.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):s.dirtySize!==e.dirtySize&&(s.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var a=0;a<e.colorTextures.length;a++){var o=e.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){var h=t.width>>i,u=t.height>>i,l=h/t.width;this.setViewport(t.x*l,t.y*l,h,u)}else{var h=e.width>>i,u=e.height>>i;this.setViewport(0,0,h,u)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(e,t,i,n){var s=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),n=Math.round(n),(s.width!==i||s.height!==n||s.x!==e||s.y!==t)&&(s.x=e,s.y=t,s.width=i,s.height=n,this.gl.viewport(e,t,i,n))},Object.defineProperty(r.prototype,"size",{get:function(){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}},enumerable:!1,configurable:!0}),r.prototype.clear=function(e,t,i,n,s){s===void 0&&(s=bi.COLOR|bi.DEPTH);var a=this.gl;a.clearColor(e,t,i,n),a.clear(s)},r.prototype.initFramebuffer=function(e){var t=this.gl,i=new Uf(t.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i},r.prototype.resizeFramebuffer=function(e){var t=this.gl,i=e.glFramebuffers[this.CONTEXT_UID];i.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,t.RGBA8,e.width,e.height)),i.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,i.stencil),i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var n=e.colorTextures,s=n.length;t.drawBuffers||(s=Math.min(s,1));for(var a=0;a<s;a++){var o=n[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0)}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)},r.prototype.updateFramebuffer=function(e,t){var i=this.gl,n=e.glFramebuffers[this.CONTEXT_UID],s=e.colorTextures,a=s.length;i.drawBuffers||(a=Math.min(a,1)),n.multisample>1&&this.canMultisampleFramebuffer(e)?(n.msaaBuffer=n.msaaBuffer||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,n.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,i.RGBA8,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,n.msaaBuffer)):n.msaaBuffer&&(i.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));for(var o=[],h=0;h<a;h++){var u=s[h],l=u.parentTextureArray||u;this.renderer.texture.bind(l,0),!(h===0&&n.msaaBuffer)&&(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,u.target,l._glTextures[this.CONTEXT_UID].texture,t),o.push(i.COLOR_ATTACHMENT0+h))}if(o.length>1&&i.drawBuffers(o),e.depthTexture){var f=this.writeDepthTexture;if(f){var c=e.depthTexture;this.renderer.texture.bind(c,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,t)}}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(n.stencil=n.stencil||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,n.stencil),n.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,i.DEPTH24_STENCIL8,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,n.stencil)):n.stencil&&(i.deleteRenderbuffer(n.stencil),n.stencil=null)},r.prototype.canMultisampleFramebuffer=function(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture},r.prototype.detectSamples=function(e){var t=this.msaaSamples,i=ft.NONE;if(e<=1||t===null)return i;for(var n=0;n<t.length;n++)if(t[n]<=e){i=t[n];break}return i===1&&(i=ft.NONE),i},r.prototype.blit=function(e,t,i){var n=this,s=n.current,a=n.renderer,o=n.gl,h=n.CONTEXT_UID;if(a.context.webGLVersion===2&&s){var u=s.glFramebuffers[h];if(u){if(!e){if(!u.msaaBuffer)return;var l=s.colorTextures[0];if(!l)return;u.blitFramebuffer||(u.blitFramebuffer=new Lr(s.width,s.height),u.blitFramebuffer.addColorTexture(0,l)),e=u.blitFramebuffer,e.colorTextures[0]!==l&&(e.colorTextures[0]=l,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}t||(t=Gf,t.width=s.width,t.height=s.height),i||(i=t);var f=t.width===i.width&&t.height===i.height;this.bind(e),o.bindFramebuffer(o.READ_FRAMEBUFFER,u.framebuffer),o.blitFramebuffer(t.left,t.top,t.right,t.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,f?o.NEAREST:o.LINEAR)}}},r.prototype.disposeFramebuffer=function(e,t){var i=e.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(i){delete e.glFramebuffers[this.CONTEXT_UID];var s=this.managedFramebuffers.indexOf(e);s>=0&&this.managedFramebuffers.splice(s,1),e.disposeRunner.remove(this),t||(n.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&n.deleteRenderbuffer(i.msaaBuffer),i.stencil&&n.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&i.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<t.length;i++)this.disposeFramebuffer(t[i],e)},r.prototype.forceStencil=function(){var e=this.current;if(e){var t=e.glFramebuffers[this.CONTEXT_UID];if(!(!t||t.stencil)){e.stencil=!0;var i=e.width,n=e.height,s=this.gl,a=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,a),t.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,t.multisample,s.DEPTH24_STENCIL8,i,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,i,n),t.stencil=a,s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)}}},r.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new j},r.prototype.destroy=function(){this.renderer=null},r}(),Gr={5126:4,5123:2,5121:1},Hf=function(){function r(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return r.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){var i=this.renderer.context.extensions.vertexArrayObject;F.PREFER_ENV===Qt.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=function(){return i.createVertexArrayOES()},e.bindVertexArray=function(s){return i.bindVertexArrayOES(s)},e.deleteVertexArray=function(s){return i.deleteVertexArrayOES(s)}):(this.hasVao=!1,e.createVertexArray=function(){return null},e.bindVertexArray=function(){return null},e.deleteVertexArray=function(){return null})}if(t.webGLVersion!==2){var n=e.getExtension("ANGLE_instanced_arrays");n?(e.vertexAttribDivisor=function(s,a){return n.vertexAttribDivisorANGLE(s,a)},e.drawElementsInstanced=function(s,a,o,h,u){return n.drawElementsInstancedANGLE(s,a,o,h,u)},e.drawArraysInstanced=function(s,a,o,h){return n.drawArraysInstancedANGLE(s,a,o,h)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex},r.prototype.bind=function(e,t){t=t||this.renderer.shader.shader;var i=this.gl,n=e.glVertexArrayObjects[this.CONTEXT_UID],s=!1;n||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=n={},s=!0);var a=n[t.program.id]||this.initGeometryVao(e,t,s);this._activeGeometry=e,this._activeVao!==a&&(this._activeVao=a,this.hasVao?i.bindVertexArray(a):this.activateVao(e,t.program)),this.updateBuffers()},r.prototype.reset=function(){this.unbind()},r.prototype.updateBuffers=function(){for(var e=this._activeGeometry,t=this.renderer.buffer,i=0;i<e.buffers.length;i++){var n=e.buffers[i];t.update(n)}},r.prototype.checkCompatibility=function(e,t){var i=e.attributes,n=t.attributeData;for(var s in n)if(!i[s])throw new Error('shader and geometry incompatible, geometry missing the "'+s+'" attribute')},r.prototype.getSignature=function(e,t){var i=e.attributes,n=t.attributeData,s=["g",e.id];for(var a in i)n[a]&&s.push(a,n[a].location);return s.join("-")},r.prototype.initGeometryVao=function(e,t,i){i===void 0&&(i=!0);var n=this.gl,s=this.CONTEXT_UID,a=this.renderer.buffer,o=t.program;o.glPrograms[s]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,o);var h=this.getSignature(e,o),u=e.glVertexArrayObjects[this.CONTEXT_UID],l=u[h];if(l)return u[o.id]=l,l;var f=e.buffers,c=e.attributes,d={},p={};for(var v in f)d[v]=0,p[v]=0;for(var v in c)!c[v].size&&o.attributeData[v]?c[v].size=o.attributeData[v].size:c[v].size||console.warn("PIXI Geometry attribute '"+v+"' size cannot be determined (likely the bound shader does not have the attribute)"),d[c[v].buffer]+=c[v].size*Gr[c[v].type];for(var v in c){var _=c[v],m=_.size;_.stride===void 0&&(d[_.buffer]===m*Gr[_.type]?_.stride=0:_.stride=d[_.buffer]),_.start===void 0&&(_.start=p[_.buffer],p[_.buffer]+=m*Gr[_.type])}l=n.createVertexArray(),n.bindVertexArray(l);for(var g=0;g<f.length;g++){var y=f[g];a.bind(y),i&&y._glBuffers[s].refCount++}return this.activateVao(e,o),this._activeVao=l,u[o.id]=l,u[h]=l,l},r.prototype.disposeGeometry=function(e,t){var i;if(this.managedGeometries[e.id]){delete this.managedGeometries[e.id];var n=e.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,a=e.buffers,o=(i=this.renderer)===null||i===void 0?void 0:i.buffer;if(e.disposeRunner.remove(this),!!n){if(o)for(var h=0;h<a.length;h++){var u=a[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!t&&o.dispose(a[h],t))}if(!t){for(var l in n)if(l[0]==="g"){var f=n[l];this._activeVao===f&&this.unbind(),s.deleteVertexArray(f)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}},r.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedGeometries),i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)},r.prototype.activateVao=function(e,t){var i=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,a=e.buffers,o=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);var h=null;for(var u in o){var l=o[u],f=a[l.buffer],c=f._glBuffers[n];if(t.attributeData[u]){h!==c&&(s.bind(f),h=c);var d=t.attributeData[u].location;if(i.enableVertexAttribArray(d),i.vertexAttribPointer(d,l.size,l.type||i.FLOAT,l.normalized,l.stride,l.start),l.instance)if(this.hasInstance)i.vertexAttribDivisor(d,1);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}},r.prototype.draw=function(e,t,i,n){var s=this.gl,a=this._activeGeometry;if(a.indexBuffer){var o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?s.drawElementsInstanced(e,t||a.indexBuffer.data.length,h,(i||0)*o,n||1):s.drawElements(e,t||a.indexBuffer.data.length,h,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?s.drawArraysInstanced(e,i,t||a.getSize(),n||1):s.drawArrays(e,i,t||a.getSize());return this},r.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},r.prototype.destroy=function(){this.renderer=null},r}(),Xf=function(){function r(e){e===void 0&&(e=null),this.type=mt.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=F.FILTER_MULTISAMPLE,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}return Object.defineProperty(r.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null},enumerable:!1,configurable:!0}),r.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=mt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},r.prototype.copyCountersOrReset=function(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},r}();function Gs(r,e,t){var i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}function ks(r,e){var t=r.getShaderSource(e).split(`
11
11
  `).map(function(u,l){return l+": "+u}),i=r.getShaderInfoLog(e),n=i.split(`
12
12
  `),s={},a=n.map(function(u){return parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(u){return u&&!s[u]?(s[u]=!0,!0):!1}),o=[""];a.forEach(function(u){t[u-1]="%c"+t[u-1]+"%c",o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var h=t.join(`
13
- `);o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,o),console.groupEnd()}function kf(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||Gs(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||Gs(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}function Lr(r){for(var e=new Array(r),t=0;t<e.length;t++)e[t]=!1;return e}function ks(r,e){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Lr(2*e);case"bvec3":return Lr(3*e);case"bvec4":return Lr(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Hs={},ei=Hs;function Hf(){if(ei===Hs||ei&&ei.isContextLost()){var r=F.ADAPTER.createCanvas(),e=void 0;F.PREFER_ENV>=Zt.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),ei=e}return ei}var Bi;function Xf(){if(!Bi){Bi=At.MEDIUM;var r=Hf();if(r&&r.getShaderPrecisionFormat){var e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);Bi=e.precision?At.HIGH:At.MEDIUM}}return Bi}function Xs(r,e,t){if(r.substring(0,9)!=="precision"){var i=e;return e===At.HIGH&&t!==At.HIGH&&(i=At.MEDIUM),"precision "+i+` float;
14
- `+r}else if(t!==At.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var Wf={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Ws(r){return Wf[r]}var Li=null,zs={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function js(r,e){if(!Li){var t=Object.keys(zs);Li={};for(var i=0;i<t.length;++i){var n=t[i];Li[r[n]]=zs[n]}}return Li[e]}var Le=[{test:function(r){return r.type==="float"&&r.size===1&&!r.isArray},code:function(r){return`
13
+ `);o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,o),console.groupEnd()}function Wf(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||ks(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||ks(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}function kr(r){for(var e=new Array(r),t=0;t<e.length;t++)e[t]=!1;return e}function Hs(r,e){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return kr(2*e);case"bvec3":return kr(3*e);case"bvec4":return kr(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Xs={},ri=Xs;function jf(){if(ri===Xs||ri&&ri.isContextLost()){var r=F.ADAPTER.createCanvas(),e=void 0;F.PREFER_ENV>=Qt.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),ri=e}return ri}var Ui;function zf(){if(!Ui){Ui=It.MEDIUM;var r=jf();if(r&&r.getShaderPrecisionFormat){var e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);Ui=e.precision?It.HIGH:It.MEDIUM}}return Ui}function Ws(r,e,t){if(r.substring(0,9)!=="precision"){var i=e;return e===It.HIGH&&t!==It.HIGH&&(i=It.MEDIUM),"precision "+i+` float;
14
+ `+r}else if(t!==It.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var Yf={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function js(r){return Yf[r]}var Gi=null,zs={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Ys(r,e){if(!Gi){var t=Object.keys(zs);Gi={};for(var i=0;i<t.length;++i){var n=t[i];Gi[r[n]]=zs[n]}}return Gi[e]}var Ge=[{test:function(r){return r.type==="float"&&r.size===1&&!r.isArray},code:function(r){return`
15
15
  if(uv["`+r+'"] !== ud["'+r+`"].value)
16
16
  {
17
17
  ud["`+r+'"].value = uv["'+r+`"]
@@ -96,7 +96,7 @@ Deprecated since v`+r),console.warn(i))),ws[e]=!0}}var Es={},Qt=Object.create(nu
96
96
  cv[3] = v[3];
97
97
 
98
98
  gl.uniform4f(ud["`+r+`"].location, v[0], v[1], v[2], v[3])
99
- }`}}],zf={float:`
99
+ }`}}],Vf={float:`
100
100
  if (cv !== v)
101
101
  {
102
102
  cu.value = v;
@@ -232,7 +232,7 @@ Deprecated since v`+r),console.warn(i))),ws[e]=!0}}var Es={},Qt=Object.create(nu
232
232
  cu.value = v;
233
233
 
234
234
  gl.uniform1i(location, v);
235
- }`},jf={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Yf(r,e){var t,i=[`
235
+ }`},qf={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function $f(r,e){var t,i=[`
236
236
  var v = null;
237
237
  var cv = null;
238
238
  var cu = null;
@@ -242,20 +242,20 @@ Deprecated since v`+r),console.warn(i))),ws[e]=!0}}var Es={},Qt=Object.create(nu
242
242
  renderer.shader.syncUniformBufferGroup(uv.`+n+", '"+n+`');
243
243
  `):i.push(`
244
244
  renderer.shader.syncUniformGroup(uv.`+n+`, syncData);
245
- `));continue}for(var a=r.uniforms[n],o=!1,h=0;h<Le.length;h++)if(Le[h].test(s,a)){i.push(Le[h].code(n,a)),o=!0;break}if(!o){var u=s.size===1&&!s.isArray?zf:jf,l=u[s.type].replace("location",'ud["'+n+'"].location');i.push(`
245
+ `));continue}for(var a=r.uniforms[n],o=!1,h=0;h<Ge.length;h++)if(Ge[h].test(s,a)){i.push(Ge[h].code(n,a)),o=!0;break}if(!o){var u=s.size===1&&!s.isArray?Vf:qf,l=u[s.type].replace("location",'ud["'+n+'"].location');i.push(`
246
246
  cu = ud["`+n+`"];
247
247
  cv = cu.value;
248
248
  v = uv["`+n+`"];
249
249
  `+l+";")}}return new Function("ud","uv","renderer","syncData",i.join(`
250
- `))}var Vf=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
251
- `);function qf(r){for(var e="",t=0;t<r;++t)t>0&&(e+=`
252
- else `),t<r-1&&(e+="if(test == "+t+".0){}");return e}function $f(r,e){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var t=e.createShader(e.FRAGMENT_SHADER);;){var i=Vf.replace(/%forloop%/gi,qf(r));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))r=r/2|0;else break}return r}var ii;function Zf(){if(typeof ii=="boolean")return ii;try{var r=new Function("param1","param2","param3","return param1[param2] === param3;");ii=r({a:"b"},"a","b")===!0}catch{ii=!1}return ii}var Kf=`varying vec2 vTextureCoord;
250
+ `))}var Zf=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
251
+ `);function Kf(r){for(var e="",t=0;t<r;++t)t>0&&(e+=`
252
+ else `),t<r-1&&(e+="if(test == "+t+".0){}");return e}function Qf(r,e){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var t=e.createShader(e.FRAGMENT_SHADER);;){var i=Zf.replace(/%forloop%/gi,Kf(r));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))r=r/2|0;else break}return r}var ni;function Jf(){if(typeof ni=="boolean")return ni;try{var r=new Function("param1","param2","param3","return param1[param2] === param3;");ni=r({a:"b"},"a","b")===!0}catch{ni=!1}return ni}var tc=`varying vec2 vTextureCoord;
253
253
 
254
254
  uniform sampler2D uSampler;
255
255
 
256
256
  void main(void){
257
257
  gl_FragColor *= texture2D(uSampler, vTextureCoord);
258
- }`,Qf=`attribute vec2 aVertexPosition;
258
+ }`,ec=`attribute vec2 aVertexPosition;
259
259
  attribute vec2 aTextureCoord;
260
260
 
261
261
  uniform mat3 projectionMatrix;
@@ -266,16 +266,16 @@ void main(void){
266
266
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
267
267
  vTextureCoord = aTextureCoord;
268
268
  }
269
- `,Jf=0,Ui={},ri=function(){function r(e,t,i){i===void 0&&(i="pixi-shader"),this.id=Jf++,this.vertexSrc=e||r.defaultVertexSrc,this.fragmentSrc=t||r.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),Ui[i]?(Ui[i]++,i+="-"+Ui[i]):Ui[i]=1,this.vertexSrc="#define SHADER_NAME "+i+`
269
+ `,ic=0,ki={},si=function(){function r(e,t,i){i===void 0&&(i="pixi-shader"),this.id=ic++,this.vertexSrc=e||r.defaultVertexSrc,this.fragmentSrc=t||r.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),ki[i]?(ki[i]++,i+="-"+ki[i]):ki[i]=1,this.vertexSrc="#define SHADER_NAME "+i+`
270
270
  `+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+i+`
271
- `+this.fragmentSrc,this.vertexSrc=Xs(this.vertexSrc,F.PRECISION_VERTEX,At.HIGH),this.fragmentSrc=Xs(this.fragmentSrc,F.PRECISION_FRAGMENT,Xf())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(r,"defaultVertexSrc",{get:function(){return Qf},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentSrc",{get:function(){return Kf},enumerable:!1,configurable:!0}),r.from=function(e,t,i){var n=e+t,s=Es[n];return s||(Es[n]=s=new r(e,t,i)),s},r}(),se=function(){function r(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof be?this.uniformGroup=t:this.uniformGroup=new be(t):this.uniformGroup=new be({}),this.disposeRunner=new wt("disposeShader")}return r.prototype.checkUniformExists=function(e,t){if(t.uniforms[e])return!0;for(var i in t.uniforms){var n=t.uniforms[i];if(n.group&&this.checkUniformExists(e,n))return!0}return!1},r.prototype.destroy=function(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()},Object.defineProperty(r.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),r.from=function(e,t,i){var n=ri.from(e,t);return new r(n,i)},r}(),Ur=0,Gr=1,kr=2,Hr=3,Xr=4,Wr=5,Te=function(){function r(){this.data=0,this.blendMode=U.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(r.prototype,"blend",{get:function(){return!!(this.data&1<<Ur)},set:function(e){!!(this.data&1<<Ur)!==e&&(this.data^=1<<Ur)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"offsets",{get:function(){return!!(this.data&1<<Gr)},set:function(e){!!(this.data&1<<Gr)!==e&&(this.data^=1<<Gr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return!!(this.data&1<<kr)},set:function(e){!!(this.data&1<<kr)!==e&&(this.data^=1<<kr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return!!(this.data&1<<Hr)},set:function(e){!!(this.data&1<<Hr)!==e&&(this.data^=1<<Hr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return!!(this.data&1<<Wr)},set:function(e){!!(this.data&1<<Wr)!==e&&(this.data^=1<<Wr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"clockwiseFrontFace",{get:function(){return!!(this.data&1<<Xr)},set:function(e){!!(this.data&1<<Xr)!==e&&(this.data^=1<<Xr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this._blendMode},set:function(e){this.blend=e!==U.NONE,this._blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(e){this.offsets=!!e,this._polygonOffset=e},enumerable:!1,configurable:!0}),r.prototype.toString=function(){return"[@pixi/core:State "+("blendMode="+this.blendMode+" ")+("clockwiseFrontFace="+this.clockwiseFrontFace+" ")+("culling="+this.culling+" ")+("depthMask="+this.depthMask+" ")+("polygonOffset="+this.polygonOffset)+"]"},r.for2d=function(){var e=new r;return e.depthTest=!1,e.blend=!0,e},r}(),tc=`varying vec2 vTextureCoord;
271
+ `+this.fragmentSrc,this.vertexSrc=Ws(this.vertexSrc,F.PRECISION_VERTEX,It.HIGH),this.fragmentSrc=Ws(this.fragmentSrc,F.PRECISION_FRAGMENT,zf())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(r,"defaultVertexSrc",{get:function(){return ec},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentSrc",{get:function(){return tc},enumerable:!1,configurable:!0}),r.from=function(e,t,i){var n=e+t,s=Ss[n];return s||(Ss[n]=s=new r(e,t,i)),s},r}(),ae=function(){function r(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof we?this.uniformGroup=t:this.uniformGroup=new we(t):this.uniformGroup=new we({}),this.disposeRunner=new Et("disposeShader")}return r.prototype.checkUniformExists=function(e,t){if(t.uniforms[e])return!0;for(var i in t.uniforms){var n=t.uniforms[i];if(n.group&&this.checkUniformExists(e,n))return!0}return!1},r.prototype.destroy=function(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()},Object.defineProperty(r.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),r.from=function(e,t,i){var n=si.from(e,t);return new r(n,i)},r}(),Hr=0,Xr=1,Wr=2,jr=3,zr=4,Yr=5,Ee=function(){function r(){this.data=0,this.blendMode=G.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(r.prototype,"blend",{get:function(){return!!(this.data&1<<Hr)},set:function(e){!!(this.data&1<<Hr)!==e&&(this.data^=1<<Hr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"offsets",{get:function(){return!!(this.data&1<<Xr)},set:function(e){!!(this.data&1<<Xr)!==e&&(this.data^=1<<Xr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return!!(this.data&1<<Wr)},set:function(e){!!(this.data&1<<Wr)!==e&&(this.data^=1<<Wr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return!!(this.data&1<<jr)},set:function(e){!!(this.data&1<<jr)!==e&&(this.data^=1<<jr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return!!(this.data&1<<Yr)},set:function(e){!!(this.data&1<<Yr)!==e&&(this.data^=1<<Yr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"clockwiseFrontFace",{get:function(){return!!(this.data&1<<zr)},set:function(e){!!(this.data&1<<zr)!==e&&(this.data^=1<<zr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this._blendMode},set:function(e){this.blend=e!==G.NONE,this._blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(e){this.offsets=!!e,this._polygonOffset=e},enumerable:!1,configurable:!0}),r.prototype.toString=function(){return"[@pixi/core:State "+("blendMode="+this.blendMode+" ")+("clockwiseFrontFace="+this.clockwiseFrontFace+" ")+("culling="+this.culling+" ")+("depthMask="+this.depthMask+" ")+("polygonOffset="+this.polygonOffset)+"]"},r.for2d=function(){var e=new r;return e.depthTest=!1,e.blend=!0,e},r}(),rc=`varying vec2 vTextureCoord;
272
272
 
273
273
  uniform sampler2D uSampler;
274
274
 
275
275
  void main(void){
276
276
  gl_FragColor = texture2D(uSampler, vTextureCoord);
277
277
  }
278
- `,ec=`attribute vec2 aVertexPosition;
278
+ `,nc=`attribute vec2 aVertexPosition;
279
279
 
280
280
  uniform mat3 projectionMatrix;
281
281
 
@@ -301,7 +301,7 @@ void main(void)
301
301
  gl_Position = filterVertexPosition();
302
302
  vTextureCoord = filterTextureCoord();
303
303
  }
304
- `,ae=function(r){rt(e,r);function e(t,i,n){var s=this,a=ri.from(t||e.defaultVertexSrc,i||e.defaultFragmentSrc);return s=r.call(this,a,n)||this,s.padding=0,s.resolution=F.FILTER_RESOLUTION,s.multisample=F.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new Te,s}return e.prototype.apply=function(t,i,n,s,a){t.applyFilter(this,i,n,s)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultVertexSrc",{get:function(){return ec},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return tc},enumerable:!1,configurable:!0}),e}(se),ic=`attribute vec2 aVertexPosition;
304
+ `,oe=function(r){it(e,r);function e(t,i,n){var s=this,a=si.from(t||e.defaultVertexSrc,i||e.defaultFragmentSrc);return s=r.call(this,a,n)||this,s.padding=0,s.resolution=F.FILTER_RESOLUTION,s.multisample=F.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new Ee,s}return e.prototype.apply=function(t,i,n,s,a){t.applyFilter(this,i,n,s)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultVertexSrc",{get:function(){return nc},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return rc},enumerable:!1,configurable:!0}),e}(ae),sc=`attribute vec2 aVertexPosition;
305
305
  attribute vec2 aTextureCoord;
306
306
 
307
307
  uniform mat3 projectionMatrix;
@@ -317,7 +317,7 @@ void main(void)
317
317
  vTextureCoord = aTextureCoord;
318
318
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
319
319
  }
320
- `,rc=`varying vec2 vMaskCoord;
320
+ `,ac=`varying vec2 vMaskCoord;
321
321
  varying vec2 vTextureCoord;
322
322
 
323
323
  uniform sampler2D uSampler;
@@ -342,7 +342,7 @@ void main(void)
342
342
 
343
343
  gl_FragColor = original;
344
344
  }
345
- `,Ys=new gt,zr=function(){function r(e,t){this._texture=e,this.mapCoord=new gt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}return Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture=e,this._textureID=-1},enumerable:!1,configurable:!0}),r.prototype.multiplyUvs=function(e,t){t===void 0&&(t=e);for(var i=this.mapCoord,n=0;n<e.length;n+=2){var s=e[n],a=e[n+1];t[n]=s*i.a+a*i.c+i.tx,t[n+1]=s*i.b+a*i.d+i.ty}return t},r.prototype.update=function(e){var t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;var i=t._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);var n=t.orig,s=t.trim;s&&(Ys.set(n.width/s.width,0,0,n.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Ys));var a=t.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,u=this.clampOffset;return o[0]=(t._frame.x+h+u)/a.width,o[1]=(t._frame.y+h+u)/a.height,o[2]=(t._frame.x+t._frame.width-h+u)/a.width,o[3]=(t._frame.y+t._frame.height-h+u)/a.height,this.uClampOffset[0]=u/a.realWidth,this.uClampOffset[1]=u/a.realHeight,this.isSimple=t._frame.width===a.width&&t._frame.height===a.height&&t.rotate===0,!0},r}(),nc=function(r){rt(e,r);function e(t,i,n){var s=this,a=null;return typeof t!="string"&&i===void 0&&n===void 0&&(a=t,t=void 0,i=void 0,n=void 0),s=r.call(this,t||ic,i||rc,n)||this,s.maskSprite=a,s.maskMatrix=new gt,s}return Object.defineProperty(e.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,i,n,s){var a=this._maskSprite,o=a._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new zr(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,a).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=a.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,i,n,s))},e}(ae),sc=function(){function r(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return r.prototype.setMaskStack=function(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)},r.prototype.push=function(e,t){var i=t;if(!i.isMaskData){var n=this.maskDataPool.pop()||new Gf;n.pooled=!0,n.maskObject=t,i=n}var s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==mt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case mt.SCISSOR:this.renderer.scissor.push(i);break;case mt.STENCIL:this.renderer.stencil.push(i);break;case mt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case mt.COLOR:this.pushColorMask(i);break}i.type===mt.SPRITE&&this.maskStack.push(i)},r.prototype.pop=function(e){var t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case mt.SCISSOR:this.renderer.scissor.pop(t);break;case mt.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case mt.SPRITE:this.popSpriteMask(t);break;case mt.COLOR:this.popColorMask(t);break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){var i=this.maskStack[this.maskStack.length-1];i.type===mt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}},r.prototype.detect=function(e){var t=e.maskObject;t?t.isSprite?e.type=mt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=mt.SCISSOR:e.type=mt.STENCIL:e.type=mt.COLOR},r.prototype.pushSpriteMask=function(e){var t,i,n=e.maskObject,s=e._target,a=e._filters;a||(a=this.alphaMaskPool[this.alphaMaskIndex],a||(a=this.alphaMaskPool[this.alphaMaskIndex]=[new nc]));var o=this.renderer,h=o.renderTexture,u,l;if(h.current){var f=h.current;u=e.resolution||f.resolution,l=(t=e.multisample)!==null&&t!==void 0?t:f.multisample}else u=e.resolution||o.resolution,l=(i=e.multisample)!==null&&i!==void 0?i:o.multisample;a[0].resolution=u,a[0].multisample=l,a[0].maskSprite=n;var c=s.filterArea;s.filterArea=n.getBounds(!0),o.filter.push(s,a),s.filterArea=c,e._filters||this.alphaMaskIndex++},r.prototype.popSpriteMask=function(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},r.prototype.pushColorMask=function(e){var t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)},r.prototype.popColorMask=function(e){var t=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)},r.prototype.destroy=function(){this.renderer=null},r}(),Vs=function(){function r(e){this.renderer=e,this.maskStack=[],this.glConst=0}return r.prototype.getStackLength=function(){return this.maskStack.length},r.prototype.setMaskStack=function(e){var t=this.renderer.gl,i=this.getStackLength();this.maskStack=e;var n=this.getStackLength();n!==i&&(n===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},r.prototype._useCurrent=function(){},r.prototype.destroy=function(){this.renderer=null,this.maskStack=null},r}(),qs=new gt,$s=[],ac=function(r){rt(e,r);function e(t){var i=r.call(this,t)||this;return i.glConst=F.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var i;if(!t._scissorRectLocal){var n=t._scissorRect,s=t.maskObject,a=this.renderer,o=a.renderTexture,h=s.getBounds(!0,(i=$s.pop())!==null&&i!==void 0?i:new z);this.roundFrameToPixels(h,o.current?o.current.resolution:a.resolution,o.sourceFrame,o.destinationFrame,a.projection.transform),n&&h.fit(n),t._scissorRectLocal=h}},e.isMatrixRotated=function(t){if(!t)return!1;var i=t.a,n=t.b,s=t.c,a=t.d;return(Math.abs(n)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(i)>1e-4||Math.abs(a)>1e-4)},e.prototype.testScissor=function(t){var i=t.maskObject;if(!i.isFastRect||!i.isFastRect()||e.isMatrixRotated(i.worldTransform)||e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var n=t._scissorRectLocal;return n.width>0&&n.height>0},e.prototype.roundFrameToPixels=function(t,i,n,s,a){e.isMatrixRotated(a)||(a=a?qs.copyFrom(a):qs.identity(),a.translate(-n.x,-n.y).scale(s.width/n.width,s.height/n.height).translate(s.x,s.y),this.renderer.filter.transformAABB(a,t),t.fit(s),t.x=Math.round(t.x*i),t.y=Math.round(t.y*i),t.width=Math.round(t.width*i),t.height=Math.round(t.height*i))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var i=this.renderer.gl;t._scissorRect||i.enable(i.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var i=this.renderer.gl;t&&$s.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():i.disable(i.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,i;this.renderer.renderTexture.current?i=t.y:i=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,i,t.width,t.height)},e}(Vs),oc=function(r){rt(e,r);function e(t){var i=r.call(this,t)||this;return i.glConst=F.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var i=t.maskObject,n=this.renderer.gl,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),n.clearStencil(0),n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST)),t._stencilCounter++;var a=t._colorMask;a!==0&&(t._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilFunc(n.EQUAL,s,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.INCR),i.renderable=!0,i.render(this.renderer),this.renderer.batch.flush(),i.renderable=!1,a!==0&&(t._colorMask=a,n.colorMask((a&1)!==0,(a&2)!==0,(a&4)!==0,(a&8)!==0)),this._useCurrent()},e.prototype.pop=function(t){var i=this.renderer.gl;if(this.getStackLength()===0)i.disable(i.STENCIL_TEST);else{var n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=n?n._colorMask:15;s!==0&&(n._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilOp(i.KEEP,i.KEEP,i.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(n._colorMask=s,i.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(Vs),hc=function(){function r(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new gt,this.transform=null}return r.prototype.update=function(e,t,i,n){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,n),this.transform&&this.projectionMatrix.append(this.transform);var s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)},r.prototype.calculateProjection=function(e,t,i,n){var s=this.projectionMatrix,a=n?-1:1;s.identity(),s.a=1/t.width*2,s.d=a*(1/t.height*2),s.tx=-1-t.x*s.a,s.ty=-a-t.y*s.d},r.prototype.setTransform=function(e){},r.prototype.destroy=function(){this.renderer=null},r}(),we=new z,ni=new z,uc=function(){function r(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new z,this.destinationFrame=new z,this.viewportFrame=new z}return r.prototype.bind=function(e,t,i){e===void 0&&(e=null);var n=this.renderer;this.current=e;var s,a,o;e?(s=e.baseTexture,o=s.resolution,t||(we.width=e.frame.width,we.height=e.frame.height,t=we),i||(ni.x=e.frame.x,ni.y=e.frame.y,ni.width=t.width,ni.height=t.height,i=ni),a=s.framebuffer):(o=n.resolution,t||(we.width=n.screen.width,we.height=n.screen.height,t=we),i||(i=we,i.width=t.width,i.height=t.height));var h=this.viewportFrame;h.x=i.x*o,h.y=i.y*o,h.width=i.width*o,h.height=i.height*o,e||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(i,t,o,!a),e?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)},r.prototype.clear=function(e,t){this.current?e=e||this.current.baseTexture.clearColor:e=e||this.clearColor;var i=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer.screen,s=i.width!==n.width||i.height!==n.height;if(s){var a=this.viewportFrame,o=a.x,h=a.y,u=a.width,l=a.height;o=Math.round(o),h=Math.round(h),u=Math.round(u),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,h,u,l)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),s&&this.renderer.scissor.pop()},r.prototype.resize=function(){this.bind(null)},r.prototype.reset=function(){this.bind(null)},r.prototype.destroy=function(){this.renderer=null},r}();function lc(r,e,t,i,n){t.buffer.update(n)}var fc={float:`
345
+ `,Vs=new gt,Vr=function(){function r(e,t){this._texture=e,this.mapCoord=new gt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}return Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture=e,this._textureID=-1},enumerable:!1,configurable:!0}),r.prototype.multiplyUvs=function(e,t){t===void 0&&(t=e);for(var i=this.mapCoord,n=0;n<e.length;n+=2){var s=e[n],a=e[n+1];t[n]=s*i.a+a*i.c+i.tx,t[n+1]=s*i.b+a*i.d+i.ty}return t},r.prototype.update=function(e){var t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;var i=t._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);var n=t.orig,s=t.trim;s&&(Vs.set(n.width/s.width,0,0,n.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Vs));var a=t.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,u=this.clampOffset;return o[0]=(t._frame.x+h+u)/a.width,o[1]=(t._frame.y+h+u)/a.height,o[2]=(t._frame.x+t._frame.width-h+u)/a.width,o[3]=(t._frame.y+t._frame.height-h+u)/a.height,this.uClampOffset[0]=u/a.realWidth,this.uClampOffset[1]=u/a.realHeight,this.isSimple=t._frame.width===a.width&&t._frame.height===a.height&&t.rotate===0,!0},r}(),oc=function(r){it(e,r);function e(t,i,n){var s=this,a=null;return typeof t!="string"&&i===void 0&&n===void 0&&(a=t,t=void 0,i=void 0,n=void 0),s=r.call(this,t||sc,i||ac,n)||this,s.maskSprite=a,s.maskMatrix=new gt,s}return Object.defineProperty(e.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,i,n,s){var a=this._maskSprite,o=a._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Vr(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,a).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=a.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,i,n,s))},e}(oe),hc=function(){function r(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return r.prototype.setMaskStack=function(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)},r.prototype.push=function(e,t){var i=t;if(!i.isMaskData){var n=this.maskDataPool.pop()||new Xf;n.pooled=!0,n.maskObject=t,i=n}var s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==mt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case mt.SCISSOR:this.renderer.scissor.push(i);break;case mt.STENCIL:this.renderer.stencil.push(i);break;case mt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case mt.COLOR:this.pushColorMask(i);break}i.type===mt.SPRITE&&this.maskStack.push(i)},r.prototype.pop=function(e){var t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case mt.SCISSOR:this.renderer.scissor.pop(t);break;case mt.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case mt.SPRITE:this.popSpriteMask(t);break;case mt.COLOR:this.popColorMask(t);break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){var i=this.maskStack[this.maskStack.length-1];i.type===mt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}},r.prototype.detect=function(e){var t=e.maskObject;t?t.isSprite?e.type=mt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=mt.SCISSOR:e.type=mt.STENCIL:e.type=mt.COLOR},r.prototype.pushSpriteMask=function(e){var t,i,n=e.maskObject,s=e._target,a=e._filters;a||(a=this.alphaMaskPool[this.alphaMaskIndex],a||(a=this.alphaMaskPool[this.alphaMaskIndex]=[new oc]));var o=this.renderer,h=o.renderTexture,u,l;if(h.current){var f=h.current;u=e.resolution||f.resolution,l=(t=e.multisample)!==null&&t!==void 0?t:f.multisample}else u=e.resolution||o.resolution,l=(i=e.multisample)!==null&&i!==void 0?i:o.multisample;a[0].resolution=u,a[0].multisample=l,a[0].maskSprite=n;var c=s.filterArea;s.filterArea=n.getBounds(!0),o.filter.push(s,a),s.filterArea=c,e._filters||this.alphaMaskIndex++},r.prototype.popSpriteMask=function(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},r.prototype.pushColorMask=function(e){var t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)},r.prototype.popColorMask=function(e){var t=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)},r.prototype.destroy=function(){this.renderer=null},r}(),qs=function(){function r(e){this.renderer=e,this.maskStack=[],this.glConst=0}return r.prototype.getStackLength=function(){return this.maskStack.length},r.prototype.setMaskStack=function(e){var t=this.renderer.gl,i=this.getStackLength();this.maskStack=e;var n=this.getStackLength();n!==i&&(n===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},r.prototype._useCurrent=function(){},r.prototype.destroy=function(){this.renderer=null,this.maskStack=null},r}(),$s=new gt,Zs=[],uc=function(r){it(e,r);function e(t){var i=r.call(this,t)||this;return i.glConst=F.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var i;if(!t._scissorRectLocal){var n=t._scissorRect,s=t.maskObject,a=this.renderer,o=a.renderTexture,h=s.getBounds(!0,(i=Zs.pop())!==null&&i!==void 0?i:new j);this.roundFrameToPixels(h,o.current?o.current.resolution:a.resolution,o.sourceFrame,o.destinationFrame,a.projection.transform),n&&h.fit(n),t._scissorRectLocal=h}},e.isMatrixRotated=function(t){if(!t)return!1;var i=t.a,n=t.b,s=t.c,a=t.d;return(Math.abs(n)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(i)>1e-4||Math.abs(a)>1e-4)},e.prototype.testScissor=function(t){var i=t.maskObject;if(!i.isFastRect||!i.isFastRect()||e.isMatrixRotated(i.worldTransform)||e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var n=t._scissorRectLocal;return n.width>0&&n.height>0},e.prototype.roundFrameToPixels=function(t,i,n,s,a){e.isMatrixRotated(a)||(a=a?$s.copyFrom(a):$s.identity(),a.translate(-n.x,-n.y).scale(s.width/n.width,s.height/n.height).translate(s.x,s.y),this.renderer.filter.transformAABB(a,t),t.fit(s),t.x=Math.round(t.x*i),t.y=Math.round(t.y*i),t.width=Math.round(t.width*i),t.height=Math.round(t.height*i))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var i=this.renderer.gl;t._scissorRect||i.enable(i.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var i=this.renderer.gl;t&&Zs.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():i.disable(i.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,i;this.renderer.renderTexture.current?i=t.y:i=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,i,t.width,t.height)},e}(qs),lc=function(r){it(e,r);function e(t){var i=r.call(this,t)||this;return i.glConst=F.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var i=t.maskObject,n=this.renderer.gl,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),n.clearStencil(0),n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST)),t._stencilCounter++;var a=t._colorMask;a!==0&&(t._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilFunc(n.EQUAL,s,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.INCR),i.renderable=!0,i.render(this.renderer),this.renderer.batch.flush(),i.renderable=!1,a!==0&&(t._colorMask=a,n.colorMask((a&1)!==0,(a&2)!==0,(a&4)!==0,(a&8)!==0)),this._useCurrent()},e.prototype.pop=function(t){var i=this.renderer.gl;if(this.getStackLength()===0)i.disable(i.STENCIL_TEST);else{var n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=n?n._colorMask:15;s!==0&&(n._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilOp(i.KEEP,i.KEEP,i.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(n._colorMask=s,i.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(qs),fc=function(){function r(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new gt,this.transform=null}return r.prototype.update=function(e,t,i,n){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,n),this.transform&&this.projectionMatrix.append(this.transform);var s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)},r.prototype.calculateProjection=function(e,t,i,n){var s=this.projectionMatrix,a=n?-1:1;s.identity(),s.a=1/t.width*2,s.d=a*(1/t.height*2),s.tx=-1-t.x*s.a,s.ty=-a-t.y*s.d},r.prototype.setTransform=function(e){},r.prototype.destroy=function(){this.renderer=null},r}(),Se=new j,ai=new j,cc=function(){function r(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new j,this.destinationFrame=new j,this.viewportFrame=new j}return r.prototype.bind=function(e,t,i){e===void 0&&(e=null);var n=this.renderer;this.current=e;var s,a,o;e?(s=e.baseTexture,o=s.resolution,t||(Se.width=e.frame.width,Se.height=e.frame.height,t=Se),i||(ai.x=e.frame.x,ai.y=e.frame.y,ai.width=t.width,ai.height=t.height,i=ai),a=s.framebuffer):(o=n.resolution,t||(Se.width=n.screen.width,Se.height=n.screen.height,t=Se),i||(i=Se,i.width=t.width,i.height=t.height));var h=this.viewportFrame;h.x=i.x*o,h.y=i.y*o,h.width=i.width*o,h.height=i.height*o,e||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(i,t,o,!a),e?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)},r.prototype.clear=function(e,t){this.current?e=e||this.current.baseTexture.clearColor:e=e||this.clearColor;var i=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer.screen,s=i.width!==n.width||i.height!==n.height;if(s){var a=this.viewportFrame,o=a.x,h=a.y,u=a.width,l=a.height;o=Math.round(o),h=Math.round(h),u=Math.round(u),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,h,u,l)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),s&&this.renderer.scissor.pop()},r.prototype.resize=function(){this.bind(null)},r.prototype.reset=function(){this.bind(null)},r.prototype.destroy=function(){this.renderer=null},r}();function dc(r,e,t,i,n){t.buffer.update(n)}var pc={float:`
346
346
  data[offset] = v;
347
347
  `,vec2:`
348
348
  data[offset] = v[0];
@@ -380,7 +380,7 @@ void main(void)
380
380
  {
381
381
  data[offset + i] = v[i];
382
382
  }
383
- `},Zs={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function cc(r){for(var e=r.map(function(h){return{data:h,offset:0,dataLen:0,dirty:0}}),t=0,i=0,n=0,s=0;s<e.length;s++){var a=e[s];if(t=Zs[a.data.type],a.data.size>1&&(t=Math.max(t,16)*a.data.size),a.dataLen=t,i%t!==0&&i<16){var o=i%t%16;i+=o,n+=o}i+t>16?(n=Math.ceil(n/16)*16,a.offset=n,n+=t,i=t):(a.offset=n,i+=t,n+=t)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function dc(r,e){var t=[];for(var i in r)e[i]&&t.push(e[i]);return t.sort(function(n,s){return n.index-s.index}),t}function pc(r,e){if(!r.autoManage)return{size:0,syncFunc:lc};for(var t=dc(r.uniforms,e),i=cc(t),n=i.uboElements,s=i.size,a=[`
383
+ `},Ks={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function vc(r){for(var e=r.map(function(h){return{data:h,offset:0,dataLen:0,dirty:0}}),t=0,i=0,n=0,s=0;s<e.length;s++){var a=e[s];if(t=Ks[a.data.type],a.data.size>1&&(t=Math.max(t,16)*a.data.size),a.dataLen=t,i%t!==0&&i<16){var o=i%t%16;i+=o,n+=o}i+t>16?(n=Math.ceil(n/16)*16,a.offset=n,n+=t,i=t):(a.offset=n,i+=t,n+=t)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function _c(r,e){var t=[];for(var i in r)e[i]&&t.push(e[i]);return t.sort(function(n,s){return n.index-s.index}),t}function mc(r,e){if(!r.autoManage)return{size:0,syncFunc:dc};for(var t=_c(r.uniforms,e),i=vc(t),n=i.uboElements,s=i.size,a=[`
384
384
  var v = null;
385
385
  var v2 = null;
386
386
  var cv = null;
@@ -388,7 +388,7 @@ void main(void)
388
388
  var gl = renderer.gl
389
389
  var index = 0;
390
390
  var data = buffer.data;
391
- `],o=0;o<n.length;o++){for(var h=n[o],u=r.uniforms[h.data.name],l=h.data.name,f=!1,c=0;c<Le.length;c++){var d=Le[c];if(d.codeUbo&&d.test(h.data,u)){a.push("offset = "+h.offset/4+";",Le[c].codeUbo(h.data.name,u)),f=!0;break}}if(!f)if(h.data.size>1){var p=Ws(h.data.type),v=Math.max(Zs[h.data.type]/16,1),_=p/v,m=(4-_%4)%4;a.push(`
391
+ `],o=0;o<n.length;o++){for(var h=n[o],u=r.uniforms[h.data.name],l=h.data.name,f=!1,c=0;c<Ge.length;c++){var d=Ge[c];if(d.codeUbo&&d.test(h.data,u)){a.push("offset = "+h.offset/4+";",Ge[c].codeUbo(h.data.name,u)),f=!0;break}}if(!f)if(h.data.size>1){var p=js(h.data.type),v=Math.max(Ks[h.data.type]/16,1),_=p/v,m=(4-_%4)%4;a.push(`
392
392
  cv = ud.`+l+`.value;
393
393
  v = uv.`+l+`;
394
394
  offset = `+h.offset/4+`;
@@ -404,15 +404,15 @@ void main(void)
404
404
  offset += `+m+`;
405
405
  }
406
406
 
407
- `)}else{var y=fc[h.data.type];a.push(`
407
+ `)}else{var g=pc[h.data.type];a.push(`
408
408
  cv = ud.`+l+`.value;
409
409
  v = uv.`+l+`;
410
410
  offset = `+h.offset/4+`;
411
- `+y+`;
411
+ `+g+`;
412
412
  `)}}return a.push(`
413
413
  renderer.buffer.update(buffer);
414
414
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",a.join(`
415
- `))}}var vc=function(){function r(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return r.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},r}();function _c(r,e){for(var t={},i=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=e.getActiveAttrib(r,n);if(s.name.indexOf("gl_")!==0){var a=js(e,s.type),o={type:a,name:s.name,size:Ws(a),location:e.getAttribLocation(r,s.name)};t[s.name]=o}}return t}function mc(r,e){for(var t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS),n=0;n<i;n++){var s=e.getActiveUniform(r,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),h=js(e,s.type);t[a]={name:a,index:n,type:h,size:s.size,isArray:o,value:ks(h,s.size)}}return t}function gc(r,e){var t=Us(r,r.VERTEX_SHADER,e.vertexSrc),i=Us(r,r.FRAGMENT_SHADER,e.fragmentSrc),n=r.createProgram();if(r.attachShader(n,t),r.attachShader(n,i),r.linkProgram(n),r.getProgramParameter(n,r.LINK_STATUS)||kf(r,n,t,i),e.attributeData=_c(n,r),e.uniformData=mc(n,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){var s=Object.keys(e.attributeData);s.sort(function(l,f){return l>f?1:-1});for(var a=0;a<s.length;a++)e.attributeData[s[a]].location=a,r.bindAttribLocation(n,a,s[a]);r.linkProgram(n)}r.deleteShader(t),r.deleteShader(i);var o={};for(var a in e.uniformData){var h=e.uniformData[a];o[a]={location:r.getUniformLocation(n,a),value:ks(h.type,h.size)}}var u=new vc(n,o);return u}var yc=0,Gi={textureCount:0,uboCount:0},xc=function(){function r(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=yc++}return r.prototype.systemCheck=function(){if(!Zf())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},r.prototype.contextChange=function(e){this.gl=e,this.reset()},r.prototype.bind=function(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;var i=e.program,n=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(n.program)),t||(Gi.textureCount=0,Gi.uboCount=0,this.syncUniformGroup(e.uniformGroup,Gi)),n},r.prototype.setUniforms=function(e){var t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)},r.prototype.syncUniformGroup=function(e,t){var i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))},r.prototype.syncUniforms=function(e,t,i){var n=e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e);n(t.uniformData,e.uniforms,this.renderer,i)},r.prototype.createSyncGroups=function(e){var t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=Yf(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]},r.prototype.syncUniformBufferGroup=function(e,t){var i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;var n=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),n(i.uniformData,e.uniforms,this.renderer,Gi,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])},r.prototype.createSyncBufferGroup=function(e,t,i){var n=this.renderer.gl;this.renderer.buffer.bind(e.buffer);var s=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,n.uniformBlockBinding(t.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;var a=this.getSignature(e,this.shader.program.uniformData,"ubo"),o=this._uboCache[a];if(o||(o=this._uboCache[a]=pc(e,this.shader.program.uniformData)),e.autoManage){var h=new Float32Array(o.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=o.syncFunc,t.uniformGroups[e.id]},r.prototype.getSignature=function(e,t,i){var n=e.uniforms,s=[i+"-"];for(var a in n)s.push(a),t[a]&&s.push(t[a].type);return s.join("-")},r.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},r.prototype.generateProgram=function(e){var t=this.gl,i=e.program,n=gc(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=n,n},r.prototype.reset=function(){this.program=null,this.shader=null},r.prototype.disposeShader=function(e){this.shader===e&&(this.shader=null)},r.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},r}();function bc(r,e){return e===void 0&&(e=[]),e[U.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.ADD]=[r.ONE,r.ONE],e[U.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.NONE]=[0,0],e[U.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[U.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[U.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[U.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[U.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[U.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[U.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[U.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[U.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[U.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[U.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var Tc=0,wc=1,Ec=2,Sc=3,Pc=4,Cc=5,Rc=function(){function r(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=U.NONE,this._blendEq=!1,this.map=[],this.map[Tc]=this.setBlend,this.map[wc]=this.setOffset,this.map[Ec]=this.setCullFace,this.map[Sc]=this.setDepthTest,this.map[Pc]=this.setFrontFace,this.map[Cc]=this.setDepthMask,this.checks=[],this.defaultState=new Te,this.defaultState.blend=!0}return r.prototype.contextChange=function(e){this.gl=e,this.blendModes=bc(e),this.set(this.defaultState),this.reset()},r.prototype.set=function(e){if(e=e||this.defaultState,this.stateId!==e.data){for(var t=this.stateId^e.data,i=0;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t=t>>1,i++;this.stateId=e.data}for(var i=0;i<this.checks.length;i++)this.checks[i](this,e)},r.prototype.forceState=function(e){e=e||this.defaultState;for(var t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(var t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data},r.prototype.setBlend=function(e){this.updateCheck(r.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)},r.prototype.setOffset=function(e){this.updateCheck(r.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},r.prototype.setDepthTest=function(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)},r.prototype.setDepthMask=function(e){this.gl.depthMask(e)},r.prototype.setCullFace=function(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)},r.prototype.setFrontFace=function(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])},r.prototype.setBlendMode=function(e){if(e!==this.blendMode){this.blendMode=e;var t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}},r.prototype.setPolygonOffset=function(e,t){this.gl.polygonOffset(e,t)},r.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},r.prototype.updateCheck=function(e,t){var i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)},r.checkBlendMode=function(e,t){e.setBlendMode(t.blendMode)},r.checkPolygonOffset=function(e,t){e.setPolygonOffset(1,t.polygonOffset)},r.prototype.destroy=function(){this.gl=null},r}(),Ac=function(){function r(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=F.GC_MAX_IDLE,this.checkCountMax=F.GC_MAX_CHECK_COUNT,this.mode=F.GC_MODE}return r.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==bi.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,i=!1,n=0;n<t.length;n++){var s=t[n];!s.framebuffer&&this.count-s.touched>this.maxIdle&&(e.destroyTexture(s,!0),t[n]=null,i=!0)}if(i){for(var a=0,n=0;n<t.length;n++)t[n]!==null&&(t[a++]=t[n]);t.length=a}},r.prototype.unload=function(e){var t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(var n=e.children.length-1;n>=0;n--)this.unload(e.children[n])},r.prototype.destroy=function(){this.renderer=null},r}();function Ic(r){var e,t,i,n,s,a,o,h,u,l,f,c,d,p,v,_,m,y,g,b,x,T,w;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?w=(e={},e[L.UNSIGNED_BYTE]=(t={},t[R.RGBA]=r.RGBA8,t[R.RGB]=r.RGB8,t[R.RG]=r.RG8,t[R.RED]=r.R8,t[R.RGBA_INTEGER]=r.RGBA8UI,t[R.RGB_INTEGER]=r.RGB8UI,t[R.RG_INTEGER]=r.RG8UI,t[R.RED_INTEGER]=r.R8UI,t[R.ALPHA]=r.ALPHA,t[R.LUMINANCE]=r.LUMINANCE,t[R.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,t),e[L.BYTE]=(i={},i[R.RGBA]=r.RGBA8_SNORM,i[R.RGB]=r.RGB8_SNORM,i[R.RG]=r.RG8_SNORM,i[R.RED]=r.R8_SNORM,i[R.RGBA_INTEGER]=r.RGBA8I,i[R.RGB_INTEGER]=r.RGB8I,i[R.RG_INTEGER]=r.RG8I,i[R.RED_INTEGER]=r.R8I,i),e[L.UNSIGNED_SHORT]=(n={},n[R.RGBA_INTEGER]=r.RGBA16UI,n[R.RGB_INTEGER]=r.RGB16UI,n[R.RG_INTEGER]=r.RG16UI,n[R.RED_INTEGER]=r.R16UI,n[R.DEPTH_COMPONENT]=r.DEPTH_COMPONENT16,n),e[L.SHORT]=(s={},s[R.RGBA_INTEGER]=r.RGBA16I,s[R.RGB_INTEGER]=r.RGB16I,s[R.RG_INTEGER]=r.RG16I,s[R.RED_INTEGER]=r.R16I,s),e[L.UNSIGNED_INT]=(a={},a[R.RGBA_INTEGER]=r.RGBA32UI,a[R.RGB_INTEGER]=r.RGB32UI,a[R.RG_INTEGER]=r.RG32UI,a[R.RED_INTEGER]=r.R32UI,a[R.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,a),e[L.INT]=(o={},o[R.RGBA_INTEGER]=r.RGBA32I,o[R.RGB_INTEGER]=r.RGB32I,o[R.RG_INTEGER]=r.RG32I,o[R.RED_INTEGER]=r.R32I,o),e[L.FLOAT]=(h={},h[R.RGBA]=r.RGBA32F,h[R.RGB]=r.RGB32F,h[R.RG]=r.RG32F,h[R.RED]=r.R32F,h[R.DEPTH_COMPONENT]=r.DEPTH_COMPONENT32F,h),e[L.HALF_FLOAT]=(u={},u[R.RGBA]=r.RGBA16F,u[R.RGB]=r.RGB16F,u[R.RG]=r.RG16F,u[R.RED]=r.R16F,u),e[L.UNSIGNED_SHORT_5_6_5]=(l={},l[R.RGB]=r.RGB565,l),e[L.UNSIGNED_SHORT_4_4_4_4]=(f={},f[R.RGBA]=r.RGBA4,f),e[L.UNSIGNED_SHORT_5_5_5_1]=(c={},c[R.RGBA]=r.RGB5_A1,c),e[L.UNSIGNED_INT_2_10_10_10_REV]=(d={},d[R.RGBA]=r.RGB10_A2,d[R.RGBA_INTEGER]=r.RGB10_A2UI,d),e[L.UNSIGNED_INT_10F_11F_11F_REV]=(p={},p[R.RGB]=r.R11F_G11F_B10F,p),e[L.UNSIGNED_INT_5_9_9_9_REV]=(v={},v[R.RGB]=r.RGB9_E5,v),e[L.UNSIGNED_INT_24_8]=(_={},_[R.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,_),e[L.FLOAT_32_UNSIGNED_INT_24_8_REV]=(m={},m[R.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,m),e):w=(y={},y[L.UNSIGNED_BYTE]=(g={},g[R.RGBA]=r.RGBA,g[R.RGB]=r.RGB,g[R.ALPHA]=r.ALPHA,g[R.LUMINANCE]=r.LUMINANCE,g[R.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,g),y[L.UNSIGNED_SHORT_5_6_5]=(b={},b[R.RGB]=r.RGB,b),y[L.UNSIGNED_SHORT_4_4_4_4]=(x={},x[R.RGBA]=r.RGBA,x),y[L.UNSIGNED_SHORT_5_5_5_1]=(T={},T[R.RGBA]=r.RGBA,T),y),w}var jr=function(){function r(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=L.UNSIGNED_BYTE,this.internalFormat=R.RGBA,this.samplerType=0}return r}(),Oc=function(){function r(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Y,this.hasIntegerTextures=!1}return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Ic(e);var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var i=0;i<t;i++)this.boundTextures[i]=null;this.emptyTextures={};var n=new jr(e.createTexture());e.bindTexture(e.TEXTURE_2D,n.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=n,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new jr(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(var i=0;i<6;i++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(var i=0;i<this.boundTextures.length;i++)this.bind(null,i)},r.prototype.bind=function(e,t){t===void 0&&(t=0);var i=this.gl;if(e=e==null?void 0:e.castToBaseTexture(),e&&e.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;var n=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,n.texture)),n.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):n.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null},r.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture},r.prototype.unbind=function(e){var t=this,i=t.gl,n=t.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var s=0;s<n.length;s++)n[s]===this.unknownTexture&&this.bind(null,s)}for(var s=0;s<n.length;s++)n[s]===e&&(this.currentLocation!==s&&(i.activeTexture(i.TEXTURE0+s),this.currentLocation=s),i.bindTexture(e.target,this.emptyTextures[e.target].texture),n[s]=null)},r.prototype.ensureSamplerType=function(e){var t=this,i=t.boundTextures,n=t.hasIntegerTextures,s=t.CONTEXT_UID;if(n)for(var a=e-1;a>=0;--a){var o=i[a];if(o){var h=o._glTextures[s];h.samplerType!==xi.FLOAT&&this.renderer.texture.unbind(o)}}},r.prototype.initTexture=function(e){var t=new jr(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},r.prototype.initTextureType=function(e,t){var i,n;t.internalFormat=(n=(i=this.internalFormats[e.type])===null||i===void 0?void 0:i[e.format])!==null&&n!==void 0?n:e.format,this.webGLVersion===2&&e.type===L.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type},r.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var i=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(i,e,t))t.samplerType!==xi.FLOAT&&(this.hasIntegerTextures=!0);else{var n=e.realWidth,s=e.realHeight,a=i.gl;(t.width!==n||t.height!==s||t.dirtyId<0)&&(t.width=n,t.height=s,a.texImage2D(e.target,0,t.internalFormat,n,s,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},r.prototype.destroyTexture=function(e,t){var i=this.gl;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var n=this.managedTextures.indexOf(e);n!==-1&&Ne(this.managedTextures,n,1)}},r.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Mt.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=zt.CLAMP:t.wrapMode=e.wrapMode,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,t){var i=this.gl;if(t.mipmap&&e.mipmap!==Mt.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Wt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===Wt.LINEAR){var s=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Wt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Wt.LINEAR?i.LINEAR:i.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),Yr=new gt,Mc=function(r){rt(e,r);function e(t,i){t===void 0&&(t=ze.UNKNOWN);var n=r.call(this)||this;return i=Object.assign({},F.RENDER_OPTIONS,i),n.options=i,n.type=t,n.screen=new z(0,0,i.width,i.height),n.view=i.view||F.ADAPTER.createCanvas(),n.resolution=i.resolution||F.RESOLUTION,n.useContextAlpha=i.useContextAlpha,n.autoDensity=!!i.autoDensity,n.preserveDrawingBuffer=i.preserveDrawingBuffer,n.clearBeforeRender=i.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,1],n._backgroundColorString="#000000",n.backgroundColor=i.backgroundColor||n._backgroundColor,n.backgroundAlpha=i.backgroundAlpha,i.transparent!==void 0&&(Bt("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),n.useContextAlpha=i.transparent,n.backgroundAlpha=i.transparent?0:1),n._lastObjectRendered=null,n.plugins={},n}return e.prototype.initPlugins=function(t){for(var i in t)this.plugins[i]=new t[i](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,i){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(i*this.resolution);var n=this.view.width/this.resolution,s=this.view.height/this.resolution;this.screen.width=n,this.screen.height=s,this.autoDensity&&(this.view.style.width=n+"px",this.view.style.height=s+"px"),this.emit("resize",n,s)},e.prototype.generateTexture=function(t,i,n,s){i===void 0&&(i={}),typeof i=="number"&&(Bt("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),i={scaleMode:i,resolution:n,region:s});var a=i.region,o=pf(i,["region"]);s=a||t.getLocalBounds(null,!0),s.width===0&&(s.width=1),s.height===0&&(s.height=1);var h=xe.create(Dr({width:s.width,height:s.height},o));return Yr.tx=-s.x,Yr.ty=-s.y,this.render(t,{renderTexture:h,clear:!1,transform:Yr,skipUpdateTransform:!!t.parent}),h},e.prototype.destroy=function(t){for(var i in this.plugins)this.plugins[i].destroy(),this.plugins[i]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var n=this;n.plugins=null,n.type=ze.UNKNOWN,n.view=null,n.screen=null,n._tempDisplayObjectParent=null,n.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=vs(t),Fe(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(je),Dc=function(){function r(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),Fc=function(){function r(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}return r.prototype.destroy=function(){this.renderer=null},r.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},r.prototype.bind=function(e){var t=this,i=t.gl,n=t.CONTEXT_UID,s=e._glBuffers[n]||this.createGLBuffer(e);i.bindBuffer(e.type,s.buffer)},r.prototype.bindBufferBase=function(e,t){var i=this,n=i.gl,s=i.CONTEXT_UID;if(this.boundBufferBases[t]!==e){var a=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,n.bindBufferBase(n.UNIFORM_BUFFER,t,a.buffer)}},r.prototype.bindBufferRange=function(e,t,i){var n=this,s=n.gl,a=n.CONTEXT_UID;i=i||0;var o=e._glBuffers[a]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,o.buffer,i*256,256)},r.prototype.update=function(e){var t=this,i=t.gl,n=t.CONTEXT_UID,s=e._glBuffers[n];if(e._updateID!==s.updateID)if(s.updateID=e._updateID,i.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)i.bufferSubData(e.type,0,e.data);else{var a=e.static?i.STATIC_DRAW:i.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,i.bufferData(e.type,e.data,a)}},r.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var i=e._glBuffers[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this),i&&(t||n.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}},r.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),i=0;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)},r.prototype.createGLBuffer=function(e){var t=this,i=t.CONTEXT_UID,n=t.gl;return e._glBuffers[i]=new Dc(n.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[i]},r}(),Ks=function(r){rt(e,r);function e(t){var i=r.call(this,ze.WEBGL,t)||this;return t=i.options,i.gl=null,i.CONTEXT_UID=0,i.runners={destroy:new wt("destroy"),contextChange:new wt("contextChange"),reset:new wt("reset"),update:new wt("update"),postrender:new wt("postrender"),prerender:new wt("prerender"),resize:new wt("resize")},i.runners.contextChange.add(i),i.globalUniforms=new be({projectionMatrix:new gt},!0),i.addSystem(sc,"mask").addSystem(Ff,"context").addSystem(Rc,"state").addSystem(xc,"shader").addSystem(Oc,"texture").addSystem(Fc,"buffer").addSystem(Uf,"geometry").addSystem(Lf,"framebuffer").addSystem(ac,"scissor").addSystem(oc,"stencil").addSystem(hc,"projection").addSystem(Ac,"textureGC").addSystem(Mf,"filter").addSystem(uc,"renderTexture").addSystem(Df,"batch"),i.initPlugins(e.__plugins),i.multisample=void 0,t.context?i.context.initFromContext(t.context):i.context.initFromOptions({alpha:!!i.useContextAlpha,antialias:t.antialias,premultipliedAlpha:i.useContextAlpha&&i.useContextAlpha!=="notMultiplied",stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:i.options.powerPreference}),i.renderingToScreen=!0,_h(i.context.webGLVersion===2?"WebGL 2":"WebGL 1"),i.resize(i.options.width,i.options.height),i}return e.create=function(t){if(mh())return new e(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},e.prototype.contextChange=function(){var t=this.gl,i;if(this.context.webGLVersion===1){var n=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),i=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,n)}else{var n=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),i=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,n)}i>=ct.HIGH?this.multisample=ct.HIGH:i>=ct.MEDIUM?this.multisample=ct.MEDIUM:i>=ct.LOW?this.multisample=ct.LOW:this.multisample=ct.NONE},e.prototype.addSystem=function(t,i){var n=new t(this);if(this[i])throw new Error('Whoops! The name "'+i+'" is already in use');this[i]=n;for(var s in this.runners)this.runners[s].add(n);return this},e.prototype.render=function(t,i){var n,s,a,o;if(i&&(i instanceof xe?(Bt("6.0.0","Renderer#render arguments changed, use options instead."),n=i,s=arguments[2],a=arguments[3],o=arguments[4]):(n=i.renderTexture,s=i.clear,a=i.transform,o=i.skipUpdateTransform)),this.renderingToScreen=!n,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=a,!this.context.isLost){if(n||(this._lastObjectRendered=t),!o){var h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}this.renderTexture.bind(n),this.batch.currentRenderer.start(),(s!==void 0?s:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),n&&n.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(t,i,n,s){i===void 0&&(i={});var a=r.prototype.generateTexture.call(this,t,i,n,s);return this.framebuffer.blit(),a},e.prototype.resize=function(t,i){r.prototype.resize.call(this,t,i),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(t){this.runners.destroy.emit();for(var i in this.runners)this.runners[i].destroy();r.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return Bt("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,i){Bt("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Jt.add({name:t,type:J.RendererPlugin,ref:i})},e.__plugins={},e}(Mc);Jt.handleByMap(J.RendererPlugin,Ks.__plugins);function Nc(r){return Ks.create(r)}var Bc=`attribute vec2 aVertexPosition;
415
+ `))}}var gc=function(){function r(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return r.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},r}();function yc(r,e){for(var t={},i=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=e.getActiveAttrib(r,n);if(s.name.indexOf("gl_")!==0){var a=Ys(e,s.type),o={type:a,name:s.name,size:js(a),location:e.getAttribLocation(r,s.name)};t[s.name]=o}}return t}function xc(r,e){for(var t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS),n=0;n<i;n++){var s=e.getActiveUniform(r,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),h=Ys(e,s.type);t[a]={name:a,index:n,type:h,size:s.size,isArray:o,value:Hs(h,s.size)}}return t}function bc(r,e){var t=Gs(r,r.VERTEX_SHADER,e.vertexSrc),i=Gs(r,r.FRAGMENT_SHADER,e.fragmentSrc),n=r.createProgram();if(r.attachShader(n,t),r.attachShader(n,i),r.linkProgram(n),r.getProgramParameter(n,r.LINK_STATUS)||Wf(r,n,t,i),e.attributeData=yc(n,r),e.uniformData=xc(n,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){var s=Object.keys(e.attributeData);s.sort(function(l,f){return l>f?1:-1});for(var a=0;a<s.length;a++)e.attributeData[s[a]].location=a,r.bindAttribLocation(n,a,s[a]);r.linkProgram(n)}r.deleteShader(t),r.deleteShader(i);var o={};for(var a in e.uniformData){var h=e.uniformData[a];o[a]={location:r.getUniformLocation(n,a),value:Hs(h.type,h.size)}}var u=new gc(n,o);return u}var Tc=0,Hi={textureCount:0,uboCount:0},wc=function(){function r(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Tc++}return r.prototype.systemCheck=function(){if(!Jf())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},r.prototype.contextChange=function(e){this.gl=e,this.reset()},r.prototype.bind=function(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;var i=e.program,n=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(n.program)),t||(Hi.textureCount=0,Hi.uboCount=0,this.syncUniformGroup(e.uniformGroup,Hi)),n},r.prototype.setUniforms=function(e){var t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)},r.prototype.syncUniformGroup=function(e,t){var i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))},r.prototype.syncUniforms=function(e,t,i){var n=e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e);n(t.uniformData,e.uniforms,this.renderer,i)},r.prototype.createSyncGroups=function(e){var t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=$f(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]},r.prototype.syncUniformBufferGroup=function(e,t){var i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;var n=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),n(i.uniformData,e.uniforms,this.renderer,Hi,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])},r.prototype.createSyncBufferGroup=function(e,t,i){var n=this.renderer.gl;this.renderer.buffer.bind(e.buffer);var s=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,n.uniformBlockBinding(t.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;var a=this.getSignature(e,this.shader.program.uniformData,"ubo"),o=this._uboCache[a];if(o||(o=this._uboCache[a]=mc(e,this.shader.program.uniformData)),e.autoManage){var h=new Float32Array(o.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=o.syncFunc,t.uniformGroups[e.id]},r.prototype.getSignature=function(e,t,i){var n=e.uniforms,s=[i+"-"];for(var a in n)s.push(a),t[a]&&s.push(t[a].type);return s.join("-")},r.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},r.prototype.generateProgram=function(e){var t=this.gl,i=e.program,n=bc(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=n,n},r.prototype.reset=function(){this.program=null,this.shader=null},r.prototype.disposeShader=function(e){this.shader===e&&(this.shader=null)},r.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},r}();function Ec(r,e){return e===void 0&&(e=[]),e[G.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.ADD]=[r.ONE,r.ONE],e[G.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.NONE]=[0,0],e[G.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[G.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[G.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[G.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[G.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[G.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[G.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[G.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[G.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[G.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[G.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var Sc=0,Pc=1,Rc=2,Cc=3,Ac=4,Ic=5,Oc=function(){function r(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=G.NONE,this._blendEq=!1,this.map=[],this.map[Sc]=this.setBlend,this.map[Pc]=this.setOffset,this.map[Rc]=this.setCullFace,this.map[Cc]=this.setDepthTest,this.map[Ac]=this.setFrontFace,this.map[Ic]=this.setDepthMask,this.checks=[],this.defaultState=new Ee,this.defaultState.blend=!0}return r.prototype.contextChange=function(e){this.gl=e,this.blendModes=Ec(e),this.set(this.defaultState),this.reset()},r.prototype.set=function(e){if(e=e||this.defaultState,this.stateId!==e.data){for(var t=this.stateId^e.data,i=0;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t=t>>1,i++;this.stateId=e.data}for(var i=0;i<this.checks.length;i++)this.checks[i](this,e)},r.prototype.forceState=function(e){e=e||this.defaultState;for(var t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(var t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data},r.prototype.setBlend=function(e){this.updateCheck(r.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)},r.prototype.setOffset=function(e){this.updateCheck(r.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},r.prototype.setDepthTest=function(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)},r.prototype.setDepthMask=function(e){this.gl.depthMask(e)},r.prototype.setCullFace=function(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)},r.prototype.setFrontFace=function(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])},r.prototype.setBlendMode=function(e){if(e!==this.blendMode){this.blendMode=e;var t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}},r.prototype.setPolygonOffset=function(e,t){this.gl.polygonOffset(e,t)},r.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},r.prototype.updateCheck=function(e,t){var i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)},r.checkBlendMode=function(e,t){e.setBlendMode(t.blendMode)},r.checkPolygonOffset=function(e,t){e.setPolygonOffset(1,t.polygonOffset)},r.prototype.destroy=function(){this.gl=null},r}(),Mc=function(){function r(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=F.GC_MAX_IDLE,this.checkCountMax=F.GC_MAX_CHECK_COUNT,this.mode=F.GC_MODE}return r.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==wi.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,i=!1,n=0;n<t.length;n++){var s=t[n];!s.framebuffer&&this.count-s.touched>this.maxIdle&&(e.destroyTexture(s,!0),t[n]=null,i=!0)}if(i){for(var a=0,n=0;n<t.length;n++)t[n]!==null&&(t[a++]=t[n]);t.length=a}},r.prototype.unload=function(e){var t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(var n=e.children.length-1;n>=0;n--)this.unload(e.children[n])},r.prototype.destroy=function(){this.renderer=null},r}();function Dc(r){var e,t,i,n,s,a,o,h,u,l,f,c,d,p,v,_,m,g,y,b,x,T,w;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?w=(e={},e[L.UNSIGNED_BYTE]=(t={},t[R.RGBA]=r.RGBA8,t[R.RGB]=r.RGB8,t[R.RG]=r.RG8,t[R.RED]=r.R8,t[R.RGBA_INTEGER]=r.RGBA8UI,t[R.RGB_INTEGER]=r.RGB8UI,t[R.RG_INTEGER]=r.RG8UI,t[R.RED_INTEGER]=r.R8UI,t[R.ALPHA]=r.ALPHA,t[R.LUMINANCE]=r.LUMINANCE,t[R.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,t),e[L.BYTE]=(i={},i[R.RGBA]=r.RGBA8_SNORM,i[R.RGB]=r.RGB8_SNORM,i[R.RG]=r.RG8_SNORM,i[R.RED]=r.R8_SNORM,i[R.RGBA_INTEGER]=r.RGBA8I,i[R.RGB_INTEGER]=r.RGB8I,i[R.RG_INTEGER]=r.RG8I,i[R.RED_INTEGER]=r.R8I,i),e[L.UNSIGNED_SHORT]=(n={},n[R.RGBA_INTEGER]=r.RGBA16UI,n[R.RGB_INTEGER]=r.RGB16UI,n[R.RG_INTEGER]=r.RG16UI,n[R.RED_INTEGER]=r.R16UI,n[R.DEPTH_COMPONENT]=r.DEPTH_COMPONENT16,n),e[L.SHORT]=(s={},s[R.RGBA_INTEGER]=r.RGBA16I,s[R.RGB_INTEGER]=r.RGB16I,s[R.RG_INTEGER]=r.RG16I,s[R.RED_INTEGER]=r.R16I,s),e[L.UNSIGNED_INT]=(a={},a[R.RGBA_INTEGER]=r.RGBA32UI,a[R.RGB_INTEGER]=r.RGB32UI,a[R.RG_INTEGER]=r.RG32UI,a[R.RED_INTEGER]=r.R32UI,a[R.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,a),e[L.INT]=(o={},o[R.RGBA_INTEGER]=r.RGBA32I,o[R.RGB_INTEGER]=r.RGB32I,o[R.RG_INTEGER]=r.RG32I,o[R.RED_INTEGER]=r.R32I,o),e[L.FLOAT]=(h={},h[R.RGBA]=r.RGBA32F,h[R.RGB]=r.RGB32F,h[R.RG]=r.RG32F,h[R.RED]=r.R32F,h[R.DEPTH_COMPONENT]=r.DEPTH_COMPONENT32F,h),e[L.HALF_FLOAT]=(u={},u[R.RGBA]=r.RGBA16F,u[R.RGB]=r.RGB16F,u[R.RG]=r.RG16F,u[R.RED]=r.R16F,u),e[L.UNSIGNED_SHORT_5_6_5]=(l={},l[R.RGB]=r.RGB565,l),e[L.UNSIGNED_SHORT_4_4_4_4]=(f={},f[R.RGBA]=r.RGBA4,f),e[L.UNSIGNED_SHORT_5_5_5_1]=(c={},c[R.RGBA]=r.RGB5_A1,c),e[L.UNSIGNED_INT_2_10_10_10_REV]=(d={},d[R.RGBA]=r.RGB10_A2,d[R.RGBA_INTEGER]=r.RGB10_A2UI,d),e[L.UNSIGNED_INT_10F_11F_11F_REV]=(p={},p[R.RGB]=r.R11F_G11F_B10F,p),e[L.UNSIGNED_INT_5_9_9_9_REV]=(v={},v[R.RGB]=r.RGB9_E5,v),e[L.UNSIGNED_INT_24_8]=(_={},_[R.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,_),e[L.FLOAT_32_UNSIGNED_INT_24_8_REV]=(m={},m[R.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,m),e):w=(g={},g[L.UNSIGNED_BYTE]=(y={},y[R.RGBA]=r.RGBA,y[R.RGB]=r.RGB,y[R.ALPHA]=r.ALPHA,y[R.LUMINANCE]=r.LUMINANCE,y[R.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,y),g[L.UNSIGNED_SHORT_5_6_5]=(b={},b[R.RGB]=r.RGB,b),g[L.UNSIGNED_SHORT_4_4_4_4]=(x={},x[R.RGBA]=r.RGBA,x),g[L.UNSIGNED_SHORT_5_5_5_1]=(T={},T[R.RGBA]=r.RGBA,T),g),w}var qr=function(){function r(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=L.UNSIGNED_BYTE,this.internalFormat=R.RGBA,this.samplerType=0}return r}(),Fc=function(){function r(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new V,this.hasIntegerTextures=!1}return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Dc(e);var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var i=0;i<t;i++)this.boundTextures[i]=null;this.emptyTextures={};var n=new qr(e.createTexture());e.bindTexture(e.TEXTURE_2D,n.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=n,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new qr(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(var i=0;i<6;i++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(var i=0;i<this.boundTextures.length;i++)this.bind(null,i)},r.prototype.bind=function(e,t){t===void 0&&(t=0);var i=this.gl;if(e=e==null?void 0:e.castToBaseTexture(),e&&e.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;var n=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,n.texture)),n.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):n.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null},r.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture},r.prototype.unbind=function(e){var t=this,i=t.gl,n=t.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var s=0;s<n.length;s++)n[s]===this.unknownTexture&&this.bind(null,s)}for(var s=0;s<n.length;s++)n[s]===e&&(this.currentLocation!==s&&(i.activeTexture(i.TEXTURE0+s),this.currentLocation=s),i.bindTexture(e.target,this.emptyTextures[e.target].texture),n[s]=null)},r.prototype.ensureSamplerType=function(e){var t=this,i=t.boundTextures,n=t.hasIntegerTextures,s=t.CONTEXT_UID;if(n)for(var a=e-1;a>=0;--a){var o=i[a];if(o){var h=o._glTextures[s];h.samplerType!==Ti.FLOAT&&this.renderer.texture.unbind(o)}}},r.prototype.initTexture=function(e){var t=new qr(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},r.prototype.initTextureType=function(e,t){var i,n;t.internalFormat=(n=(i=this.internalFormats[e.type])===null||i===void 0?void 0:i[e.format])!==null&&n!==void 0?n:e.format,this.webGLVersion===2&&e.type===L.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type},r.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var i=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(i,e,t))t.samplerType!==Ti.FLOAT&&(this.hasIntegerTextures=!0);else{var n=e.realWidth,s=e.realHeight,a=i.gl;(t.width!==n||t.height!==s||t.dirtyId<0)&&(t.width=n,t.height=s,a.texImage2D(e.target,0,t.internalFormat,n,s,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},r.prototype.destroyTexture=function(e,t){var i=this.gl;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var n=this.managedTextures.indexOf(e);n!==-1&&Le(this.managedTextures,n,1)}},r.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Ft.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=zt.CLAMP:t.wrapMode=e.wrapMode,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,t){var i=this.gl;if(t.mipmap&&e.mipmap!==Ft.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===jt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===jt.LINEAR){var s=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===jt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===jt.LINEAR?i.LINEAR:i.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),$r=new gt,Nc=function(r){it(e,r);function e(t,i){t===void 0&&(t=Ye.UNKNOWN);var n=r.call(this)||this;return i=Object.assign({},F.RENDER_OPTIONS,i),n.options=i,n.type=t,n.screen=new j(0,0,i.width,i.height),n.view=i.view||F.ADAPTER.createCanvas(),n.resolution=i.resolution||F.RESOLUTION,n.useContextAlpha=i.useContextAlpha,n.autoDensity=!!i.autoDensity,n.preserveDrawingBuffer=i.preserveDrawingBuffer,n.clearBeforeRender=i.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,1],n._backgroundColorString="#000000",n.backgroundColor=i.backgroundColor||n._backgroundColor,n.backgroundAlpha=i.backgroundAlpha,i.transparent!==void 0&&(Ut("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),n.useContextAlpha=i.transparent,n.backgroundAlpha=i.transparent?0:1),n._lastObjectRendered=null,n.plugins={},n}return e.prototype.initPlugins=function(t){for(var i in t)this.plugins[i]=new t[i](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,i){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(i*this.resolution);var n=this.view.width/this.resolution,s=this.view.height/this.resolution;this.screen.width=n,this.screen.height=s,this.autoDensity&&(this.view.style.width=n+"px",this.view.style.height=s+"px"),this.emit("resize",n,s)},e.prototype.generateTexture=function(t,i,n,s){i===void 0&&(i={}),typeof i=="number"&&(Ut("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),i={scaleMode:i,resolution:n,region:s});var a=i.region,o=mf(i,["region"]);s=a||t.getLocalBounds(null,!0),s.width===0&&(s.width=1),s.height===0&&(s.height=1);var h=Te.create(Br({width:s.width,height:s.height},o));return $r.tx=-s.x,$r.ty=-s.y,this.render(t,{renderTexture:h,clear:!1,transform:$r,skipUpdateTransform:!!t.parent}),h},e.prototype.destroy=function(t){for(var i in this.plugins)this.plugins[i].destroy(),this.plugins[i]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var n=this;n.plugins=null,n.type=Ye.UNKNOWN,n.view=null,n.screen=null,n._tempDisplayObjectParent=null,n.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=_s(t),Be(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(Ve),Bc=function(){function r(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),Lc=function(){function r(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}return r.prototype.destroy=function(){this.renderer=null},r.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},r.prototype.bind=function(e){var t=this,i=t.gl,n=t.CONTEXT_UID,s=e._glBuffers[n]||this.createGLBuffer(e);i.bindBuffer(e.type,s.buffer)},r.prototype.bindBufferBase=function(e,t){var i=this,n=i.gl,s=i.CONTEXT_UID;if(this.boundBufferBases[t]!==e){var a=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,n.bindBufferBase(n.UNIFORM_BUFFER,t,a.buffer)}},r.prototype.bindBufferRange=function(e,t,i){var n=this,s=n.gl,a=n.CONTEXT_UID;i=i||0;var o=e._glBuffers[a]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,o.buffer,i*256,256)},r.prototype.update=function(e){var t=this,i=t.gl,n=t.CONTEXT_UID,s=e._glBuffers[n];if(e._updateID!==s.updateID)if(s.updateID=e._updateID,i.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)i.bufferSubData(e.type,0,e.data);else{var a=e.static?i.STATIC_DRAW:i.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,i.bufferData(e.type,e.data,a)}},r.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var i=e._glBuffers[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this),i&&(t||n.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}},r.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),i=0;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)},r.prototype.createGLBuffer=function(e){var t=this,i=t.CONTEXT_UID,n=t.gl;return e._glBuffers[i]=new Bc(n.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[i]},r}(),Qs=function(r){it(e,r);function e(t){var i=r.call(this,Ye.WEBGL,t)||this;return t=i.options,i.gl=null,i.CONTEXT_UID=0,i.runners={destroy:new Et("destroy"),contextChange:new Et("contextChange"),reset:new Et("reset"),update:new Et("update"),postrender:new Et("postrender"),prerender:new Et("prerender"),resize:new Et("resize")},i.runners.contextChange.add(i),i.globalUniforms=new we({projectionMatrix:new gt},!0),i.addSystem(hc,"mask").addSystem(Lf,"context").addSystem(Oc,"state").addSystem(wc,"shader").addSystem(Fc,"texture").addSystem(Lc,"buffer").addSystem(Hf,"geometry").addSystem(kf,"framebuffer").addSystem(uc,"scissor").addSystem(lc,"stencil").addSystem(fc,"projection").addSystem(Mc,"textureGC").addSystem(Nf,"filter").addSystem(cc,"renderTexture").addSystem(Bf,"batch"),i.initPlugins(e.__plugins),i.multisample=void 0,t.context?i.context.initFromContext(t.context):i.context.initFromOptions({alpha:!!i.useContextAlpha,antialias:t.antialias,premultipliedAlpha:i.useContextAlpha&&i.useContextAlpha!=="notMultiplied",stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:i.options.powerPreference}),i.renderingToScreen=!0,yh(i.context.webGLVersion===2?"WebGL 2":"WebGL 1"),i.resize(i.options.width,i.options.height),i}return e.create=function(t){if(xh())return new e(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},e.prototype.contextChange=function(){var t=this.gl,i;if(this.context.webGLVersion===1){var n=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),i=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,n)}else{var n=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),i=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,n)}i>=ft.HIGH?this.multisample=ft.HIGH:i>=ft.MEDIUM?this.multisample=ft.MEDIUM:i>=ft.LOW?this.multisample=ft.LOW:this.multisample=ft.NONE},e.prototype.addSystem=function(t,i){var n=new t(this);if(this[i])throw new Error('Whoops! The name "'+i+'" is already in use');this[i]=n;for(var s in this.runners)this.runners[s].add(n);return this},e.prototype.render=function(t,i){var n,s,a,o;if(i&&(i instanceof Te?(Ut("6.0.0","Renderer#render arguments changed, use options instead."),n=i,s=arguments[2],a=arguments[3],o=arguments[4]):(n=i.renderTexture,s=i.clear,a=i.transform,o=i.skipUpdateTransform)),this.renderingToScreen=!n,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=a,!this.context.isLost){if(n||(this._lastObjectRendered=t),!o){var h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}this.renderTexture.bind(n),this.batch.currentRenderer.start(),(s!==void 0?s:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),n&&n.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(t,i,n,s){i===void 0&&(i={});var a=r.prototype.generateTexture.call(this,t,i,n,s);return this.framebuffer.blit(),a},e.prototype.resize=function(t,i){r.prototype.resize.call(this,t,i),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(t){this.runners.destroy.emit();for(var i in this.runners)this.runners[i].destroy();r.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return Ut("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,i){Ut("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),ee.add({name:t,type:tt.RendererPlugin,ref:i})},e.__plugins={},e}(Nc);ee.handleByMap(tt.RendererPlugin,Qs.__plugins);function Uc(r){return Qs.create(r)}var Gc=`attribute vec2 aVertexPosition;
416
416
  attribute vec2 aTextureCoord;
417
417
 
418
418
  uniform mat3 projectionMatrix;
@@ -423,7 +423,7 @@ void main(void)
423
423
  {
424
424
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
425
425
  vTextureCoord = aTextureCoord;
426
- }`,Lc=`attribute vec2 aVertexPosition;
426
+ }`,kc=`attribute vec2 aVertexPosition;
427
427
 
428
428
  uniform mat3 projectionMatrix;
429
429
 
@@ -449,7 +449,7 @@ void main(void)
449
449
  gl_Position = filterVertexPosition();
450
450
  vTextureCoord = filterTextureCoord();
451
451
  }
452
- `,Uc=Bc,Qs=Lc,Vr=function(){function r(){this.texArray=null,this.blend=0,this.type=Ot.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),qr=function(){function r(){this.elements=[],this.ids=[],this.count=0}return r.prototype.clear=function(){for(var e=0;e<this.count;e++)this.elements[e]=null;this.count=0},r}(),$r=function(){function r(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(r.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),r.prototype.view=function(e){return this[e+"View"]},r.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},r.sizeOf=function(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(e+" isn't a valid view type")}},r}(),Gc=function(r){rt(e,r);function e(t){var i=r.call(this,t)||this;return i.shaderGenerator=null,i.geometryClass=null,i.vertexSize=null,i.state=Te.for2d(),i.size=F.SPRITE_BATCH_SIZE*4,i._vertexCount=0,i._indexCount=0,i._bufferedElements=[],i._bufferedTextures=[],i._bufferSize=0,i._shader=null,i._packedGeometries=[],i._packedGeometryPoolSize=2,i._flushId=0,i._aBuffers={},i._iBuffers={},i.MAX_TEXTURES=1,i.renderer.on("prerender",i.onPrerender,i),t.runners.contextChange.add(i),i._dcIndex=0,i._aIndex=0,i._iIndex=0,i._attributeBuffer=null,i._indexBuffer=null,i._tempBoundTextures=[],i}return e.prototype.contextChange=function(){var t=this.renderer.gl;F.PREFER_ENV===Zt.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),F.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=$f(this.MAX_TEXTURES,t)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]=new this.geometryClass;this.initFlushBuffers()},e.prototype.initFlushBuffers=function(){for(var t=e._drawCallPool,i=e._textureArrayPool,n=this.size/4,s=Math.floor(n/this.MAX_TEXTURES)+1;t.length<n;)t.push(new Vr);for(;i.length<s;)i.push(new qr);for(var a=0;a<this.MAX_TEXTURES;a++)this._tempBoundTextures[a]=null},e.prototype.onPrerender=function(){this._flushId=0},e.prototype.render=function(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this,i=t._bufferedTextures,n=t.MAX_TEXTURES,s=e._textureArrayPool,a=this.renderer.batch,o=this._tempBoundTextures,h=this.renderer.textureGC.count,u=++Y._globalBatch,l=0,f=s[0],c=0;a.copyBoundTextures(o,n);for(var d=0;d<this._bufferSize;++d){var p=i[d];i[d]=null,p._batchEnabled!==u&&(f.count>=n&&(a.boundArray(f,o,u,n),this.buildDrawCalls(f,c,d),c=d,f=s[++l],++u),p._batchEnabled=u,p.touched=h,f.elements[f.count++]=p)}f.count>0&&(a.boundArray(f,o,u,n),this.buildDrawCalls(f,c,this._bufferSize),++l,++u);for(var d=0;d<o.length;d++)o[d]=null;Y._globalBatch=u},e.prototype.buildDrawCalls=function(t,i,n){var s=this,a=s._bufferedElements,o=s._attributeBuffer,h=s._indexBuffer,u=s.vertexSize,l=e._drawCallPool,f=this._dcIndex,c=this._aIndex,d=this._iIndex,p=l[f];p.start=this._iIndex,p.texArray=t;for(var v=i;v<n;++v){var _=a[v],m=_._texture.baseTexture,y=ms[m.alphaMode?1:0][_.blendMode];a[v]=null,i<v&&p.blend!==y&&(p.size=d-p.start,i=v,p=l[++f],p.texArray=t,p.start=d),this.packInterleavedGeometry(_,o,h,c,d),c+=_.vertexData.length/2*u,d+=_.indices.length,p.blend=y}i<n&&(p.size=d-p.start,++f),this._dcIndex=f,this._aIndex=c,this._iIndex=d},e.prototype.bindAndClearTexArray=function(t){for(var i=this.renderer.texture,n=0;n<t.count;n++)i.bind(t.elements[n],t.ids[n]),t.elements[n]=null;t.count=0},e.prototype.updateGeometry=function(){var t=this,i=t._packedGeometries,n=t._attributeBuffer,s=t._indexBuffer;F.CAN_UPLOAD_SAME_BUFFER?(i[this._flushId]._buffer.update(n.rawBinaryData),i[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,i[this._flushId]=new this.geometryClass),i[this._flushId]._buffer.update(n.rawBinaryData),i[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(i[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},e.prototype.drawBatches=function(){for(var t=this._dcIndex,i=this.renderer,n=i.gl,s=i.state,a=e._drawCallPool,o=null,h=0;h<t;h++){var u=a[h],l=u.texArray,f=u.type,c=u.size,d=u.start,p=u.blend;o!==l&&(o=l,this.bindAndClearTexArray(l)),this.state.blendMode=p,s.set(this.state),n.drawElements(f,c,n.UNSIGNED_SHORT,d*2)}},e.prototype.flush=function(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},e.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),F.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},e.prototype.stop=function(){this.flush()},e.prototype.destroy=function(){for(var t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),r.prototype.destroy.call(this)},e.prototype.getAttributeBuffer=function(t){var i=Ai(Math.ceil(t/8)),n=Ts(i),s=i*8;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._aBuffers[s];return a||(this._aBuffers[s]=a=new $r(s*this.vertexSize*4)),a},e.prototype.getIndexBuffer=function(t){var i=Ai(Math.ceil(t/12)),n=Ts(i),s=i*12;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._iBuffers[n];return a||(this._iBuffers[n]=a=new Uint16Array(s)),a},e.prototype.packInterleavedGeometry=function(t,i,n,s,a){for(var o=i.uint32View,h=i.float32View,u=s/this.vertexSize,l=t.uvs,f=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),v=p<1&&t._texture.baseTexture.alphaMode?Cr(t._tintRGB,p):t._tintRGB+(p*255<<24),_=0;_<c.length;_+=2)h[s++]=c[_],h[s++]=c[_+1],h[s++]=l[_],h[s++]=l[_+1],o[s++]=v,h[s++]=d;for(var _=0;_<f.length;_++)n[a++]=u+f[_]},e._drawCallPool=[],e._textureArrayPool=[],e}(Ni),kc=function(){function r(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},t.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(t.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return r.prototype.generateShader=function(e){if(!this.programCache[e]){for(var t=new Int32Array(e),i=0;i<e;i++)t[i]=i;this.defaultGroupCache[e]=be.from({uSamplers:t},!0);var n=this.fragTemplate;n=n.replace(/%count%/gi,""+e),n=n.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new ri(this.vertexSrc,n)}var s={tint:new Float32Array([1,1,1,1]),translationMatrix:new gt,default:this.defaultGroupCache[e]};return new se(this.programCache[e],s)},r.prototype.generateSampleSrc=function(e){var t="";t+=`
452
+ `,Hc=Gc,Js=kc,Zr=function(){function r(){this.texArray=null,this.blend=0,this.type=Dt.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),Kr=function(){function r(){this.elements=[],this.ids=[],this.count=0}return r.prototype.clear=function(){for(var e=0;e<this.count;e++)this.elements[e]=null;this.count=0},r}(),Qr=function(){function r(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(r.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),r.prototype.view=function(e){return this[e+"View"]},r.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},r.sizeOf=function(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(e+" isn't a valid view type")}},r}(),Xc=function(r){it(e,r);function e(t){var i=r.call(this,t)||this;return i.shaderGenerator=null,i.geometryClass=null,i.vertexSize=null,i.state=Ee.for2d(),i.size=F.SPRITE_BATCH_SIZE*4,i._vertexCount=0,i._indexCount=0,i._bufferedElements=[],i._bufferedTextures=[],i._bufferSize=0,i._shader=null,i._packedGeometries=[],i._packedGeometryPoolSize=2,i._flushId=0,i._aBuffers={},i._iBuffers={},i.MAX_TEXTURES=1,i.renderer.on("prerender",i.onPrerender,i),t.runners.contextChange.add(i),i._dcIndex=0,i._aIndex=0,i._iIndex=0,i._attributeBuffer=null,i._indexBuffer=null,i._tempBoundTextures=[],i}return e.prototype.contextChange=function(){var t=this.renderer.gl;F.PREFER_ENV===Qt.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),F.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=Qf(this.MAX_TEXTURES,t)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]=new this.geometryClass;this.initFlushBuffers()},e.prototype.initFlushBuffers=function(){for(var t=e._drawCallPool,i=e._textureArrayPool,n=this.size/4,s=Math.floor(n/this.MAX_TEXTURES)+1;t.length<n;)t.push(new Zr);for(;i.length<s;)i.push(new Kr);for(var a=0;a<this.MAX_TEXTURES;a++)this._tempBoundTextures[a]=null},e.prototype.onPrerender=function(){this._flushId=0},e.prototype.render=function(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this,i=t._bufferedTextures,n=t.MAX_TEXTURES,s=e._textureArrayPool,a=this.renderer.batch,o=this._tempBoundTextures,h=this.renderer.textureGC.count,u=++V._globalBatch,l=0,f=s[0],c=0;a.copyBoundTextures(o,n);for(var d=0;d<this._bufferSize;++d){var p=i[d];i[d]=null,p._batchEnabled!==u&&(f.count>=n&&(a.boundArray(f,o,u,n),this.buildDrawCalls(f,c,d),c=d,f=s[++l],++u),p._batchEnabled=u,p.touched=h,f.elements[f.count++]=p)}f.count>0&&(a.boundArray(f,o,u,n),this.buildDrawCalls(f,c,this._bufferSize),++l,++u);for(var d=0;d<o.length;d++)o[d]=null;V._globalBatch=u},e.prototype.buildDrawCalls=function(t,i,n){var s=this,a=s._bufferedElements,o=s._attributeBuffer,h=s._indexBuffer,u=s.vertexSize,l=e._drawCallPool,f=this._dcIndex,c=this._aIndex,d=this._iIndex,p=l[f];p.start=this._iIndex,p.texArray=t;for(var v=i;v<n;++v){var _=a[v],m=_._texture.baseTexture,g=gs[m.alphaMode?1:0][_.blendMode];a[v]=null,i<v&&p.blend!==g&&(p.size=d-p.start,i=v,p=l[++f],p.texArray=t,p.start=d),this.packInterleavedGeometry(_,o,h,c,d),c+=_.vertexData.length/2*u,d+=_.indices.length,p.blend=g}i<n&&(p.size=d-p.start,++f),this._dcIndex=f,this._aIndex=c,this._iIndex=d},e.prototype.bindAndClearTexArray=function(t){for(var i=this.renderer.texture,n=0;n<t.count;n++)i.bind(t.elements[n],t.ids[n]),t.elements[n]=null;t.count=0},e.prototype.updateGeometry=function(){var t=this,i=t._packedGeometries,n=t._attributeBuffer,s=t._indexBuffer;F.CAN_UPLOAD_SAME_BUFFER?(i[this._flushId]._buffer.update(n.rawBinaryData),i[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,i[this._flushId]=new this.geometryClass),i[this._flushId]._buffer.update(n.rawBinaryData),i[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(i[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},e.prototype.drawBatches=function(){for(var t=this._dcIndex,i=this.renderer,n=i.gl,s=i.state,a=e._drawCallPool,o=null,h=0;h<t;h++){var u=a[h],l=u.texArray,f=u.type,c=u.size,d=u.start,p=u.blend;o!==l&&(o=l,this.bindAndClearTexArray(l)),this.state.blendMode=p,s.set(this.state),n.drawElements(f,c,n.UNSIGNED_SHORT,d*2)}},e.prototype.flush=function(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},e.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),F.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},e.prototype.stop=function(){this.flush()},e.prototype.destroy=function(){for(var t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),r.prototype.destroy.call(this)},e.prototype.getAttributeBuffer=function(t){var i=Oi(Math.ceil(t/8)),n=ws(i),s=i*8;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._aBuffers[s];return a||(this._aBuffers[s]=a=new Qr(s*this.vertexSize*4)),a},e.prototype.getIndexBuffer=function(t){var i=Oi(Math.ceil(t/12)),n=ws(i),s=i*12;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._iBuffers[n];return a||(this._iBuffers[n]=a=new Uint16Array(s)),a},e.prototype.packInterleavedGeometry=function(t,i,n,s,a){for(var o=i.uint32View,h=i.float32View,u=s/this.vertexSize,l=t.uvs,f=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),v=p<1&&t._texture.baseTexture.alphaMode?Ir(t._tintRGB,p):t._tintRGB+(p*255<<24),_=0;_<c.length;_+=2)h[s++]=c[_],h[s++]=c[_+1],h[s++]=l[_],h[s++]=l[_+1],o[s++]=v,h[s++]=d;for(var _=0;_<f.length;_++)n[a++]=u+f[_]},e._drawCallPool=[],e._textureArrayPool=[],e}(Li),Wc=function(){function r(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},t.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(t.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return r.prototype.generateShader=function(e){if(!this.programCache[e]){for(var t=new Int32Array(e),i=0;i<e;i++)t[i]=i;this.defaultGroupCache[e]=we.from({uSamplers:t},!0);var n=this.fragTemplate;n=n.replace(/%count%/gi,""+e),n=n.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new si(this.vertexSrc,n)}var s={tint:new Float32Array([1,1,1,1]),translationMatrix:new gt,default:this.defaultGroupCache[e]};return new ae(this.programCache[e],s)},r.prototype.generateSampleSrc=function(e){var t="";t+=`
453
453
  `,t+=`
454
454
  `;for(var i=0;i<e;i++)i>0&&(t+=`
455
455
  else `),i<e-1&&(t+="if(vTextureId < "+i+".5)"),t+=`
@@ -457,7 +457,7 @@ else `),i<e-1&&(t+="if(vTextureId < "+i+".5)"),t+=`
457
457
  color = texture2D(uSamplers[`+i+"], vTextureCoord);",t+=`
458
458
  }`;return t+=`
459
459
  `,t+=`
460
- `,t},r}(),Js=function(r){rt(e,r);function e(t){t===void 0&&(t=!1);var i=r.call(this)||this;return i._buffer=new yt(null,t,!1),i._indexBuffer=new yt(null,t,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,L.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,L.FLOAT).addAttribute("aColor",i._buffer,4,!0,L.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,L.FLOAT).addIndex(i._indexBuffer),i}return e}(ti),ta=`precision highp float;
460
+ `,t},r}(),ta=function(r){it(e,r);function e(t){t===void 0&&(t=!1);var i=r.call(this)||this;return i._buffer=new yt(null,t,!1),i._indexBuffer=new yt(null,t,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,L.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,L.FLOAT).addAttribute("aColor",i._buffer,4,!0,L.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,L.FLOAT).addIndex(i._indexBuffer),i}return e}(ii),ea=`precision highp float;
461
461
  attribute vec2 aVertexPosition;
462
462
  attribute vec2 aTextureCoord;
463
463
  attribute vec4 aColor;
@@ -478,7 +478,7 @@ void main(void){
478
478
  vTextureId = aTextureId;
479
479
  vColor = aColor * tint;
480
480
  }
481
- `,ea=`varying vec2 vTextureCoord;
481
+ `,ia=`varying vec2 vTextureCoord;
482
482
  varying vec4 vColor;
483
483
  varying float vTextureId;
484
484
  uniform sampler2D uSamplers[%count%];
@@ -488,7 +488,7 @@ void main(void){
488
488
  %forloop%
489
489
  gl_FragColor = color * vColor;
490
490
  }
491
- `,Hc=function(){function r(){}return r.create=function(e){var t=Object.assign({vertex:ta,fragment:ea,geometryClass:Js,vertexSize:6},e),i=t.vertex,n=t.fragment,s=t.vertexSize,a=t.geometryClass;return function(o){rt(h,o);function h(u){var l=o.call(this,u)||this;return l.shaderGenerator=new kc(i,n),l.geometryClass=a,l.vertexSize=s,l}return h}(Gc)},Object.defineProperty(r,"defaultVertexSrc",{get:function(){return ta},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentTemplate",{get:function(){return ea},enumerable:!1,configurable:!0}),r}(),ia=Hc.create();Object.assign(ia,{extension:{name:"batch",type:J.RendererPlugin}});var Xc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};pt.mixin(Xc);var Wc=9,ki=100,zc=0,jc=0,ra=2,na=1,Yc=-1e3,Vc=-1e3,qc=2,$c=function(){function r(e){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Yt.tablet||Yt.phone)&&this.createTouchHook();var t=document.createElement("div");t.style.width=ki+"px",t.style.height=ki+"px",t.style.position="absolute",t.style.top=zc+"px",t.style.left=jc+"px",t.style.zIndex=ra.toString(),this.div=t,this.renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(r.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),r.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width=na+"px",t.style.height=na+"px",t.style.position="absolute",t.style.top=Yc+"px",t.style.left=Vc+"px",t.style.zIndex=qc.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},r.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},r.prototype.activate=function(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(e=this.renderer.view.parentNode)===null||e===void 0||e.appendChild(this.div))},r.prototype.deactivate=function(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(e=this.div.parentNode)===null||e===void 0||e.removeChild(this.div))},r.prototype.updateAccessibleObjects=function(e){if(!(!e.visible||!e.accessibleChildren)){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);var t=e.children;if(t)for(var i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},r.prototype.update=function(){var e=performance.now();if(!(Yt.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,!!this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var t=this.renderer.view.getBoundingClientRect(),i=t.left,n=t.top,s=t.width,a=t.height,o=this.renderer,h=o.width,u=o.height,l=o.resolution,f=s/h*l,c=a/u*l,d=this.div;d.style.left=i+"px",d.style.top=n+"px",d.style.width=h+"px",d.style.height=u+"px";for(var p=0;p<this.children.length;p++){var v=this.children[p];if(v.renderId!==this.renderId)v._accessibleActive=!1,Ne(this.children,p,1),this.div.removeChild(v._accessibleDiv),this.pool.push(v._accessibleDiv),v._accessibleDiv=null,p--;else{d=v._accessibleDiv;var _=v.hitArea,m=v.worldTransform;v.hitArea?(d.style.left=(m.tx+_.x*m.a)*f+"px",d.style.top=(m.ty+_.y*m.d)*c+"px",d.style.width=_.width*m.a*f+"px",d.style.height=_.height*m.d*c+"px"):(_=v.getBounds(),this.capHitArea(_),d.style.left=_.x*f+"px",d.style.top=_.y*c+"px",d.style.width=_.width*f+"px",d.style.height=_.height*c+"px",d.title!==v.accessibleTitle&&v.accessibleTitle!==null&&(d.title=v.accessibleTitle),d.getAttribute("aria-label")!==v.accessibleHint&&v.accessibleHint!==null&&d.setAttribute("aria-label",v.accessibleHint)),(v.accessibleTitle!==d.title||v.tabIndex!==d.tabIndex)&&(d.title=v.accessibleTitle,d.tabIndex=v.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}},r.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},r.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);var t=this.renderer,i=t.width,n=t.height;e.x+e.width>i&&(e.width=i-e.x),e.y+e.height>n&&(e.height=n-e.y)},r.prototype.addChild=function(e){var t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=ki+"px",t.style.height=ki+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=ra.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title="displayObject "+e.tabIndex),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},r.prototype._onClick=function(e){var t=this.renderer.plugins.interaction,i=e.target.displayObject,n=t.eventData;t.dispatchEvent(i,"click",n),t.dispatchEvent(i,"pointertap",n),t.dispatchEvent(i,"tap",n)},r.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction,i=e.target.displayObject,n=t.eventData;t.dispatchEvent(i,"mouseover",n)},r.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction,i=e.target.displayObject,n=t.eventData;t.dispatchEvent(i,"mouseout",n)},r.prototype._onKeyDown=function(e){e.keyCode===Wc&&this.activate()},r.prototype._onMouseMove=function(e){e.movementX===0&&e.movementY===0||this.deactivate()},r.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},r.extension={name:"accessibility",type:[J.RendererPlugin,J.CanvasRendererPlugin]},r}();var sa=function(){function r(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new W,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(r.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),r.prototype.getLocalPosition=function(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)},r.prototype.copyEvent=function(e){"isPrimary"in e&&e.isPrimary&&(this.isPrimary=!0),this.button="button"in e&&e.button;var t="buttons"in e&&e.buttons;this.buttons=Number.isInteger(t)?t:"which"in e&&e.which,this.width="width"in e&&e.width,this.height="height"in e&&e.height,this.tiltX="tiltX"in e&&e.tiltX,this.tiltY="tiltY"in e&&e.tiltY,this.pointerType="pointerType"in e&&e.pointerType,this.pressure="pressure"in e&&e.pressure,this.rotationAngle="rotationAngle"in e&&e.rotationAngle,this.twist="twist"in e&&e.twist||0,this.tangentialPressure="tangentialPressure"in e&&e.tangentialPressure||0},r.prototype.reset=function(){this.isPrimary=!1},r}();var Zr=function(r,e){return Zr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Zr(r,e)};function Zc(r,e){Zr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Kc=function(){function r(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return r.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},r.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},r}(),Kr=function(){function r(e){this._pointerId=e,this._flags=r.FLAGS.NONE}return r.prototype._doSet=function(e,t){t?this._flags=this._flags|e:this._flags=this._flags&~e},Object.defineProperty(r.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"flags",{get:function(){return this._flags},set:function(e){this._flags=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"none",{get:function(){return this._flags===r.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"over",{get:function(){return(this._flags&r.FLAGS.OVER)!==0},set:function(e){this._doSet(r.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rightDown",{get:function(){return(this._flags&r.FLAGS.RIGHT_DOWN)!==0},set:function(e){this._doSet(r.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leftDown",{get:function(){return(this._flags&r.FLAGS.LEFT_DOWN)!==0},set:function(e){this._doSet(r.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),r.FLAGS=Object.freeze({NONE:0,OVER:1<<0,LEFT_DOWN:1<<1,RIGHT_DOWN:1<<2}),r}(),Qc=function(){function r(){this._tempPoint=new W}return r.prototype.recursiveFindHit=function(e,t,i,n,s){var a;if(!t||!t.visible)return!1;var o=e.data.global;s=t.interactive||s;var h=!1,u=s,l=!0;if(t.hitArea)n&&(t.worldTransform.applyInverse(o,this._tempPoint),t.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?h=!0:(n=!1,l=!1)),u=!1;else if(t._mask&&n){var f=t._mask.isMaskData?t._mask.maskObject:t._mask;f&&!(!((a=f.containsPoint)===null||a===void 0)&&a.call(f,o))&&(n=!1)}if(l&&t.interactiveChildren&&t.children)for(var c=t.children,d=c.length-1;d>=0;d--){var p=c[d],v=this.recursiveFindHit(e,p,i,n,u);if(v){if(!p.parent)continue;u=!1,v&&(e.target&&(n=!1),h=!0)}}return s&&(n&&!e.target&&!t.hitArea&&t.containsPoint&&t.containsPoint(o)&&(h=!0),t.interactive&&(h&&!e.target&&(e.target=t),i&&i(e,t,!!h))),h},r.prototype.findHit=function(e,t,i,n){this.recursiveFindHit(e,t,i,n,!1)},r}(),Jc={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return this.cursor==="pointer"},set buttonMode(r){r?this.cursor="pointer":this.cursor==="pointer"&&(this.cursor=null)},cursor:null,get trackedPointers(){return this._trackedPointers===void 0&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};pt.mixin(Jc);var Hi=1,Xi={target:null,data:{global:null}},td=function(r){Zc(e,r);function e(t,i){var n=r.call(this)||this;return i=i||{},n.renderer=t,n.autoPreventDefault=i.autoPreventDefault!==void 0?i.autoPreventDefault:!0,n.interactionFrequency=i.interactionFrequency||10,n.mouse=new sa,n.mouse.identifier=Hi,n.mouse.global.set(-999999),n.activeInteractionData={},n.activeInteractionData[Hi]=n.mouse,n.interactionDataPool=[],n.eventData=new Kc,n.interactionDOMElement=null,n.moveWhenInside=!1,n.eventsAdded=!1,n.tickerAdded=!1,n.mouseOverRenderer=!("PointerEvent"in globalThis),n.supportsTouchEvents="ontouchstart"in globalThis,n.supportsPointerEvents=!!globalThis.PointerEvent,n.onPointerUp=n.onPointerUp.bind(n),n.processPointerUp=n.processPointerUp.bind(n),n.onPointerCancel=n.onPointerCancel.bind(n),n.processPointerCancel=n.processPointerCancel.bind(n),n.onPointerDown=n.onPointerDown.bind(n),n.processPointerDown=n.processPointerDown.bind(n),n.onPointerMove=n.onPointerMove.bind(n),n.processPointerMove=n.processPointerMove.bind(n),n.onPointerOut=n.onPointerOut.bind(n),n.processPointerOverOut=n.processPointerOverOut.bind(n),n.onPointerOver=n.onPointerOver.bind(n),n.cursorStyles={default:"inherit",pointer:"pointer"},n.currentCursorMode=null,n.cursor=null,n.resolution=1,n.delayedEvents=[],n.search=new Qc,n._tempDisplayObject=new Ps,n._eventListenerOptions={capture:!0,passive:!1},n._useSystemTicker=i.useSystemTicker!==void 0?i.useSystemTicker:!0,n.setTargetElement(n.renderer.view,n.renderer.resolution),n}return Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(t,i){return Xi.target=null,Xi.data.global=t,i||(i=this.lastObjectRendered),this.processInteractive(Xi,i,null,!0),Xi.target},e.prototype.setTargetElement=function(t,i){i===void 0&&(i=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=i,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){this.tickerAdded||!this.interactionDOMElement||!this._useSystemTicker||(bt.system.add(this.tickerUpdate,this,te.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(bt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!(this.eventsAdded||!this.interactionDOMElement)){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(!(!this.eventsAdded||!this.interactionDOMElement)){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement){if(this._didMove){this._didMove=!1;return}this.cursor=null;for(var t in this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(t)){var i=this.activeInteractionData[t];if(i.originalEvent&&i.pointerType!=="touch"){var n=this.configureInteractionEventForDOMEvent(this.eventData,i.originalEvent,i);this.processInteractive(n,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(t){t=t||"default";var i=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(i=!1),this.currentCursorMode!==t){this.currentCursorMode=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":i&&(this.interactionDOMElement.style.cursor=n);break;case"function":n(t);break;case"object":i&&Object.assign(this.interactionDOMElement.style,n);break}else i&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.interactionDOMElement.style.cursor=t)}},e.prototype.dispatchEvent=function(t,i,n){(!n.stopPropagationHint||t===n.stopsPropagatingAt)&&(n.currentTarget=t,n.type=i,t.emit(i,n),t[i]&&t[i](n))},e.prototype.delayDispatchEvent=function(t,i,n){this.delayedEvents.push({displayObject:t,eventString:i,eventData:n})},e.prototype.mapPositionToPoint=function(t,i,n){var s;this.interactionDOMElement.parentElement?s=this.interactionDOMElement.getBoundingClientRect():s={x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var a=1/this.resolution;t.x=(i-s.left)*(this.interactionDOMElement.width/s.width)*a,t.y=(n-s.top)*(this.interactionDOMElement.height/s.height)*a},e.prototype.processInteractive=function(t,i,n,s){var a=this.search.findHit(t,i,n,s),o=this.delayedEvents;if(!o.length)return a;t.stopPropagationHint=!1;var h=o.length;this.delayedEvents=[];for(var u=0;u<h;u++){var l=o[u],f=l.displayObject,c=l.eventString,d=l.eventData;d.stopsPropagatingAt===f&&(d.stopPropagationHint=!0),this.dispatchEvent(f,c,d)}return a},e.prototype.onPointerDown=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t);if(this.autoPreventDefault&&i[0].isNormalized){var n=t.cancelable||!("cancelable"in t);n&&t.preventDefault()}for(var s=i.length,a=0;a<s;a++){var o=i[a],h=this.getInteractionDataForPointerId(o),u=this.configureInteractionEventForDOMEvent(this.eventData,o,h);if(u.data.originalEvent=t,this.processInteractive(u,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",u),o.pointerType==="touch")this.emit("touchstart",u);else if(o.pointerType==="mouse"||o.pointerType==="pen"){var l=o.button===2;this.emit(l?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,i,n){var s=t.data,a=t.data.identifier;if(n){if(i.trackedPointers[a]||(i.trackedPointers[a]=new Kr(a)),this.dispatchEvent(i,"pointerdown",t),s.pointerType==="touch")this.dispatchEvent(i,"touchstart",t);else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;o?i.trackedPointers[a].rightDown=!0:i.trackedPointers[a].leftDown=!0,this.dispatchEvent(i,o?"rightdown":"mousedown",t)}}},e.prototype.onPointerComplete=function(t,i,n){var s=this.normalizeToPointerData(t),a=s.length,o=t.target;t.composedPath&&t.composedPath().length>0&&(o=t.composedPath()[0]);for(var h=o!==this.interactionDOMElement?"outside":"",u=0;u<a;u++){var l=s[u],f=this.getInteractionDataForPointerId(l),c=this.configureInteractionEventForDOMEvent(this.eventData,l,f);if(c.data.originalEvent=t,this.processInteractive(c,this.lastObjectRendered,n,i||!h),this.emit(i?"pointercancel":"pointerup"+h,c),l.pointerType==="mouse"||l.pointerType==="pen"){var d=l.button===2;this.emit(d?"rightup"+h:"mouseup"+h,c)}else l.pointerType==="touch"&&(this.emit(i?"touchcancel":"touchend"+h,c),this.releaseInteractionDataForPointerId(l.pointerId))}},e.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&t.pointerType==="touch"||this.onPointerComplete(t,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(t,i){var n=t.data,s=t.data.identifier;i.trackedPointers[s]!==void 0&&(delete i.trackedPointers[s],this.dispatchEvent(i,"pointercancel",t),n.pointerType==="touch"&&this.dispatchEvent(i,"touchcancel",t))},e.prototype.onPointerUp=function(t){this.supportsTouchEvents&&t.pointerType==="touch"||this.onPointerComplete(t,!1,this.processPointerUp)},e.prototype.processPointerUp=function(t,i,n){var s=t.data,a=t.data.identifier,o=i.trackedPointers[a],h=s.pointerType==="touch",u=s.pointerType==="mouse"||s.pointerType==="pen",l=!1;if(u){var f=s.button===2,c=Kr.FLAGS,d=f?c.RIGHT_DOWN:c.LEFT_DOWN,p=o!==void 0&&o.flags&d;n?(this.dispatchEvent(i,f?"rightup":"mouseup",t),p&&(this.dispatchEvent(i,f?"rightclick":"click",t),l=!0)):p&&this.dispatchEvent(i,f?"rightupoutside":"mouseupoutside",t),o&&(f?o.rightDown=!1:o.leftDown=!1)}n?(this.dispatchEvent(i,"pointerup",t),h&&this.dispatchEvent(i,"touchend",t),o&&((!u||l)&&this.dispatchEvent(i,"pointertap",t),h&&(this.dispatchEvent(i,"tap",t),o.over=!1))):o&&(this.dispatchEvent(i,"pointerupoutside",t),h&&this.dispatchEvent(i,"touchendoutside",t)),o&&o.none&&delete i.trackedPointers[a]},e.prototype.onPointerMove=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t);(i[0].pointerType==="mouse"||i[0].pointerType==="pen")&&(this._didMove=!0,this.cursor=null);for(var n=i.length,s=0;s<n;s++){var a=i[s],o=this.getInteractionDataForPointerId(a),h=this.configureInteractionEventForDOMEvent(this.eventData,a,o);h.data.originalEvent=t,this.processInteractive(h,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",h),a.pointerType==="touch"&&this.emit("touchmove",h),(a.pointerType==="mouse"||a.pointerType==="pen")&&this.emit("mousemove",h)}i[0].pointerType==="mouse"&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(t,i,n){var s=t.data,a=s.pointerType==="touch",o=s.pointerType==="mouse"||s.pointerType==="pen";o&&this.processPointerOverOut(t,i,n),(!this.moveWhenInside||n)&&(this.dispatchEvent(i,"pointermove",t),a&&this.dispatchEvent(i,"touchmove",t),o&&this.dispatchEvent(i,"mousemove",t))},e.prototype.onPointerOut=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t),n=i[0];n.pointerType==="mouse"&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var s=this.getInteractionDataForPointerId(n),a=this.configureInteractionEventForDOMEvent(this.eventData,n,s);a.data.originalEvent=n,this.processInteractive(a,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",a),n.pointerType==="mouse"||n.pointerType==="pen"?this.emit("mouseout",a):this.releaseInteractionDataForPointerId(s.identifier)}},e.prototype.processPointerOverOut=function(t,i,n){var s=t.data,a=t.data.identifier,o=s.pointerType==="mouse"||s.pointerType==="pen",h=i.trackedPointers[a];n&&!h&&(h=i.trackedPointers[a]=new Kr(a)),h!==void 0&&(n&&this.mouseOverRenderer?(h.over||(h.over=!0,this.delayDispatchEvent(i,"pointerover",t),o&&this.delayDispatchEvent(i,"mouseover",t)),o&&this.cursor===null&&(this.cursor=i.cursor)):h.over&&(h.over=!1,this.dispatchEvent(i,"pointerout",this.eventData),o&&this.dispatchEvent(i,"mouseout",t),h.none&&delete i.trackedPointers[a]))},e.prototype.onPointerOver=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t),n=i[0],s=this.getInteractionDataForPointerId(n),a=this.configureInteractionEventForDOMEvent(this.eventData,n,s);a.data.originalEvent=n,n.pointerType==="mouse"&&(this.mouseOverRenderer=!0),this.emit("pointerover",a),(n.pointerType==="mouse"||n.pointerType==="pen")&&this.emit("mouseover",a)}},e.prototype.getInteractionDataForPointerId=function(t){var i=t.pointerId,n;return i===Hi||t.pointerType==="mouse"?n=this.mouse:this.activeInteractionData[i]?n=this.activeInteractionData[i]:(n=this.interactionDataPool.pop()||new sa,n.identifier=i,this.activeInteractionData[i]=n),n.copyEvent(t),n},e.prototype.releaseInteractionDataForPointerId=function(t){var i=this.activeInteractionData[t];i&&(delete this.activeInteractionData[t],i.reset(),this.interactionDataPool.push(i))},e.prototype.configureInteractionEventForDOMEvent=function(t,i,n){return t.data=n,this.mapPositionToPoint(n.global,i.clientX,i.clientY),i.pointerType==="touch"&&(i.globalX=n.global.x,i.globalY=n.global.y),n.originalEvent=i,t.reset(),t},e.prototype.normalizeToPointerData=function(t){var i=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,s=t.changedTouches.length;n<s;n++){var a=t.changedTouches[n];typeof a.button>"u"&&(a.button=t.touches.length?1:0),typeof a.buttons>"u"&&(a.buttons=t.touches.length?1:0),typeof a.isPrimary>"u"&&(a.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof a.width>"u"&&(a.width=a.radiusX||1),typeof a.height>"u"&&(a.height=a.radiusY||1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="touch"),typeof a.pointerId>"u"&&(a.pointerId=a.identifier||0),typeof a.pressure>"u"&&(a.pressure=a.force||.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),typeof a.layerX>"u"&&(a.layerX=a.offsetX=a.clientX),typeof a.layerY>"u"&&(a.layerY=a.offsetY=a.clientY),a.isNormalized=!0,i.push(a)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){var o=t;typeof o.isPrimary>"u"&&(o.isPrimary=!0),typeof o.width>"u"&&(o.width=1),typeof o.height>"u"&&(o.height=1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="mouse"),typeof o.pointerId>"u"&&(o.pointerId=Hi),typeof o.pressure>"u"&&(o.pressure=.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),o.isNormalized=!0,i.push(o)}else i.push(t);return i},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e.extension={name:"interaction",type:[J.RendererPlugin,J.CanvasRendererPlugin]},e}(je);var aa=new z,oa=4,ed=function(){function r(e){this.renderer=e}return r.prototype.image=function(e,t,i){var n=new Image;return n.src=this.base64(e,t,i),n},r.prototype.base64=function(e,t,i){return this.canvas(e).toDataURL(t,i)},r.prototype.canvas=function(e,t){var i=this.renderer,n,s=!1,a,o=!1;e&&(e instanceof xe?a=e:(a=this.renderer.generateTexture(e),o=!0)),a?(n=a.baseTexture.resolution,t=t??a.frame,s=!1,i.renderTexture.bind(a)):(n=i.resolution,t||(t=aa,t.width=i.width,t.height=i.height),s=!0,i.renderTexture.bind(null));var h=Math.round(t.width*n),u=Math.round(t.height*n),l=new Ss(h,u,1),f=new Uint8Array(oa*h*u),c=i.gl;c.readPixels(Math.round(t.x*n),Math.round(t.y*n),h,u,c.RGBA,c.UNSIGNED_BYTE,f);var d=l.context.getImageData(0,0,h,u);if(r.arrayPostDivide(f,d.data),l.context.putImageData(d,0,0),s){var p=new Ss(l.width,l.height,1);p.context.scale(1,-1),p.context.drawImage(l.canvas,0,-u),l.destroy(),l=p}return o&&a.destroy(!0),l.canvas},r.prototype.pixels=function(e,t){var i=this.renderer,n,s,a=!1;e&&(e instanceof xe?s=e:(s=this.renderer.generateTexture(e),a=!0)),s?(n=s.baseTexture.resolution,t=t??s.frame,i.renderTexture.bind(s)):(n=i.resolution,t||(t=aa,t.width=i.width,t.height=i.height),i.renderTexture.bind(null));var o=Math.round(t.width*n),h=Math.round(t.height*n),u=new Uint8Array(oa*o*h),l=i.gl;return l.readPixels(Math.round(t.x*n),Math.round(t.y*n),o,h,l.RGBA,l.UNSIGNED_BYTE,u),a&&s.destroy(!0),r.arrayPostDivide(u,u),u},r.prototype.destroy=function(){this.renderer=null},r.arrayPostDivide=function(e,t){for(var i=0;i<e.length;i+=4){var n=t[i+3]=e[i+3];n!==0?(t[i]=Math.round(Math.min(e[i]*255/n,255)),t[i+1]=Math.round(Math.min(e[i+1]*255/n,255)),t[i+2]=Math.round(Math.min(e[i+2]*255/n,255))):(t[i]=e[i],t[i+1]=e[i+1],t[i+2]=e[i+2])}},r.extension={name:"extract",type:J.RendererPlugin},r}();var Wi=function(){function r(e,t,i){t===void 0&&(t=!1),this._fn=e,this._once=t,this._thisArg=i,this._next=this._prev=this._owner=null}return r.prototype.detach=function(){return this._owner===null?!1:(this._owner.detach(this),!0)},r}();function ha(r,e){return r._head?(r._tail._next=e,e._prev=r._tail,r._tail=e):(r._head=e,r._tail=e),e._owner=r,e}var ee=function(){function r(){this._head=this._tail=void 0}return r.prototype.handlers=function(e){e===void 0&&(e=!1);var t=this._head;if(e)return!!t;for(var i=[];t;)i.push(t),t=t._next;return i},r.prototype.has=function(e){if(!(e instanceof Wi))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return e._owner===this},r.prototype.dispatch=function(){for(var e=arguments,t=[],i=0;i<arguments.length;i++)t[i]=e[i];var n=this._head;if(!n)return!1;for(;n;)n._once&&this.detach(n),n._fn.apply(n._thisArg,t),n=n._next;return!0},r.prototype.add=function(e,t){if(t===void 0&&(t=null),typeof e!="function")throw new Error("MiniSignal#add(): First arg must be a Function.");return ha(this,new Wi(e,!1,t))},r.prototype.once=function(e,t){if(t===void 0&&(t=null),typeof e!="function")throw new Error("MiniSignal#once(): First arg must be a Function.");return ha(this,new Wi(e,!0,t))},r.prototype.detach=function(e){if(!(e instanceof Wi))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return e._owner!==this?this:(e._prev&&(e._prev._next=e._next),e._next&&(e._next._prev=e._prev),e===this._head?(this._head=e._next,e._next===null&&(this._tail=null)):e===this._tail&&(this._tail=e._prev,this._tail._next=null),e._owner=null,this)},r.prototype.detachAll=function(){var e=this._head;if(!e)return this;for(this._head=this._tail=null;e;)e._owner=null,e=e._next;return this},r}();function ua(r,e){e=e||{};for(var t={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},i=t.parser[e.strictMode?"strict":"loose"].exec(r),n={},s=14;s--;)n[t.key[s]]=i[s]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,function(a,o,h){o&&(n[t.q.name][o]=h)}),n}var Qr,zi=null,id=0,la=200,rd=204,nd=1223,sd=2;function fa(){}function ca(r,e,t){e&&e.indexOf(".")===0&&(e=e.substring(1)),e&&(r[e]=t)}function Jr(r){return r.toString().replace("object ","")}var dt=function(){function r(e,t,i){if(this._dequeue=fa,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=null,this._boundOnError=null,this._boundOnProgress=null,this._boundOnTimeout=null,this._boundXhrOnError=null,this._boundXhrOnTimeout=null,this._boundXhrOnAbort=null,this._boundXhrOnLoad=null,typeof e!="string"||typeof t!="string")throw new Error("Both name and url are required for constructing a resource.");i=i||{},this._flags=0,this._setFlag(r.STATUS_FLAGS.DATA_URL,t.indexOf("data:")===0),this.name=e,this.url=t,this.extension=this._getExtension(),this.data=null,this.crossOrigin=i.crossOrigin===!0?"anonymous":i.crossOrigin,this.timeout=i.timeout||0,this.loadType=i.loadType||this._determineLoadType(),this.xhrType=i.xhrType,this.metadata=i.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=r.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=fa,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new ee,this.onProgress=new ee,this.onComplete=new ee,this.onAfterMiddleware=new ee}return r.setExtensionLoadType=function(e,t){ca(r._loadTypeMap,e,t)},r.setExtensionXhrType=function(e,t){ca(r._xhrTypeMap,e,t)},Object.defineProperty(r.prototype,"isDataUrl",{get:function(){return this._hasFlag(r.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isComplete",{get:function(){return this._hasFlag(r.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isLoading",{get:function(){return this._hasFlag(r.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),r.prototype.complete=function(){this._clearEvents(),this._finish()},r.prototype.abort=function(e){if(!this.error){if(this.error=new Error(e),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=r.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},r.prototype.load=function(e){var t=this;if(!this.isLoading){if(this.isComplete){e&&setTimeout(function(){return e(t)},1);return}else e&&this.onComplete.once(e);switch(this._setFlag(r.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),(this.crossOrigin===!1||typeof this.crossOrigin!="string")&&(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case r.LOAD_TYPE.IMAGE:this.type=r.TYPE.IMAGE,this._loadElement("image");break;case r.LOAD_TYPE.AUDIO:this.type=r.TYPE.AUDIO,this._loadSourceElement("audio");break;case r.LOAD_TYPE.VIDEO:this.type=r.TYPE.VIDEO,this._loadSourceElement("video");break;case r.LOAD_TYPE.XHR:default:typeof Qr>"u"&&(Qr=!!(globalThis.XDomainRequest&&!("withCredentials"in new XMLHttpRequest))),Qr&&this.crossOrigin?this._loadXdr():this._loadXhr();break}}},r.prototype._hasFlag=function(e){return(this._flags&e)!==0},r.prototype._setFlag=function(e,t){this._flags=t?this._flags|e:this._flags&~e},r.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},r.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(r.STATUS_FLAGS.COMPLETE,!0),this._setFlag(r.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},r.prototype._loadElement=function(e){this.metadata.loadElement?this.data=this.metadata.loadElement:e==="image"&&typeof globalThis.Image<"u"?this.data=new Image:this.data=document.createElement(e),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},r.prototype._loadSourceElement=function(e){if(this.metadata.loadElement?this.data=this.metadata.loadElement:e==="audio"&&typeof globalThis.Audio<"u"?this.data=new Audio:this.data=document.createElement(e),this.data===null){this.abort("Unsupported element: "+e);return}if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var t=this.metadata.mimeType,i=0;i<this.url.length;++i)this.data.appendChild(this._createSource(e,this.url[i],Array.isArray(t)?t[i]:t));else{var t=this.metadata.mimeType;this.data.appendChild(this._createSource(e,this.url,Array.isArray(t)?t[0]:t))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},r.prototype._loadXhr=function(){typeof this.xhrType!="string"&&(this.xhrType=this._determineXhrType());var e=this.xhr=new XMLHttpRequest;this.crossOrigin==="use-credentials"&&(e.withCredentials=!0),e.open("GET",this.url,!0),e.timeout=this.timeout,this.xhrType===r.XHR_RESPONSE_TYPE.JSON||this.xhrType===r.XHR_RESPONSE_TYPE.DOCUMENT?e.responseType=r.XHR_RESPONSE_TYPE.TEXT:e.responseType=this.xhrType,e.addEventListener("error",this._boundXhrOnError,!1),e.addEventListener("timeout",this._boundXhrOnTimeout,!1),e.addEventListener("abort",this._boundXhrOnAbort,!1),e.addEventListener("progress",this._boundOnProgress,!1),e.addEventListener("load",this._boundXhrOnLoad,!1),e.send()},r.prototype._loadXdr=function(){typeof this.xhrType!="string"&&(this.xhrType=this._determineXhrType());var e=this.xhr=new globalThis.XDomainRequest;e.timeout=this.timeout||5e3,e.onerror=this._boundXhrOnError,e.ontimeout=this._boundXhrOnTimeout,e.onprogress=this._boundOnProgress,e.onload=this._boundXhrOnLoad,e.open("GET",this.url,!0),setTimeout(function(){return e.send()},1)},r.prototype._createSource=function(e,t,i){i||(i=e+"/"+this._getExtension(t));var n=document.createElement("source");return n.src=t,n.type=i,n},r.prototype._onError=function(e){this.abort("Failed to load element using: "+e.target.nodeName)},r.prototype._onProgress=function(e){e&&e.lengthComputable&&this.onProgress.dispatch(this,e.loaded/e.total)},r.prototype._onTimeout=function(){this.abort("Load timed out.")},r.prototype._xhrOnError=function(){var e=this.xhr;this.abort(Jr(e)+" Request failed. Status: "+e.status+', text: "'+e.statusText+'"')},r.prototype._xhrOnTimeout=function(){var e=this.xhr;this.abort(Jr(e)+" Request timed out.")},r.prototype._xhrOnAbort=function(){var e=this.xhr;this.abort(Jr(e)+" Request was aborted by the user.")},r.prototype._xhrOnLoad=function(){var e=this.xhr,t="",i=typeof e.status>"u"?la:e.status;(e.responseType===""||e.responseType==="text"||typeof e.responseType>"u")&&(t=e.responseText),i===id&&(t.length>0||e.responseType===r.XHR_RESPONSE_TYPE.BUFFER)?i=la:i===nd&&(i=rd);var n=i/100|0;if(n===sd)if(this.xhrType===r.XHR_RESPONSE_TYPE.TEXT)this.data=t,this.type=r.TYPE.TEXT;else if(this.xhrType===r.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(t),this.type=r.TYPE.JSON}catch(o){this.abort("Error trying to parse loaded json: "+o);return}else if(this.xhrType===r.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var s=new DOMParser;this.data=s.parseFromString(t,"text/xml")}else{var a=document.createElement("div");a.innerHTML=t,this.data=a}this.type=r.TYPE.XML}catch(o){this.abort("Error trying to parse loaded xml: "+o);return}else this.data=e.response||t;else{this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL);return}this.complete()},r.prototype._determineCrossOrigin=function(e,t){if(e.indexOf("data:")===0)return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";t=t||globalThis.location,zi||(zi=document.createElement("a")),zi.href=e;var i=ua(zi.href,{strictMode:!0}),n=!i.port&&t.port===""||i.port===t.port,s=i.protocol?i.protocol+":":"";return i.host!==t.hostname||!n||s!==t.protocol?"anonymous":""},r.prototype._determineXhrType=function(){return r._xhrTypeMap[this.extension]||r.XHR_RESPONSE_TYPE.TEXT},r.prototype._determineLoadType=function(){return r._loadTypeMap[this.extension]||r.LOAD_TYPE.XHR},r.prototype._getExtension=function(e){e===void 0&&(e=this.url);var t="";if(this.isDataUrl){var i=e.indexOf("/");t=e.substring(i+1,e.indexOf(";",i))}else{var n=e.indexOf("?"),s=e.indexOf("#"),a=Math.min(n>-1?n:e.length,s>-1?s:e.length);e=e.substring(0,a),t=e.substring(e.lastIndexOf(".")+1)}return t.toLowerCase()},r.prototype._getMimeFromXhrType=function(e){switch(e){case r.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case r.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case r.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case r.XHR_RESPONSE_TYPE.JSON:return"application/json";case r.XHR_RESPONSE_TYPE.DEFAULT:case r.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},r}();(function(r){(function(e){e[e.NONE=0]="NONE",e[e.DATA_URL=1]="DATA_URL",e[e.COMPLETE=2]="COMPLETE",e[e.LOADING=4]="LOADING"})(r.STATUS_FLAGS||(r.STATUS_FLAGS={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.JSON=1]="JSON",e[e.XML=2]="XML",e[e.IMAGE=3]="IMAGE",e[e.AUDIO=4]="AUDIO",e[e.VIDEO=5]="VIDEO",e[e.TEXT=6]="TEXT"}(r.TYPE||(r.TYPE={})),function(e){e[e.XHR=1]="XHR",e[e.IMAGE=2]="IMAGE",e[e.AUDIO=3]="AUDIO",e[e.VIDEO=4]="VIDEO"}(r.LOAD_TYPE||(r.LOAD_TYPE={})),function(e){e.DEFAULT="text",e.BUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.TEXT="text"}(r.XHR_RESPONSE_TYPE||(r.XHR_RESPONSE_TYPE={})),r._loadTypeMap={gif:r.LOAD_TYPE.IMAGE,png:r.LOAD_TYPE.IMAGE,bmp:r.LOAD_TYPE.IMAGE,jpg:r.LOAD_TYPE.IMAGE,jpeg:r.LOAD_TYPE.IMAGE,tif:r.LOAD_TYPE.IMAGE,tiff:r.LOAD_TYPE.IMAGE,webp:r.LOAD_TYPE.IMAGE,tga:r.LOAD_TYPE.IMAGE,avif:r.LOAD_TYPE.IMAGE,svg:r.LOAD_TYPE.IMAGE,"svg+xml":r.LOAD_TYPE.IMAGE,mp3:r.LOAD_TYPE.AUDIO,ogg:r.LOAD_TYPE.AUDIO,wav:r.LOAD_TYPE.AUDIO,mp4:r.LOAD_TYPE.VIDEO,webm:r.LOAD_TYPE.VIDEO},r._xhrTypeMap={xhtml:r.XHR_RESPONSE_TYPE.DOCUMENT,html:r.XHR_RESPONSE_TYPE.DOCUMENT,htm:r.XHR_RESPONSE_TYPE.DOCUMENT,xml:r.XHR_RESPONSE_TYPE.DOCUMENT,tmx:r.XHR_RESPONSE_TYPE.DOCUMENT,svg:r.XHR_RESPONSE_TYPE.DOCUMENT,tsx:r.XHR_RESPONSE_TYPE.DOCUMENT,gif:r.XHR_RESPONSE_TYPE.BLOB,png:r.XHR_RESPONSE_TYPE.BLOB,bmp:r.XHR_RESPONSE_TYPE.BLOB,jpg:r.XHR_RESPONSE_TYPE.BLOB,jpeg:r.XHR_RESPONSE_TYPE.BLOB,tif:r.XHR_RESPONSE_TYPE.BLOB,tiff:r.XHR_RESPONSE_TYPE.BLOB,webp:r.XHR_RESPONSE_TYPE.BLOB,tga:r.XHR_RESPONSE_TYPE.BLOB,avif:r.XHR_RESPONSE_TYPE.BLOB,json:r.XHR_RESPONSE_TYPE.JSON,text:r.XHR_RESPONSE_TYPE.TEXT,txt:r.XHR_RESPONSE_TYPE.TEXT,ttf:r.XHR_RESPONSE_TYPE.BUFFER,otf:r.XHR_RESPONSE_TYPE.BUFFER},r.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})(dt||(dt={}));function Ee(){}function ad(r){return function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];if(r===null)throw new Error("Callback was already called.");var s=r;r=null,s.apply(this,i)}}var od=function(){function r(e,t){this.data=e,this.callback=t}return r}(),tn=function(){function r(e,t){var i=this;if(t===void 0&&(t=1),this.workers=0,this.saturated=Ee,this.unsaturated=Ee,this.empty=Ee,this.drain=Ee,this.error=Ee,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(n,s,a){if(a&&typeof a!="function")throw new Error("task callback must be a function");if(i.started=!0,n==null&&i.idle()){setTimeout(function(){return i.drain()},1);return}var o=new od(n,typeof a=="function"?a:Ee);s?i._tasks.unshift(o):i._tasks.push(o),setTimeout(i.process,1)},this.process=function(){for(;!i.paused&&i.workers<i.concurrency&&i._tasks.length;){var n=i._tasks.shift();i._tasks.length===0&&i.empty(),i.workers+=1,i.workers===i.concurrency&&i.saturated(),i._worker(n.data,ad(i._next(n)))}},this._worker=e,t===0)throw new Error("Concurrency must not be zero");this.concurrency=t,this.buffer=t/4}return r.prototype._next=function(e){var t=this;return function(){for(var i=arguments,n=[],s=0;s<arguments.length;s++)n[s]=i[s];t.workers-=1,e.callback.apply(e,n),n[0]!=null&&t.error(n[0],e.data),t.workers<=t.concurrency-t.buffer&&t.unsaturated(),t.idle()&&t.drain(),t.process()}},r.prototype.push=function(e,t){this._insert(e,!1,t)},r.prototype.kill=function(){this.workers=0,this.drain=Ee,this.started=!1,this._tasks=[]},r.prototype.unshift=function(e,t){this._insert(e,!0,t)},r.prototype.length=function(){return this._tasks.length},r.prototype.running=function(){return this.workers},r.prototype.idle=function(){return this._tasks.length+this.workers===0},r.prototype.pause=function(){this.paused!==!0&&(this.paused=!0)},r.prototype.resume=function(){if(this.paused!==!1){this.paused=!1;for(var e=1;e<=this.concurrency;e++)this.process()}},r.eachSeries=function(e,t,i,n){var s=0,a=e.length;function o(h){if(h||s===a){i&&i(h);return}n?setTimeout(function(){t(e[s++],o)},1):t(e[s++],o)}o()},r.queue=function(e,t){return new r(e,t)},r}(),en=100,hd=/(#[\w-]+)?$/,ji=function(){function r(e,t){var i=this;e===void 0&&(e=""),t===void 0&&(t=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(h,u){return i._loadResource(h,u)},this.resources={},this.baseUrl=e,this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(h,u){return i._loadResource(h,u)},this._queue=tn.queue(this._boundLoadResource,t),this._queue.pause(),this.resources={},this.onProgress=new ee,this.onError=new ee,this.onLoad=new ee,this.onStart=new ee,this.onComplete=new ee;for(var n=0;n<r._plugins.length;++n){var s=r._plugins[n],a=s.pre,o=s.use;a&&this.pre(a),o&&this.use(o)}this._protected=!1}return r.prototype._add=function(e,t,i,n){if(this.loading&&(!i||!i.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[e])throw new Error('Resource named "'+e+'" already exists.');if(t=this._prepareUrl(t),this.resources[e]=new dt(e,t,i),typeof n=="function"&&this.resources[e].onAfterMiddleware.once(n),this.loading){for(var s=i.parentResource,a=[],o=0;o<s.children.length;++o)s.children[o].isComplete||a.push(s.children[o]);var h=s.progressChunk*(a.length+1),u=h/(a.length+2);s.children.push(this.resources[e]),s.progressChunk=u;for(var o=0;o<a.length;++o)a[o].progressChunk=u;this.resources[e].progressChunk=u}return this._queue.push(this.resources[e]),this},r.prototype.pre=function(e){return this._beforeMiddleware.push(e),this},r.prototype.use=function(e){return this._afterMiddleware.push(e),this},r.prototype.reset=function(){this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause();for(var e in this.resources){var t=this.resources[e];t._onLoadBinding&&t._onLoadBinding.detach(),t.isLoading&&t.abort("loader reset")}return this.resources={},this},r.prototype.load=function(e){if(Bt("6.5.0","@pixi/loaders is being replaced with @pixi/assets in the next major release."),typeof e=="function"&&this.onComplete.once(e),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var t=this._queue._tasks.length,i=en/t,n=0;n<this._queue._tasks.length;++n)this._queue._tasks[n].data.progressChunk=i;this._onStart(),this._queue.resume()}return this},Object.defineProperty(r.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(e){this._queue.concurrency=e},enumerable:!1,configurable:!0}),r.prototype._prepareUrl=function(e){var t=ua(e,{strictMode:!0}),i;if(t.protocol||!t.path||e.indexOf("//")===0?i=e:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&e.charAt(0)!=="/"?i=this.baseUrl+"/"+e:i=this.baseUrl+e,this.defaultQueryString){var n=hd.exec(i)[0];i=i.slice(0,i.length-n.length),i.indexOf("?")!==-1?i+="&"+this.defaultQueryString:i+="?"+this.defaultQueryString,i+=n}return i},r.prototype._loadResource=function(e,t){var i=this;e._dequeue=t,tn.eachSeries(this._beforeMiddleware,function(n,s){n.call(i,e,function(){s(e.isComplete?{}:null)})},function(){e.isComplete?i._onLoad(e):(e._onLoadBinding=e.onComplete.once(i._onLoad,i),e.load())},!0)},r.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},r.prototype._onComplete=function(){this.progress=en,this.loading=!1,this.onComplete.dispatch(this,this.resources)},r.prototype._onLoad=function(e){var t=this;e._onLoadBinding=null,this._resourcesParsing.push(e),e._dequeue(),tn.eachSeries(this._afterMiddleware,function(i,n){i.call(t,e,n)},function(){e.onAfterMiddleware.dispatch(e),t.progress=Math.min(en,t.progress+e.progressChunk),t.onProgress.dispatch(t,e),e.error?t.onError.dispatch(e.error,t,e):t.onLoad.dispatch(t,e),t._resourcesParsing.splice(t._resourcesParsing.indexOf(e),1),t._queue.idle()&&t._resourcesParsing.length===0&&t._onComplete()},!0)},r.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(r,"shared",{get:function(){var e=r._shared;return e||(e=new r,e._protected=!0,r._shared=e),e},enumerable:!1,configurable:!0}),r.registerPlugin=function(e){return Bt("6.5.0","Loader.registerPlugin() is deprecated, use extensions.add() instead."),Jt.add({type:J.Loader,ref:e}),r},r._plugins=[],r}();Jt.handleByList(J.Loader,ji._plugins),ji.prototype.add=function(e,t,i,n){if(Array.isArray(e)){for(var s=0;s<e.length;++s)this.add(e[s]);return this}if(typeof e=="object"&&(i=e,n=t||i.callback||i.onComplete,t=i.url,e=i.name||i.key||i.url),typeof t!="string"&&(n=i,i=t,t=e),typeof t!="string")throw new Error("No url passed to add resource to loader.");return typeof i=="function"&&(n=i,i=null),this._add(e,t,i,n)};var ud=function(){function r(){}return r.init=function(e){e=Object.assign({sharedLoader:!1},e),this.loader=e.sharedLoader?ji.shared:new ji},r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.extension=J.Application,r}(),ld=function(){function r(){}return r.add=function(){dt.setExtensionLoadType("svg",dt.LOAD_TYPE.XHR),dt.setExtensionXhrType("svg",dt.XHR_RESPONSE_TYPE.TEXT)},r.use=function(e,t){if(e.data&&(e.type===dt.TYPE.IMAGE||e.extension==="svg")){var i=e.data,n=e.url,s=e.name,a=e.metadata;k.fromLoader(i,n,s,a).then(function(o){e.texture=o,t()}).catch(t)}else t()},r.extension=J.Loader,r}(),fd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function cd(r){for(var e="",t=0;t<r.length;){for(var i=[0,0,0],n=[0,0,0,0],s=0;s<i.length;++s)t<r.length?i[s]=r.charCodeAt(t++)&255:i[s]=0;n[0]=i[0]>>2,n[1]=(i[0]&3)<<4|i[1]>>4,n[2]=(i[1]&15)<<2|i[2]>>6,n[3]=i[2]&63;var a=t-(r.length-1);switch(a){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64;break}for(var s=0;s<n.length;++s)e+=fd.charAt(n[s])}return e}function dd(r,e){if(!r.data){e();return}if(r.xhr&&r.xhrType===dt.XHR_RESPONSE_TYPE.BLOB){if(!self.Blob||typeof r.data=="string"){var t=r.xhr.getResponseHeader("content-type");if(t&&t.indexOf("image")===0){r.data=new Image,r.data.src="data:"+t+";base64,"+cd(r.xhr.responseText),r.type=dt.TYPE.IMAGE,r.data.onload=function(){r.data.onload=null,e()};return}}else if(r.data.type.indexOf("image")===0){var i=globalThis.URL||globalThis.webkitURL,n=i.createObjectURL(r.data);r.blob=r.data,r.data=new Image,r.data.src=n,r.type=dt.TYPE.IMAGE,r.data.onload=function(){i.revokeObjectURL(n),r.data.onload=null,e()};return}}e()}var pd=function(){function r(){}return r.extension=J.Loader,r.use=dd,r}();Jt.add(ld,pd);var Q,X;(function(r){r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR"})(X||(X={}));var Yi=(Q={},Q[X.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,Q[X.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,Q[X.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,Q[X.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,Q[X.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,Q[X.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,Q[X.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,Q[X.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,Q[X.COMPRESSED_R11_EAC]=.5,Q[X.COMPRESSED_SIGNED_R11_EAC]=.5,Q[X.COMPRESSED_RG11_EAC]=1,Q[X.COMPRESSED_SIGNED_RG11_EAC]=1,Q[X.COMPRESSED_RGB8_ETC2]=.5,Q[X.COMPRESSED_RGBA8_ETC2_EAC]=1,Q[X.COMPRESSED_SRGB8_ETC2]=.5,Q[X.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=1,Q[X.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,Q[X.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,Q[X.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,Q[X.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,Q[X.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,Q[X.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,Q[X.COMPRESSED_RGB_ETC1_WEBGL]=.5,Q[X.COMPRESSED_RGB_ATC_WEBGL]=.5,Q[X.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,Q[X.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,Q[X.COMPRESSED_RGBA_ASTC_4x4_KHR]=1,Q);var rn=function(r,e){return rn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},rn(r,e)};function da(r,e){rn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function vd(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(l){try{u(i.next(l))}catch(f){a(f)}}function h(l){try{u(i.throw(l))}catch(f){a(f)}}function u(l){l.done?s(l.value):n(l.value).then(o,h)}u((i=i.apply(r,e||[])).next())})}function _d(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(l){return h([u,l])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(l){u=[6,l],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var md=function(r){da(e,r);function e(t,i){i===void 0&&(i={width:1,height:1,autoLoad:!0});var n=this,s,a;return typeof t=="string"?(s=t,a=new Uint8Array):(s=null,a=t),n=r.call(this,a,i)||this,n.origin=s,n.buffer=a?new $r(a):null,n.origin&&i.autoLoad!==!1&&n.load(),a&&a.length&&(n.loaded=!0,n.onBlobLoaded(n.buffer.rawBinaryData)),n}return e.prototype.onBlobLoaded=function(t){},e.prototype.load=function(){return vd(this,void 0,Promise,function(){var t,i,n;return _d(this,function(s){switch(s.label){case 0:return[4,fetch(this.origin)];case 1:return t=s.sent(),[4,t.blob()];case 2:return i=s.sent(),[4,i.arrayBuffer()];case 3:return n=s.sent(),this.data=new Uint32Array(n),this.buffer=new $r(n),this.loaded=!0,this.onBlobLoaded(n),this.update(),[2,this]}})})},e}(Je),nn=function(r){da(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.format=i.format,n.levels=i.levels||1,n._width=i.width,n._height=i.height,n._extension=e._formatToExtension(n.format),(i.levelBuffers||n.buffer)&&(n._levelBuffers=i.levelBuffers||e._createLevelBuffers(t instanceof Uint8Array?t:n.buffer.uint8View,n.format,n.levels,4,4,n.width,n.height)),n}return e.prototype.upload=function(t,i,n){var s=t.gl,a=t.context.extensions[this._extension];if(!a)throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var o=0,h=this.levels;o<h;o++){var u=this._levelBuffers[o],l=u.levelID,f=u.levelWidth,c=u.levelHeight,d=u.levelBuffer;s.compressedTexImage2D(s.TEXTURE_2D,l,this.format,f,c,0,d)}return!0},e.prototype.onBlobLoaded=function(){this._levelBuffers=e._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},e._formatToExtension=function(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},e._createLevelBuffers=function(t,i,n,s,a,o,h){for(var u=new Array(n),l=t.byteOffset,f=o,c=h,d=f+s-1&~(s-1),p=c+a-1&~(a-1),v=d*p*Yi[i],_=0;_<n;_++)u[_]={levelID:_,levelWidth:n>1?f:d,levelHeight:n>1?c:p,levelBuffer:new Uint8Array(t.buffer,l,v)},l+=v,f=f>>1||1,c=c>>1||1,d=f+s-1&~(s-1),p=c+a-1&~(a-1),v=d*p*Yi[i];return u},e}(md),gd=function(){function r(){}return r.use=function(e,t){var i=e.data,n=this;if(e.type===dt.TYPE.JSON&&i&&i.cacheID&&i.textures){for(var s=i.textures,a=void 0,o=void 0,h=0,u=s.length;h<u;h++){var l=s[h],f=l.src,c=l.format;if(c||(o=f),r.textureFormats[c]){a=f;break}}if(a=a||o,!a){t(new Error("Cannot load compressed-textures in "+e.url+", make sure you provide a fallback"));return}if(a===e.url){t(new Error("URL of compressed texture cannot be the same as the manifest's URL"));return}var d={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},p=De.resolve(e.url.replace(n.baseUrl,""),a),v=i.cacheID;n.add(v,p,d,function(_){if(_.error){t(_.error);return}var m=_.texture,y=m===void 0?null:m,g=_.textures,b=g===void 0?{}:g;Object.assign(e,{texture:y,textures:b}),t()})}else t()},Object.defineProperty(r,"textureExtensions",{get:function(){if(!r._textureExtensions){var e=F.ADAPTER.createCanvas(),t=e.getContext("webgl");if(!t)return console.warn("WebGL not available for compressed textures. Silently failing."),{};var i={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")};r._textureExtensions=i}return r._textureExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(r,"textureFormats",{get:function(){if(!r._textureFormats){var e=r.textureExtensions;r._textureFormats={};for(var t in e){var i=e[t];i&&Object.assign(r._textureFormats,Object.getPrototypeOf(i))}}return r._textureFormats},enumerable:!1,configurable:!0}),r.extension=J.Loader,r}();function pa(r,e,t){var i={textures:{},texture:null};if(!e)return i;var n=e.map(function(s){return new k(new Y(s,Object.assign({mipmap:Mt.OFF,alphaMode:Dt.NO_PREMULTIPLIED_ALPHA},t)))});return n.forEach(function(s,a){var o=s.baseTexture,h=r+"-"+(a+1);Y.addToCache(o,h),k.addToCache(s,h),a===0&&(Y.addToCache(o,r),k.addToCache(s,r),i.texture=s),i.textures[h]=s}),i}var si,Lt,sn=4,Vi=124,yd=32,va=20,xd=542327876,qi={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},bd={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},$i={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Ut;(function(r){r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"})(Ut||(Ut={}));var an;(function(r){r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"})(an||(an={}));var Td=1,wd=2,Ed=4,Sd=64,Pd=512,Cd=131072,Rd=827611204,Ad=861165636,Id=894720068,Od=808540228,Md=4,Dd=(si={},si[Rd]=X.COMPRESSED_RGBA_S3TC_DXT1_EXT,si[Ad]=X.COMPRESSED_RGBA_S3TC_DXT3_EXT,si[Id]=X.COMPRESSED_RGBA_S3TC_DXT5_EXT,si),Fd=(Lt={},Lt[Ut.DXGI_FORMAT_BC1_TYPELESS]=X.COMPRESSED_RGBA_S3TC_DXT1_EXT,Lt[Ut.DXGI_FORMAT_BC1_UNORM]=X.COMPRESSED_RGBA_S3TC_DXT1_EXT,Lt[Ut.DXGI_FORMAT_BC2_TYPELESS]=X.COMPRESSED_RGBA_S3TC_DXT3_EXT,Lt[Ut.DXGI_FORMAT_BC2_UNORM]=X.COMPRESSED_RGBA_S3TC_DXT3_EXT,Lt[Ut.DXGI_FORMAT_BC3_TYPELESS]=X.COMPRESSED_RGBA_S3TC_DXT5_EXT,Lt[Ut.DXGI_FORMAT_BC3_UNORM]=X.COMPRESSED_RGBA_S3TC_DXT5_EXT,Lt[Ut.DXGI_FORMAT_BC1_UNORM_SRGB]=X.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,Lt[Ut.DXGI_FORMAT_BC2_UNORM_SRGB]=X.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,Lt[Ut.DXGI_FORMAT_BC3_UNORM_SRGB]=X.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,Lt);function Nd(r){var e=new Uint32Array(r),t=e[0];if(t!==xd)throw new Error("Invalid DDS file magic word");var i=new Uint32Array(r,0,Vi/Uint32Array.BYTES_PER_ELEMENT),n=i[qi.HEIGHT],s=i[qi.WIDTH],a=i[qi.MIPMAP_COUNT],o=new Uint32Array(r,qi.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,yd/Uint32Array.BYTES_PER_ELEMENT),h=o[Td];if(h&Ed){var u=o[bd.FOURCC];if(u!==Od){var l=Dd[u],f=sn+Vi,c=new Uint8Array(r,f),d=new nn(c,{format:l,width:s,height:n,levels:a});return[d]}var p=sn+Vi,v=new Uint32Array(e.buffer,p,va/Uint32Array.BYTES_PER_ELEMENT),_=v[$i.DXGI_FORMAT],m=v[$i.RESOURCE_DIMENSION],y=v[$i.MISC_FLAG],g=v[$i.ARRAY_SIZE],b=Fd[_];if(b===void 0)throw new Error("DDSParser cannot parse texture data with DXGI format "+_);if(y===Md)throw new Error("DDSParser does not support cubemap textures");if(m===an.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");var x=new Array,T=sn+Vi+va;if(g===1)x.push(new Uint8Array(r,T));else{for(var w=Yi[b],A=0,E=s,S=n,D=0;D<a;D++){var C=Math.max(1,E+3&-4),N=Math.max(1,S+3&-4),H=C*N*w;A+=H,E=E>>>1,S=S>>>1}for(var M=T,D=0;D<g;D++)x.push(new Uint8Array(r,M,A)),M+=A}return x.map(function(O){return new nn(O,{format:b,width:s,height:n,levels:a})})}throw h&Sd?new Error("DDSParser does not support uncompressed texture data."):h&Pd?new Error("DDSParser does not supported YUV uncompressed texture data."):h&Cd?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&wd?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}var oe,ie,ai,_a=[171,75,84,88,32,49,49,187,13,10,26,10],Bd=67305985,Gt={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},on=64,ma=(oe={},oe[L.UNSIGNED_BYTE]=1,oe[L.UNSIGNED_SHORT]=2,oe[L.INT]=4,oe[L.UNSIGNED_INT]=4,oe[L.FLOAT]=4,oe[L.HALF_FLOAT]=8,oe),Ld=(ie={},ie[R.RGBA]=4,ie[R.RGB]=3,ie[R.RG]=2,ie[R.RED]=1,ie[R.LUMINANCE]=1,ie[R.LUMINANCE_ALPHA]=2,ie[R.ALPHA]=1,ie),Ud=(ai={},ai[L.UNSIGNED_SHORT_4_4_4_4]=2,ai[L.UNSIGNED_SHORT_5_5_5_1]=2,ai[L.UNSIGNED_SHORT_5_6_5]=2,ai);function Gd(r,e,t){t===void 0&&(t=!1);var i=new DataView(e);if(!kd(r,i))return null;var n=i.getUint32(Gt.ENDIANNESS,!0)===Bd,s=i.getUint32(Gt.GL_TYPE,n),a=i.getUint32(Gt.GL_FORMAT,n),o=i.getUint32(Gt.GL_INTERNAL_FORMAT,n),h=i.getUint32(Gt.PIXEL_WIDTH,n),u=i.getUint32(Gt.PIXEL_HEIGHT,n)||1,l=i.getUint32(Gt.PIXEL_DEPTH,n)||1,f=i.getUint32(Gt.NUMBER_OF_ARRAY_ELEMENTS,n)||1,c=i.getUint32(Gt.NUMBER_OF_FACES,n),d=i.getUint32(Gt.NUMBER_OF_MIPMAP_LEVELS,n),p=i.getUint32(Gt.BYTES_OF_KEY_VALUE_DATA,n);if(u===0||l!==1)throw new Error("Only 2D textures are supported");if(c!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(f!==1)throw new Error("WebGL does not support array textures");var v=4,_=4,m=h+3&-4,y=u+3&-4,g=new Array(f),b=h*u;s===0&&(b=m*y);var x;if(s!==0?ma[s]?x=ma[s]*Ld[a]:x=Ud[s]:x=Yi[o],x===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var T=t?Xd(i,p,n):null,w=b*x,A=w,E=h,S=u,D=m,C=y,N=on+p,H=0;H<d;H++){for(var M=i.getUint32(N,n),O=N+4,G=0;G<f;G++){var lt=g[G];lt||(lt=g[G]=new Array(d)),lt[H]={levelID:H,levelWidth:d>1||s!==0?E:D,levelHeight:d>1||s!==0?S:C,levelBuffer:new Uint8Array(e,O,A)},O+=A}N+=M+4,N=N%4!==0?N+4-N%4:N,E=E>>1||1,S=S>>1||1,D=E+v-1&~(v-1),C=S+_-1&~(_-1),A=D*C*x}return s!==0?{uncompressed:g.map(function(j){var I=j[0].levelBuffer,P=!1;return s===L.FLOAT?I=new Float32Array(j[0].levelBuffer.buffer,j[0].levelBuffer.byteOffset,j[0].levelBuffer.byteLength/4):s===L.UNSIGNED_INT?(P=!0,I=new Uint32Array(j[0].levelBuffer.buffer,j[0].levelBuffer.byteOffset,j[0].levelBuffer.byteLength/4)):s===L.INT&&(P=!0,I=new Int32Array(j[0].levelBuffer.buffer,j[0].levelBuffer.byteOffset,j[0].levelBuffer.byteLength/4)),{resource:new Je(I,{width:j[0].levelWidth,height:j[0].levelHeight}),type:s,format:P?Hd(a):a}}),kvData:T}:{compressed:g.map(function(j){return new nn(null,{format:o,width:h,height:u,levels:d,levelBuffers:j})}),kvData:T}}function kd(r,e){for(var t=0;t<_a.length;t++)if(e.getUint8(t)!==_a[t])return console.error(r+" is not a valid *.ktx file!"),!1;return!0}function Hd(r){switch(r){case R.RGBA:return R.RGBA_INTEGER;case R.RGB:return R.RGB_INTEGER;case R.RG:return R.RG_INTEGER;case R.RED:return R.RED_INTEGER;default:return r}}function Xd(r,e,t){for(var i=new Map,n=0;n<e;){var s=r.getUint32(on+n,t),a=on+n+4,o=3-(s+3)%4;if(s===0||s>e-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(var h=0;h<s&&r.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}var u=new TextDecoder().decode(new Uint8Array(r.buffer,a,h)),l=new DataView(r.buffer,a+h+1,s-h-1);i.set(u,l),n+=4+s+o}return i}dt.setExtensionXhrType("dds",dt.XHR_RESPONSE_TYPE.BUFFER);var Wd=function(){function r(){}return r.use=function(e,t){if(e.extension==="dds"&&e.data)try{Object.assign(e,pa(e.name||e.url,Nd(e.data),e.metadata))}catch(i){t(i);return}t()},r.extension=J.Loader,r}();dt.setExtensionXhrType("ktx",dt.XHR_RESPONSE_TYPE.BUFFER);var zd=function(){function r(){}return r.use=function(e,t){if(e.extension==="ktx"&&e.data)try{var i=e.name||e.url,n=Gd(i,e.data,this.loadKeyValueData),s=n.compressed,a=n.uncompressed,o=n.kvData;if(s){var h=pa(i,s,e.metadata);if(o&&h.textures)for(var u in h.textures)h.textures[u].baseTexture.ktxKeyValueData=o;Object.assign(e,h)}else if(a){var l={};a.forEach(function(f,c){var d=new k(new Y(f.resource,{mipmap:Mt.OFF,alphaMode:Dt.NO_PREMULTIPLIED_ALPHA,type:f.type,format:f.format})),p=i+"-"+(c+1);o&&(d.baseTexture.ktxKeyValueData=o),Y.addToCache(d.baseTexture,p),k.addToCache(d,p),c===0&&(l[i]=d,Y.addToCache(d.baseTexture,i),k.addToCache(d,i)),l[p]=d}),Object.assign(e,{textures:l})}}catch(f){t(f);return}t()},r.extension=J.Loader,r.loadKeyValueData=!1,r}();var hn=function(r,e){return hn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},hn(r,e)};function ga(r,e){hn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){ga(e,r);function e(t,i,n,s){t===void 0&&(t=1500),n===void 0&&(n=16384),s===void 0&&(s=!1);var a=r.call(this)||this,o=16384;return n>o&&(n=o),a._properties=[!1,!0,!1,!1,!1],a._maxSize=t,a._batchSize=n,a._buffers=null,a._bufferUpdateIDs=[],a._updateID=0,a.interactiveChildren=!1,a.blendMode=U.NORMAL,a.autoResize=s,a.roundPixels=!0,a.baseTexture=null,a.setProperties(i),a._tint=0,a.tintRgb=new Float32Array(4),a.tint=16777215,a}return e.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},e.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,Fe(t,this.tintRgb)},enumerable:!1,configurable:!0}),e.prototype.render=function(t){var i=this;!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return i.onChildrenChange(0)})),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},e.prototype.onChildrenChange=function(t){for(var i=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<i;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[i]=++this._updateID},e.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},e})(St);var ya=function(){function r(e,t,i){this.geometry=new ti,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(var n=0;n<e.length;++n){var s=e[n];s={attributeName:s.attributeName,size:s.size,uploadFunction:s.uploadFunction,type:s.type||L.FLOAT,offset:s.offset},t[n]?this.dynamicProperties.push(s):this.staticProperties.push(s)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return r.prototype.initBuffers=function(){var e=this.geometry,t=0;this.indexBuffer=new yt(hf(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(var i=0;i<this.dynamicProperties.length;++i){var n=this.dynamicProperties[i];n.offset=t,t+=n.size,this.dynamicStride+=n.size}var s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new yt(this.dynamicData,!1,!1);var a=0;this.staticStride=0;for(var i=0;i<this.staticProperties.length;++i){var n=this.staticProperties[i];n.offset=a,a+=n.size,this.staticStride+=n.size}var o=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(o),this.staticDataUint32=new Uint32Array(o),this.staticBuffer=new yt(this.staticData,!0,!1);for(var i=0;i<this.dynamicProperties.length;++i){var n=this.dynamicProperties[i];e.addAttribute(n.attributeName,this.dynamicBuffer,0,n.type===L.UNSIGNED_BYTE,n.type,this.dynamicStride*4,n.offset*4)}for(var i=0;i<this.staticProperties.length;++i){var n=this.staticProperties[i];e.addAttribute(n.attributeName,this.staticBuffer,0,n.type===L.UNSIGNED_BYTE,n.type,this.staticStride*4,n.offset*4)}},r.prototype.uploadDynamic=function(e,t,i){for(var n=0;n<this.dynamicProperties.length;n++){var s=this.dynamicProperties[n];s.uploadFunction(e,t,i,s.type===L.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++},r.prototype.uploadStatic=function(e,t,i){for(var n=0;n<this.staticProperties.length;n++){var s=this.staticProperties[n];s.uploadFunction(e,t,i,s.type===L.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.offset)}this.staticBuffer._updateID++},r.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},r}(),jd=`varying vec2 vTextureCoord;
491
+ `,jc=function(){function r(){}return r.create=function(e){var t=Object.assign({vertex:ea,fragment:ia,geometryClass:ta,vertexSize:6},e),i=t.vertex,n=t.fragment,s=t.vertexSize,a=t.geometryClass;return function(o){it(h,o);function h(u){var l=o.call(this,u)||this;return l.shaderGenerator=new Wc(i,n),l.geometryClass=a,l.vertexSize=s,l}return h}(Xc)},Object.defineProperty(r,"defaultVertexSrc",{get:function(){return ea},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentTemplate",{get:function(){return ia},enumerable:!1,configurable:!0}),r}(),ra=jc.create();Object.assign(ra,{extension:{name:"batch",type:tt.RendererPlugin}});var zc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};pt.mixin(zc);var Yc=9,Xi=100,Vc=0,qc=0,na=2,sa=1,$c=-1e3,Zc=-1e3,Kc=2,Qc=function(){function r(e){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Vt.tablet||Vt.phone)&&this.createTouchHook();var t=document.createElement("div");t.style.width=Xi+"px",t.style.height=Xi+"px",t.style.position="absolute",t.style.top=Vc+"px",t.style.left=qc+"px",t.style.zIndex=na.toString(),this.div=t,this.renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(r.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),r.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width=sa+"px",t.style.height=sa+"px",t.style.position="absolute",t.style.top=$c+"px",t.style.left=Zc+"px",t.style.zIndex=Kc.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},r.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},r.prototype.activate=function(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(e=this.renderer.view.parentNode)===null||e===void 0||e.appendChild(this.div))},r.prototype.deactivate=function(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(e=this.div.parentNode)===null||e===void 0||e.removeChild(this.div))},r.prototype.updateAccessibleObjects=function(e){if(!(!e.visible||!e.accessibleChildren)){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);var t=e.children;if(t)for(var i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},r.prototype.update=function(){var e=performance.now();if(!(Vt.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,!!this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var t=this.renderer.view.getBoundingClientRect(),i=t.left,n=t.top,s=t.width,a=t.height,o=this.renderer,h=o.width,u=o.height,l=o.resolution,f=s/h*l,c=a/u*l,d=this.div;d.style.left=i+"px",d.style.top=n+"px",d.style.width=h+"px",d.style.height=u+"px";for(var p=0;p<this.children.length;p++){var v=this.children[p];if(v.renderId!==this.renderId)v._accessibleActive=!1,Le(this.children,p,1),this.div.removeChild(v._accessibleDiv),this.pool.push(v._accessibleDiv),v._accessibleDiv=null,p--;else{d=v._accessibleDiv;var _=v.hitArea,m=v.worldTransform;v.hitArea?(d.style.left=(m.tx+_.x*m.a)*f+"px",d.style.top=(m.ty+_.y*m.d)*c+"px",d.style.width=_.width*m.a*f+"px",d.style.height=_.height*m.d*c+"px"):(_=v.getBounds(),this.capHitArea(_),d.style.left=_.x*f+"px",d.style.top=_.y*c+"px",d.style.width=_.width*f+"px",d.style.height=_.height*c+"px",d.title!==v.accessibleTitle&&v.accessibleTitle!==null&&(d.title=v.accessibleTitle),d.getAttribute("aria-label")!==v.accessibleHint&&v.accessibleHint!==null&&d.setAttribute("aria-label",v.accessibleHint)),(v.accessibleTitle!==d.title||v.tabIndex!==d.tabIndex)&&(d.title=v.accessibleTitle,d.tabIndex=v.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}},r.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},r.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);var t=this.renderer,i=t.width,n=t.height;e.x+e.width>i&&(e.width=i-e.x),e.y+e.height>n&&(e.height=n-e.y)},r.prototype.addChild=function(e){var t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=Xi+"px",t.style.height=Xi+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=na.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title="displayObject "+e.tabIndex),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},r.prototype._onClick=function(e){var t=this.renderer.plugins.interaction,i=e.target.displayObject,n=t.eventData;t.dispatchEvent(i,"click",n),t.dispatchEvent(i,"pointertap",n),t.dispatchEvent(i,"tap",n)},r.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction,i=e.target.displayObject,n=t.eventData;t.dispatchEvent(i,"mouseover",n)},r.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction,i=e.target.displayObject,n=t.eventData;t.dispatchEvent(i,"mouseout",n)},r.prototype._onKeyDown=function(e){e.keyCode===Yc&&this.activate()},r.prototype._onMouseMove=function(e){e.movementX===0&&e.movementY===0||this.deactivate()},r.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},r.extension={name:"accessibility",type:[tt.RendererPlugin,tt.CanvasRendererPlugin]},r}();var aa=function(){function r(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new X,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(r.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),r.prototype.getLocalPosition=function(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)},r.prototype.copyEvent=function(e){"isPrimary"in e&&e.isPrimary&&(this.isPrimary=!0),this.button="button"in e&&e.button;var t="buttons"in e&&e.buttons;this.buttons=Number.isInteger(t)?t:"which"in e&&e.which,this.width="width"in e&&e.width,this.height="height"in e&&e.height,this.tiltX="tiltX"in e&&e.tiltX,this.tiltY="tiltY"in e&&e.tiltY,this.pointerType="pointerType"in e&&e.pointerType,this.pressure="pressure"in e&&e.pressure,this.rotationAngle="rotationAngle"in e&&e.rotationAngle,this.twist="twist"in e&&e.twist||0,this.tangentialPressure="tangentialPressure"in e&&e.tangentialPressure||0},r.prototype.reset=function(){this.isPrimary=!1},r}();var Jr=function(r,e){return Jr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Jr(r,e)};function Jc(r,e){Jr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var td=function(){function r(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return r.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},r.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},r}(),tn=function(){function r(e){this._pointerId=e,this._flags=r.FLAGS.NONE}return r.prototype._doSet=function(e,t){t?this._flags=this._flags|e:this._flags=this._flags&~e},Object.defineProperty(r.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"flags",{get:function(){return this._flags},set:function(e){this._flags=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"none",{get:function(){return this._flags===r.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"over",{get:function(){return(this._flags&r.FLAGS.OVER)!==0},set:function(e){this._doSet(r.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rightDown",{get:function(){return(this._flags&r.FLAGS.RIGHT_DOWN)!==0},set:function(e){this._doSet(r.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leftDown",{get:function(){return(this._flags&r.FLAGS.LEFT_DOWN)!==0},set:function(e){this._doSet(r.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),r.FLAGS=Object.freeze({NONE:0,OVER:1<<0,LEFT_DOWN:1<<1,RIGHT_DOWN:1<<2}),r}(),ed=function(){function r(){this._tempPoint=new X}return r.prototype.recursiveFindHit=function(e,t,i,n,s){var a;if(!t||!t.visible)return!1;var o=e.data.global;s=t.interactive||s;var h=!1,u=s,l=!0;if(t.hitArea)n&&(t.worldTransform.applyInverse(o,this._tempPoint),t.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?h=!0:(n=!1,l=!1)),u=!1;else if(t._mask&&n){var f=t._mask.isMaskData?t._mask.maskObject:t._mask;f&&!(!((a=f.containsPoint)===null||a===void 0)&&a.call(f,o))&&(n=!1)}if(l&&t.interactiveChildren&&t.children)for(var c=t.children,d=c.length-1;d>=0;d--){var p=c[d],v=this.recursiveFindHit(e,p,i,n,u);if(v){if(!p.parent)continue;u=!1,v&&(e.target&&(n=!1),h=!0)}}return s&&(n&&!e.target&&!t.hitArea&&t.containsPoint&&t.containsPoint(o)&&(h=!0),t.interactive&&(h&&!e.target&&(e.target=t),i&&i(e,t,!!h))),h},r.prototype.findHit=function(e,t,i,n){this.recursiveFindHit(e,t,i,n,!1)},r}(),id={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return this.cursor==="pointer"},set buttonMode(r){r?this.cursor="pointer":this.cursor==="pointer"&&(this.cursor=null)},cursor:null,get trackedPointers(){return this._trackedPointers===void 0&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};pt.mixin(id);var Wi=1,ji={target:null,data:{global:null}},rd=function(r){Jc(e,r);function e(t,i){var n=r.call(this)||this;return i=i||{},n.renderer=t,n.autoPreventDefault=i.autoPreventDefault!==void 0?i.autoPreventDefault:!0,n.interactionFrequency=i.interactionFrequency||10,n.mouse=new aa,n.mouse.identifier=Wi,n.mouse.global.set(-999999),n.activeInteractionData={},n.activeInteractionData[Wi]=n.mouse,n.interactionDataPool=[],n.eventData=new td,n.interactionDOMElement=null,n.moveWhenInside=!1,n.eventsAdded=!1,n.tickerAdded=!1,n.mouseOverRenderer=!("PointerEvent"in globalThis),n.supportsTouchEvents="ontouchstart"in globalThis,n.supportsPointerEvents=!!globalThis.PointerEvent,n.onPointerUp=n.onPointerUp.bind(n),n.processPointerUp=n.processPointerUp.bind(n),n.onPointerCancel=n.onPointerCancel.bind(n),n.processPointerCancel=n.processPointerCancel.bind(n),n.onPointerDown=n.onPointerDown.bind(n),n.processPointerDown=n.processPointerDown.bind(n),n.onPointerMove=n.onPointerMove.bind(n),n.processPointerMove=n.processPointerMove.bind(n),n.onPointerOut=n.onPointerOut.bind(n),n.processPointerOverOut=n.processPointerOverOut.bind(n),n.onPointerOver=n.onPointerOver.bind(n),n.cursorStyles={default:"inherit",pointer:"pointer"},n.currentCursorMode=null,n.cursor=null,n.resolution=1,n.delayedEvents=[],n.search=new ed,n._tempDisplayObject=new Rs,n._eventListenerOptions={capture:!0,passive:!1},n._useSystemTicker=i.useSystemTicker!==void 0?i.useSystemTicker:!0,n.setTargetElement(n.renderer.view,n.renderer.resolution),n}return Object.defineProperty(e.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),e.prototype.hitTest=function(t,i){return ji.target=null,ji.data.global=t,i||(i=this.lastObjectRendered),this.processInteractive(ji,i,null,!0),ji.target},e.prototype.setTargetElement=function(t,i){i===void 0&&(i=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=i,this.addEvents(),this.addTickerListener()},e.prototype.addTickerListener=function(){this.tickerAdded||!this.interactionDOMElement||!this._useSystemTicker||(Tt.system.add(this.tickerUpdate,this,$t.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(Tt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},e.prototype.addEvents=function(){if(!(this.eventsAdded||!this.interactionDOMElement)){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},e.prototype.removeEvents=function(){if(!(!this.eventsAdded||!this.interactionDOMElement)){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},e.prototype.tickerUpdate=function(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())},e.prototype.update=function(){if(this.interactionDOMElement){if(this._didMove){this._didMove=!1;return}this.cursor=null;for(var t in this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(t)){var i=this.activeInteractionData[t];if(i.originalEvent&&i.pointerType!=="touch"){var n=this.configureInteractionEventForDOMEvent(this.eventData,i.originalEvent,i);this.processInteractive(n,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},e.prototype.setCursorMode=function(t){t=t||"default";var i=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(i=!1),this.currentCursorMode!==t){this.currentCursorMode=t;var n=this.cursorStyles[t];if(n)switch(typeof n){case"string":i&&(this.interactionDOMElement.style.cursor=n);break;case"function":n(t);break;case"object":i&&Object.assign(this.interactionDOMElement.style,n);break}else i&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.interactionDOMElement.style.cursor=t)}},e.prototype.dispatchEvent=function(t,i,n){(!n.stopPropagationHint||t===n.stopsPropagatingAt)&&(n.currentTarget=t,n.type=i,t.emit(i,n),t[i]&&t[i](n))},e.prototype.delayDispatchEvent=function(t,i,n){this.delayedEvents.push({displayObject:t,eventString:i,eventData:n})},e.prototype.mapPositionToPoint=function(t,i,n){var s;this.interactionDOMElement.parentElement?s=this.interactionDOMElement.getBoundingClientRect():s={x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var a=1/this.resolution;t.x=(i-s.left)*(this.interactionDOMElement.width/s.width)*a,t.y=(n-s.top)*(this.interactionDOMElement.height/s.height)*a},e.prototype.processInteractive=function(t,i,n,s){var a=this.search.findHit(t,i,n,s),o=this.delayedEvents;if(!o.length)return a;t.stopPropagationHint=!1;var h=o.length;this.delayedEvents=[];for(var u=0;u<h;u++){var l=o[u],f=l.displayObject,c=l.eventString,d=l.eventData;d.stopsPropagatingAt===f&&(d.stopPropagationHint=!0),this.dispatchEvent(f,c,d)}return a},e.prototype.onPointerDown=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t);if(this.autoPreventDefault&&i[0].isNormalized){var n=t.cancelable||!("cancelable"in t);n&&t.preventDefault()}for(var s=i.length,a=0;a<s;a++){var o=i[a],h=this.getInteractionDataForPointerId(o),u=this.configureInteractionEventForDOMEvent(this.eventData,o,h);if(u.data.originalEvent=t,this.processInteractive(u,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",u),o.pointerType==="touch")this.emit("touchstart",u);else if(o.pointerType==="mouse"||o.pointerType==="pen"){var l=o.button===2;this.emit(l?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,i,n){var s=t.data,a=t.data.identifier;if(n){if(i.trackedPointers[a]||(i.trackedPointers[a]=new tn(a)),this.dispatchEvent(i,"pointerdown",t),s.pointerType==="touch")this.dispatchEvent(i,"touchstart",t);else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;o?i.trackedPointers[a].rightDown=!0:i.trackedPointers[a].leftDown=!0,this.dispatchEvent(i,o?"rightdown":"mousedown",t)}}},e.prototype.onPointerComplete=function(t,i,n){var s=this.normalizeToPointerData(t),a=s.length,o=t.target;t.composedPath&&t.composedPath().length>0&&(o=t.composedPath()[0]);for(var h=o!==this.interactionDOMElement?"outside":"",u=0;u<a;u++){var l=s[u],f=this.getInteractionDataForPointerId(l),c=this.configureInteractionEventForDOMEvent(this.eventData,l,f);if(c.data.originalEvent=t,this.processInteractive(c,this.lastObjectRendered,n,i||!h),this.emit(i?"pointercancel":"pointerup"+h,c),l.pointerType==="mouse"||l.pointerType==="pen"){var d=l.button===2;this.emit(d?"rightup"+h:"mouseup"+h,c)}else l.pointerType==="touch"&&(this.emit(i?"touchcancel":"touchend"+h,c),this.releaseInteractionDataForPointerId(l.pointerId))}},e.prototype.onPointerCancel=function(t){this.supportsTouchEvents&&t.pointerType==="touch"||this.onPointerComplete(t,!0,this.processPointerCancel)},e.prototype.processPointerCancel=function(t,i){var n=t.data,s=t.data.identifier;i.trackedPointers[s]!==void 0&&(delete i.trackedPointers[s],this.dispatchEvent(i,"pointercancel",t),n.pointerType==="touch"&&this.dispatchEvent(i,"touchcancel",t))},e.prototype.onPointerUp=function(t){this.supportsTouchEvents&&t.pointerType==="touch"||this.onPointerComplete(t,!1,this.processPointerUp)},e.prototype.processPointerUp=function(t,i,n){var s=t.data,a=t.data.identifier,o=i.trackedPointers[a],h=s.pointerType==="touch",u=s.pointerType==="mouse"||s.pointerType==="pen",l=!1;if(u){var f=s.button===2,c=tn.FLAGS,d=f?c.RIGHT_DOWN:c.LEFT_DOWN,p=o!==void 0&&o.flags&d;n?(this.dispatchEvent(i,f?"rightup":"mouseup",t),p&&(this.dispatchEvent(i,f?"rightclick":"click",t),l=!0)):p&&this.dispatchEvent(i,f?"rightupoutside":"mouseupoutside",t),o&&(f?o.rightDown=!1:o.leftDown=!1)}n?(this.dispatchEvent(i,"pointerup",t),h&&this.dispatchEvent(i,"touchend",t),o&&((!u||l)&&this.dispatchEvent(i,"pointertap",t),h&&(this.dispatchEvent(i,"tap",t),o.over=!1))):o&&(this.dispatchEvent(i,"pointerupoutside",t),h&&this.dispatchEvent(i,"touchendoutside",t)),o&&o.none&&delete i.trackedPointers[a]},e.prototype.onPointerMove=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t);(i[0].pointerType==="mouse"||i[0].pointerType==="pen")&&(this._didMove=!0,this.cursor=null);for(var n=i.length,s=0;s<n;s++){var a=i[s],o=this.getInteractionDataForPointerId(a),h=this.configureInteractionEventForDOMEvent(this.eventData,a,o);h.data.originalEvent=t,this.processInteractive(h,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",h),a.pointerType==="touch"&&this.emit("touchmove",h),(a.pointerType==="mouse"||a.pointerType==="pen")&&this.emit("mousemove",h)}i[0].pointerType==="mouse"&&this.setCursorMode(this.cursor)}},e.prototype.processPointerMove=function(t,i,n){var s=t.data,a=s.pointerType==="touch",o=s.pointerType==="mouse"||s.pointerType==="pen";o&&this.processPointerOverOut(t,i,n),(!this.moveWhenInside||n)&&(this.dispatchEvent(i,"pointermove",t),a&&this.dispatchEvent(i,"touchmove",t),o&&this.dispatchEvent(i,"mousemove",t))},e.prototype.onPointerOut=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t),n=i[0];n.pointerType==="mouse"&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var s=this.getInteractionDataForPointerId(n),a=this.configureInteractionEventForDOMEvent(this.eventData,n,s);a.data.originalEvent=n,this.processInteractive(a,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",a),n.pointerType==="mouse"||n.pointerType==="pen"?this.emit("mouseout",a):this.releaseInteractionDataForPointerId(s.identifier)}},e.prototype.processPointerOverOut=function(t,i,n){var s=t.data,a=t.data.identifier,o=s.pointerType==="mouse"||s.pointerType==="pen",h=i.trackedPointers[a];n&&!h&&(h=i.trackedPointers[a]=new tn(a)),h!==void 0&&(n&&this.mouseOverRenderer?(h.over||(h.over=!0,this.delayDispatchEvent(i,"pointerover",t),o&&this.delayDispatchEvent(i,"mouseover",t)),o&&this.cursor===null&&(this.cursor=i.cursor)):h.over&&(h.over=!1,this.dispatchEvent(i,"pointerout",this.eventData),o&&this.dispatchEvent(i,"mouseout",t),h.none&&delete i.trackedPointers[a]))},e.prototype.onPointerOver=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t),n=i[0],s=this.getInteractionDataForPointerId(n),a=this.configureInteractionEventForDOMEvent(this.eventData,n,s);a.data.originalEvent=n,n.pointerType==="mouse"&&(this.mouseOverRenderer=!0),this.emit("pointerover",a),(n.pointerType==="mouse"||n.pointerType==="pen")&&this.emit("mouseover",a)}},e.prototype.getInteractionDataForPointerId=function(t){var i=t.pointerId,n;return i===Wi||t.pointerType==="mouse"?n=this.mouse:this.activeInteractionData[i]?n=this.activeInteractionData[i]:(n=this.interactionDataPool.pop()||new aa,n.identifier=i,this.activeInteractionData[i]=n),n.copyEvent(t),n},e.prototype.releaseInteractionDataForPointerId=function(t){var i=this.activeInteractionData[t];i&&(delete this.activeInteractionData[t],i.reset(),this.interactionDataPool.push(i))},e.prototype.configureInteractionEventForDOMEvent=function(t,i,n){return t.data=n,this.mapPositionToPoint(n.global,i.clientX,i.clientY),i.pointerType==="touch"&&(i.globalX=n.global.x,i.globalY=n.global.y),n.originalEvent=i,t.reset(),t},e.prototype.normalizeToPointerData=function(t){var i=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(var n=0,s=t.changedTouches.length;n<s;n++){var a=t.changedTouches[n];typeof a.button>"u"&&(a.button=t.touches.length?1:0),typeof a.buttons>"u"&&(a.buttons=t.touches.length?1:0),typeof a.isPrimary>"u"&&(a.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof a.width>"u"&&(a.width=a.radiusX||1),typeof a.height>"u"&&(a.height=a.radiusY||1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="touch"),typeof a.pointerId>"u"&&(a.pointerId=a.identifier||0),typeof a.pressure>"u"&&(a.pressure=a.force||.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),typeof a.layerX>"u"&&(a.layerX=a.offsetX=a.clientX),typeof a.layerY>"u"&&(a.layerY=a.offsetY=a.clientY),a.isNormalized=!0,i.push(a)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){var o=t;typeof o.isPrimary>"u"&&(o.isPrimary=!0),typeof o.width>"u"&&(o.width=1),typeof o.height>"u"&&(o.height=1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="mouse"),typeof o.pointerId>"u"&&(o.pointerId=Wi),typeof o.pressure>"u"&&(o.pressure=.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),o.isNormalized=!0,i.push(o)}else i.push(t);return i},e.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},e.extension={name:"interaction",type:[tt.RendererPlugin,tt.CanvasRendererPlugin]},e}(Ve);var oa=new j,ha=4,nd=function(){function r(e){this.renderer=e}return r.prototype.image=function(e,t,i){var n=new Image;return n.src=this.base64(e,t,i),n},r.prototype.base64=function(e,t,i){return this.canvas(e).toDataURL(t,i)},r.prototype.canvas=function(e,t){var i=this.renderer,n,s=!1,a,o=!1;e&&(e instanceof Te?a=e:(a=this.renderer.generateTexture(e),o=!0)),a?(n=a.baseTexture.resolution,t=t??a.frame,s=!1,i.renderTexture.bind(a)):(n=i.resolution,t||(t=oa,t.width=i.width,t.height=i.height),s=!0,i.renderTexture.bind(null));var h=Math.round(t.width*n),u=Math.round(t.height*n),l=new Ps(h,u,1),f=new Uint8Array(ha*h*u),c=i.gl;c.readPixels(Math.round(t.x*n),Math.round(t.y*n),h,u,c.RGBA,c.UNSIGNED_BYTE,f);var d=l.context.getImageData(0,0,h,u);if(r.arrayPostDivide(f,d.data),l.context.putImageData(d,0,0),s){var p=new Ps(l.width,l.height,1);p.context.scale(1,-1),p.context.drawImage(l.canvas,0,-u),l.destroy(),l=p}return o&&a.destroy(!0),l.canvas},r.prototype.pixels=function(e,t){var i=this.renderer,n,s,a=!1;e&&(e instanceof Te?s=e:(s=this.renderer.generateTexture(e),a=!0)),s?(n=s.baseTexture.resolution,t=t??s.frame,i.renderTexture.bind(s)):(n=i.resolution,t||(t=oa,t.width=i.width,t.height=i.height),i.renderTexture.bind(null));var o=Math.round(t.width*n),h=Math.round(t.height*n),u=new Uint8Array(ha*o*h),l=i.gl;return l.readPixels(Math.round(t.x*n),Math.round(t.y*n),o,h,l.RGBA,l.UNSIGNED_BYTE,u),a&&s.destroy(!0),r.arrayPostDivide(u,u),u},r.prototype.destroy=function(){this.renderer=null},r.arrayPostDivide=function(e,t){for(var i=0;i<e.length;i+=4){var n=t[i+3]=e[i+3];n!==0?(t[i]=Math.round(Math.min(e[i]*255/n,255)),t[i+1]=Math.round(Math.min(e[i+1]*255/n,255)),t[i+2]=Math.round(Math.min(e[i+2]*255/n,255))):(t[i]=e[i],t[i+1]=e[i+1],t[i+2]=e[i+2])}},r.extension={name:"extract",type:tt.RendererPlugin},r}();var zi=function(){function r(e,t,i){t===void 0&&(t=!1),this._fn=e,this._once=t,this._thisArg=i,this._next=this._prev=this._owner=null}return r.prototype.detach=function(){return this._owner===null?!1:(this._owner.detach(this),!0)},r}();function ua(r,e){return r._head?(r._tail._next=e,e._prev=r._tail,r._tail=e):(r._head=e,r._tail=e),e._owner=r,e}var ie=function(){function r(){this._head=this._tail=void 0}return r.prototype.handlers=function(e){e===void 0&&(e=!1);var t=this._head;if(e)return!!t;for(var i=[];t;)i.push(t),t=t._next;return i},r.prototype.has=function(e){if(!(e instanceof zi))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return e._owner===this},r.prototype.dispatch=function(){for(var e=arguments,t=[],i=0;i<arguments.length;i++)t[i]=e[i];var n=this._head;if(!n)return!1;for(;n;)n._once&&this.detach(n),n._fn.apply(n._thisArg,t),n=n._next;return!0},r.prototype.add=function(e,t){if(t===void 0&&(t=null),typeof e!="function")throw new Error("MiniSignal#add(): First arg must be a Function.");return ua(this,new zi(e,!1,t))},r.prototype.once=function(e,t){if(t===void 0&&(t=null),typeof e!="function")throw new Error("MiniSignal#once(): First arg must be a Function.");return ua(this,new zi(e,!0,t))},r.prototype.detach=function(e){if(!(e instanceof zi))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return e._owner!==this?this:(e._prev&&(e._prev._next=e._next),e._next&&(e._next._prev=e._prev),e===this._head?(this._head=e._next,e._next===null&&(this._tail=null)):e===this._tail&&(this._tail=e._prev,this._tail._next=null),e._owner=null,this)},r.prototype.detachAll=function(){var e=this._head;if(!e)return this;for(this._head=this._tail=null;e;)e._owner=null,e=e._next;return this},r}();function la(r,e){e=e||{};for(var t={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},i=t.parser[e.strictMode?"strict":"loose"].exec(r),n={},s=14;s--;)n[t.key[s]]=i[s]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,function(a,o,h){o&&(n[t.q.name][o]=h)}),n}var en,Yi=null,sd=0,fa=200,ad=204,od=1223,hd=2;function ca(){}function da(r,e,t){e&&e.indexOf(".")===0&&(e=e.substring(1)),e&&(r[e]=t)}function rn(r){return r.toString().replace("object ","")}var ct=function(){function r(e,t,i){if(this._dequeue=ca,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=null,this._boundOnError=null,this._boundOnProgress=null,this._boundOnTimeout=null,this._boundXhrOnError=null,this._boundXhrOnTimeout=null,this._boundXhrOnAbort=null,this._boundXhrOnLoad=null,typeof e!="string"||typeof t!="string")throw new Error("Both name and url are required for constructing a resource.");i=i||{},this._flags=0,this._setFlag(r.STATUS_FLAGS.DATA_URL,t.indexOf("data:")===0),this.name=e,this.url=t,this.extension=this._getExtension(),this.data=null,this.crossOrigin=i.crossOrigin===!0?"anonymous":i.crossOrigin,this.timeout=i.timeout||0,this.loadType=i.loadType||this._determineLoadType(),this.xhrType=i.xhrType,this.metadata=i.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=r.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=ca,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new ie,this.onProgress=new ie,this.onComplete=new ie,this.onAfterMiddleware=new ie}return r.setExtensionLoadType=function(e,t){da(r._loadTypeMap,e,t)},r.setExtensionXhrType=function(e,t){da(r._xhrTypeMap,e,t)},Object.defineProperty(r.prototype,"isDataUrl",{get:function(){return this._hasFlag(r.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isComplete",{get:function(){return this._hasFlag(r.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isLoading",{get:function(){return this._hasFlag(r.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),r.prototype.complete=function(){this._clearEvents(),this._finish()},r.prototype.abort=function(e){if(!this.error){if(this.error=new Error(e),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=r.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},r.prototype.load=function(e){var t=this;if(!this.isLoading){if(this.isComplete){e&&setTimeout(function(){return e(t)},1);return}else e&&this.onComplete.once(e);switch(this._setFlag(r.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),(this.crossOrigin===!1||typeof this.crossOrigin!="string")&&(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case r.LOAD_TYPE.IMAGE:this.type=r.TYPE.IMAGE,this._loadElement("image");break;case r.LOAD_TYPE.AUDIO:this.type=r.TYPE.AUDIO,this._loadSourceElement("audio");break;case r.LOAD_TYPE.VIDEO:this.type=r.TYPE.VIDEO,this._loadSourceElement("video");break;case r.LOAD_TYPE.XHR:default:typeof en>"u"&&(en=!!(globalThis.XDomainRequest&&!("withCredentials"in new XMLHttpRequest))),en&&this.crossOrigin?this._loadXdr():this._loadXhr();break}}},r.prototype._hasFlag=function(e){return(this._flags&e)!==0},r.prototype._setFlag=function(e,t){this._flags=t?this._flags|e:this._flags&~e},r.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},r.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(r.STATUS_FLAGS.COMPLETE,!0),this._setFlag(r.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},r.prototype._loadElement=function(e){this.metadata.loadElement?this.data=this.metadata.loadElement:e==="image"&&typeof globalThis.Image<"u"?this.data=new Image:this.data=document.createElement(e),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},r.prototype._loadSourceElement=function(e){if(this.metadata.loadElement?this.data=this.metadata.loadElement:e==="audio"&&typeof globalThis.Audio<"u"?this.data=new Audio:this.data=document.createElement(e),this.data===null){this.abort("Unsupported element: "+e);return}if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var t=this.metadata.mimeType,i=0;i<this.url.length;++i)this.data.appendChild(this._createSource(e,this.url[i],Array.isArray(t)?t[i]:t));else{var t=this.metadata.mimeType;this.data.appendChild(this._createSource(e,this.url,Array.isArray(t)?t[0]:t))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},r.prototype._loadXhr=function(){typeof this.xhrType!="string"&&(this.xhrType=this._determineXhrType());var e=this.xhr=new XMLHttpRequest;this.crossOrigin==="use-credentials"&&(e.withCredentials=!0),e.open("GET",this.url,!0),e.timeout=this.timeout,this.xhrType===r.XHR_RESPONSE_TYPE.JSON||this.xhrType===r.XHR_RESPONSE_TYPE.DOCUMENT?e.responseType=r.XHR_RESPONSE_TYPE.TEXT:e.responseType=this.xhrType,e.addEventListener("error",this._boundXhrOnError,!1),e.addEventListener("timeout",this._boundXhrOnTimeout,!1),e.addEventListener("abort",this._boundXhrOnAbort,!1),e.addEventListener("progress",this._boundOnProgress,!1),e.addEventListener("load",this._boundXhrOnLoad,!1),e.send()},r.prototype._loadXdr=function(){typeof this.xhrType!="string"&&(this.xhrType=this._determineXhrType());var e=this.xhr=new globalThis.XDomainRequest;e.timeout=this.timeout||5e3,e.onerror=this._boundXhrOnError,e.ontimeout=this._boundXhrOnTimeout,e.onprogress=this._boundOnProgress,e.onload=this._boundXhrOnLoad,e.open("GET",this.url,!0),setTimeout(function(){return e.send()},1)},r.prototype._createSource=function(e,t,i){i||(i=e+"/"+this._getExtension(t));var n=document.createElement("source");return n.src=t,n.type=i,n},r.prototype._onError=function(e){this.abort("Failed to load element using: "+e.target.nodeName)},r.prototype._onProgress=function(e){e&&e.lengthComputable&&this.onProgress.dispatch(this,e.loaded/e.total)},r.prototype._onTimeout=function(){this.abort("Load timed out.")},r.prototype._xhrOnError=function(){var e=this.xhr;this.abort(rn(e)+" Request failed. Status: "+e.status+', text: "'+e.statusText+'"')},r.prototype._xhrOnTimeout=function(){var e=this.xhr;this.abort(rn(e)+" Request timed out.")},r.prototype._xhrOnAbort=function(){var e=this.xhr;this.abort(rn(e)+" Request was aborted by the user.")},r.prototype._xhrOnLoad=function(){var e=this.xhr,t="",i=typeof e.status>"u"?fa:e.status;(e.responseType===""||e.responseType==="text"||typeof e.responseType>"u")&&(t=e.responseText),i===sd&&(t.length>0||e.responseType===r.XHR_RESPONSE_TYPE.BUFFER)?i=fa:i===od&&(i=ad);var n=i/100|0;if(n===hd)if(this.xhrType===r.XHR_RESPONSE_TYPE.TEXT)this.data=t,this.type=r.TYPE.TEXT;else if(this.xhrType===r.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(t),this.type=r.TYPE.JSON}catch(o){this.abort("Error trying to parse loaded json: "+o);return}else if(this.xhrType===r.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var s=new DOMParser;this.data=s.parseFromString(t,"text/xml")}else{var a=document.createElement("div");a.innerHTML=t,this.data=a}this.type=r.TYPE.XML}catch(o){this.abort("Error trying to parse loaded xml: "+o);return}else this.data=e.response||t;else{this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL);return}this.complete()},r.prototype._determineCrossOrigin=function(e,t){if(e.indexOf("data:")===0)return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";t=t||globalThis.location,Yi||(Yi=document.createElement("a")),Yi.href=e;var i=la(Yi.href,{strictMode:!0}),n=!i.port&&t.port===""||i.port===t.port,s=i.protocol?i.protocol+":":"";return i.host!==t.hostname||!n||s!==t.protocol?"anonymous":""},r.prototype._determineXhrType=function(){return r._xhrTypeMap[this.extension]||r.XHR_RESPONSE_TYPE.TEXT},r.prototype._determineLoadType=function(){return r._loadTypeMap[this.extension]||r.LOAD_TYPE.XHR},r.prototype._getExtension=function(e){e===void 0&&(e=this.url);var t="";if(this.isDataUrl){var i=e.indexOf("/");t=e.substring(i+1,e.indexOf(";",i))}else{var n=e.indexOf("?"),s=e.indexOf("#"),a=Math.min(n>-1?n:e.length,s>-1?s:e.length);e=e.substring(0,a),t=e.substring(e.lastIndexOf(".")+1)}return t.toLowerCase()},r.prototype._getMimeFromXhrType=function(e){switch(e){case r.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case r.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case r.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case r.XHR_RESPONSE_TYPE.JSON:return"application/json";case r.XHR_RESPONSE_TYPE.DEFAULT:case r.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},r}();(function(r){(function(e){e[e.NONE=0]="NONE",e[e.DATA_URL=1]="DATA_URL",e[e.COMPLETE=2]="COMPLETE",e[e.LOADING=4]="LOADING"})(r.STATUS_FLAGS||(r.STATUS_FLAGS={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.JSON=1]="JSON",e[e.XML=2]="XML",e[e.IMAGE=3]="IMAGE",e[e.AUDIO=4]="AUDIO",e[e.VIDEO=5]="VIDEO",e[e.TEXT=6]="TEXT"}(r.TYPE||(r.TYPE={})),function(e){e[e.XHR=1]="XHR",e[e.IMAGE=2]="IMAGE",e[e.AUDIO=3]="AUDIO",e[e.VIDEO=4]="VIDEO"}(r.LOAD_TYPE||(r.LOAD_TYPE={})),function(e){e.DEFAULT="text",e.BUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.TEXT="text"}(r.XHR_RESPONSE_TYPE||(r.XHR_RESPONSE_TYPE={})),r._loadTypeMap={gif:r.LOAD_TYPE.IMAGE,png:r.LOAD_TYPE.IMAGE,bmp:r.LOAD_TYPE.IMAGE,jpg:r.LOAD_TYPE.IMAGE,jpeg:r.LOAD_TYPE.IMAGE,tif:r.LOAD_TYPE.IMAGE,tiff:r.LOAD_TYPE.IMAGE,webp:r.LOAD_TYPE.IMAGE,tga:r.LOAD_TYPE.IMAGE,avif:r.LOAD_TYPE.IMAGE,svg:r.LOAD_TYPE.IMAGE,"svg+xml":r.LOAD_TYPE.IMAGE,mp3:r.LOAD_TYPE.AUDIO,ogg:r.LOAD_TYPE.AUDIO,wav:r.LOAD_TYPE.AUDIO,mp4:r.LOAD_TYPE.VIDEO,webm:r.LOAD_TYPE.VIDEO},r._xhrTypeMap={xhtml:r.XHR_RESPONSE_TYPE.DOCUMENT,html:r.XHR_RESPONSE_TYPE.DOCUMENT,htm:r.XHR_RESPONSE_TYPE.DOCUMENT,xml:r.XHR_RESPONSE_TYPE.DOCUMENT,tmx:r.XHR_RESPONSE_TYPE.DOCUMENT,svg:r.XHR_RESPONSE_TYPE.DOCUMENT,tsx:r.XHR_RESPONSE_TYPE.DOCUMENT,gif:r.XHR_RESPONSE_TYPE.BLOB,png:r.XHR_RESPONSE_TYPE.BLOB,bmp:r.XHR_RESPONSE_TYPE.BLOB,jpg:r.XHR_RESPONSE_TYPE.BLOB,jpeg:r.XHR_RESPONSE_TYPE.BLOB,tif:r.XHR_RESPONSE_TYPE.BLOB,tiff:r.XHR_RESPONSE_TYPE.BLOB,webp:r.XHR_RESPONSE_TYPE.BLOB,tga:r.XHR_RESPONSE_TYPE.BLOB,avif:r.XHR_RESPONSE_TYPE.BLOB,json:r.XHR_RESPONSE_TYPE.JSON,text:r.XHR_RESPONSE_TYPE.TEXT,txt:r.XHR_RESPONSE_TYPE.TEXT,ttf:r.XHR_RESPONSE_TYPE.BUFFER,otf:r.XHR_RESPONSE_TYPE.BUFFER},r.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})(ct||(ct={}));function Pe(){}function ud(r){return function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];if(r===null)throw new Error("Callback was already called.");var s=r;r=null,s.apply(this,i)}}var ld=function(){function r(e,t){this.data=e,this.callback=t}return r}(),nn=function(){function r(e,t){var i=this;if(t===void 0&&(t=1),this.workers=0,this.saturated=Pe,this.unsaturated=Pe,this.empty=Pe,this.drain=Pe,this.error=Pe,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(n,s,a){if(a&&typeof a!="function")throw new Error("task callback must be a function");if(i.started=!0,n==null&&i.idle()){setTimeout(function(){return i.drain()},1);return}var o=new ld(n,typeof a=="function"?a:Pe);s?i._tasks.unshift(o):i._tasks.push(o),setTimeout(i.process,1)},this.process=function(){for(;!i.paused&&i.workers<i.concurrency&&i._tasks.length;){var n=i._tasks.shift();i._tasks.length===0&&i.empty(),i.workers+=1,i.workers===i.concurrency&&i.saturated(),i._worker(n.data,ud(i._next(n)))}},this._worker=e,t===0)throw new Error("Concurrency must not be zero");this.concurrency=t,this.buffer=t/4}return r.prototype._next=function(e){var t=this;return function(){for(var i=arguments,n=[],s=0;s<arguments.length;s++)n[s]=i[s];t.workers-=1,e.callback.apply(e,n),n[0]!=null&&t.error(n[0],e.data),t.workers<=t.concurrency-t.buffer&&t.unsaturated(),t.idle()&&t.drain(),t.process()}},r.prototype.push=function(e,t){this._insert(e,!1,t)},r.prototype.kill=function(){this.workers=0,this.drain=Pe,this.started=!1,this._tasks=[]},r.prototype.unshift=function(e,t){this._insert(e,!0,t)},r.prototype.length=function(){return this._tasks.length},r.prototype.running=function(){return this.workers},r.prototype.idle=function(){return this._tasks.length+this.workers===0},r.prototype.pause=function(){this.paused!==!0&&(this.paused=!0)},r.prototype.resume=function(){if(this.paused!==!1){this.paused=!1;for(var e=1;e<=this.concurrency;e++)this.process()}},r.eachSeries=function(e,t,i,n){var s=0,a=e.length;function o(h){if(h||s===a){i&&i(h);return}n?setTimeout(function(){t(e[s++],o)},1):t(e[s++],o)}o()},r.queue=function(e,t){return new r(e,t)},r}(),sn=100,fd=/(#[\w-]+)?$/,Vi=function(){function r(e,t){var i=this;e===void 0&&(e=""),t===void 0&&(t=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(h,u){return i._loadResource(h,u)},this.resources={},this.baseUrl=e,this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(h,u){return i._loadResource(h,u)},this._queue=nn.queue(this._boundLoadResource,t),this._queue.pause(),this.resources={},this.onProgress=new ie,this.onError=new ie,this.onLoad=new ie,this.onStart=new ie,this.onComplete=new ie;for(var n=0;n<r._plugins.length;++n){var s=r._plugins[n],a=s.pre,o=s.use;a&&this.pre(a),o&&this.use(o)}this._protected=!1}return r.prototype._add=function(e,t,i,n){if(this.loading&&(!i||!i.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[e])throw new Error('Resource named "'+e+'" already exists.');if(t=this._prepareUrl(t),this.resources[e]=new ct(e,t,i),typeof n=="function"&&this.resources[e].onAfterMiddleware.once(n),this.loading){for(var s=i.parentResource,a=[],o=0;o<s.children.length;++o)s.children[o].isComplete||a.push(s.children[o]);var h=s.progressChunk*(a.length+1),u=h/(a.length+2);s.children.push(this.resources[e]),s.progressChunk=u;for(var o=0;o<a.length;++o)a[o].progressChunk=u;this.resources[e].progressChunk=u}return this._queue.push(this.resources[e]),this},r.prototype.pre=function(e){return this._beforeMiddleware.push(e),this},r.prototype.use=function(e){return this._afterMiddleware.push(e),this},r.prototype.reset=function(){this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause();for(var e in this.resources){var t=this.resources[e];t._onLoadBinding&&t._onLoadBinding.detach(),t.isLoading&&t.abort("loader reset")}return this.resources={},this},r.prototype.load=function(e){if(Ut("6.5.0","@pixi/loaders is being replaced with @pixi/assets in the next major release."),typeof e=="function"&&this.onComplete.once(e),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var t=this._queue._tasks.length,i=sn/t,n=0;n<this._queue._tasks.length;++n)this._queue._tasks[n].data.progressChunk=i;this._onStart(),this._queue.resume()}return this},Object.defineProperty(r.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(e){this._queue.concurrency=e},enumerable:!1,configurable:!0}),r.prototype._prepareUrl=function(e){var t=la(e,{strictMode:!0}),i;if(t.protocol||!t.path||e.indexOf("//")===0?i=e:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&e.charAt(0)!=="/"?i=this.baseUrl+"/"+e:i=this.baseUrl+e,this.defaultQueryString){var n=fd.exec(i)[0];i=i.slice(0,i.length-n.length),i.indexOf("?")!==-1?i+="&"+this.defaultQueryString:i+="?"+this.defaultQueryString,i+=n}return i},r.prototype._loadResource=function(e,t){var i=this;e._dequeue=t,nn.eachSeries(this._beforeMiddleware,function(n,s){n.call(i,e,function(){s(e.isComplete?{}:null)})},function(){e.isComplete?i._onLoad(e):(e._onLoadBinding=e.onComplete.once(i._onLoad,i),e.load())},!0)},r.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},r.prototype._onComplete=function(){this.progress=sn,this.loading=!1,this.onComplete.dispatch(this,this.resources)},r.prototype._onLoad=function(e){var t=this;e._onLoadBinding=null,this._resourcesParsing.push(e),e._dequeue(),nn.eachSeries(this._afterMiddleware,function(i,n){i.call(t,e,n)},function(){e.onAfterMiddleware.dispatch(e),t.progress=Math.min(sn,t.progress+e.progressChunk),t.onProgress.dispatch(t,e),e.error?t.onError.dispatch(e.error,t,e):t.onLoad.dispatch(t,e),t._resourcesParsing.splice(t._resourcesParsing.indexOf(e),1),t._queue.idle()&&t._resourcesParsing.length===0&&t._onComplete()},!0)},r.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(r,"shared",{get:function(){var e=r._shared;return e||(e=new r,e._protected=!0,r._shared=e),e},enumerable:!1,configurable:!0}),r.registerPlugin=function(e){return Ut("6.5.0","Loader.registerPlugin() is deprecated, use extensions.add() instead."),ee.add({type:tt.Loader,ref:e}),r},r._plugins=[],r}();ee.handleByList(tt.Loader,Vi._plugins),Vi.prototype.add=function(e,t,i,n){if(Array.isArray(e)){for(var s=0;s<e.length;++s)this.add(e[s]);return this}if(typeof e=="object"&&(i=e,n=t||i.callback||i.onComplete,t=i.url,e=i.name||i.key||i.url),typeof t!="string"&&(n=i,i=t,t=e),typeof t!="string")throw new Error("No url passed to add resource to loader.");return typeof i=="function"&&(n=i,i=null),this._add(e,t,i,n)};var cd=function(){function r(){}return r.init=function(e){e=Object.assign({sharedLoader:!1},e),this.loader=e.sharedLoader?Vi.shared:new Vi},r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.extension=tt.Application,r}(),dd=function(){function r(){}return r.add=function(){ct.setExtensionLoadType("svg",ct.LOAD_TYPE.XHR),ct.setExtensionXhrType("svg",ct.XHR_RESPONSE_TYPE.TEXT)},r.use=function(e,t){if(e.data&&(e.type===ct.TYPE.IMAGE||e.extension==="svg")){var i=e.data,n=e.url,s=e.name,a=e.metadata;k.fromLoader(i,n,s,a).then(function(o){e.texture=o,t()}).catch(t)}else t()},r.extension=tt.Loader,r}(),pd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function vd(r){for(var e="",t=0;t<r.length;){for(var i=[0,0,0],n=[0,0,0,0],s=0;s<i.length;++s)t<r.length?i[s]=r.charCodeAt(t++)&255:i[s]=0;n[0]=i[0]>>2,n[1]=(i[0]&3)<<4|i[1]>>4,n[2]=(i[1]&15)<<2|i[2]>>6,n[3]=i[2]&63;var a=t-(r.length-1);switch(a){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64;break}for(var s=0;s<n.length;++s)e+=pd.charAt(n[s])}return e}function _d(r,e){if(!r.data){e();return}if(r.xhr&&r.xhrType===ct.XHR_RESPONSE_TYPE.BLOB){if(!self.Blob||typeof r.data=="string"){var t=r.xhr.getResponseHeader("content-type");if(t&&t.indexOf("image")===0){r.data=new Image,r.data.src="data:"+t+";base64,"+vd(r.xhr.responseText),r.type=ct.TYPE.IMAGE,r.data.onload=function(){r.data.onload=null,e()};return}}else if(r.data.type.indexOf("image")===0){var i=globalThis.URL||globalThis.webkitURL,n=i.createObjectURL(r.data);r.blob=r.data,r.data=new Image,r.data.src=n,r.type=ct.TYPE.IMAGE,r.data.onload=function(){i.revokeObjectURL(n),r.data.onload=null,e()};return}}e()}var md=function(){function r(){}return r.extension=tt.Loader,r.use=_d,r}();ee.add(dd,md);var J,H;(function(r){r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR"})(H||(H={}));var qi=(J={},J[H.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,J[H.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,J[H.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,J[H.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,J[H.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,J[H.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,J[H.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,J[H.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,J[H.COMPRESSED_R11_EAC]=.5,J[H.COMPRESSED_SIGNED_R11_EAC]=.5,J[H.COMPRESSED_RG11_EAC]=1,J[H.COMPRESSED_SIGNED_RG11_EAC]=1,J[H.COMPRESSED_RGB8_ETC2]=.5,J[H.COMPRESSED_RGBA8_ETC2_EAC]=1,J[H.COMPRESSED_SRGB8_ETC2]=.5,J[H.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=1,J[H.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,J[H.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,J[H.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,J[H.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,J[H.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,J[H.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,J[H.COMPRESSED_RGB_ETC1_WEBGL]=.5,J[H.COMPRESSED_RGB_ATC_WEBGL]=.5,J[H.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,J[H.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,J[H.COMPRESSED_RGBA_ASTC_4x4_KHR]=1,J);var an=function(r,e){return an=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},an(r,e)};function pa(r,e){an(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function gd(r,e,t,i){function n(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(l){try{u(i.next(l))}catch(f){a(f)}}function h(l){try{u(i.throw(l))}catch(f){a(f)}}function u(l){l.done?s(l.value):n(l.value).then(o,h)}u((i=i.apply(r,e||[])).next())})}function yd(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(l){return h([u,l])}}function h(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(l){u=[6,l],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var xd=function(r){pa(e,r);function e(t,i){i===void 0&&(i={width:1,height:1,autoLoad:!0});var n=this,s,a;return typeof t=="string"?(s=t,a=new Uint8Array):(s=null,a=t),n=r.call(this,a,i)||this,n.origin=s,n.buffer=a?new Qr(a):null,n.origin&&i.autoLoad!==!1&&n.load(),a&&a.length&&(n.loaded=!0,n.onBlobLoaded(n.buffer.rawBinaryData)),n}return e.prototype.onBlobLoaded=function(t){},e.prototype.load=function(){return gd(this,void 0,Promise,function(){var t,i,n;return yd(this,function(s){switch(s.label){case 0:return[4,fetch(this.origin)];case 1:return t=s.sent(),[4,t.blob()];case 2:return i=s.sent(),[4,i.arrayBuffer()];case 3:return n=s.sent(),this.data=new Uint32Array(n),this.buffer=new Qr(n),this.loaded=!0,this.onBlobLoaded(n),this.update(),[2,this]}})})},e}(ei),on=function(r){pa(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.format=i.format,n.levels=i.levels||1,n._width=i.width,n._height=i.height,n._extension=e._formatToExtension(n.format),(i.levelBuffers||n.buffer)&&(n._levelBuffers=i.levelBuffers||e._createLevelBuffers(t instanceof Uint8Array?t:n.buffer.uint8View,n.format,n.levels,4,4,n.width,n.height)),n}return e.prototype.upload=function(t,i,n){var s=t.gl,a=t.context.extensions[this._extension];if(!a)throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var o=0,h=this.levels;o<h;o++){var u=this._levelBuffers[o],l=u.levelID,f=u.levelWidth,c=u.levelHeight,d=u.levelBuffer;s.compressedTexImage2D(s.TEXTURE_2D,l,this.format,f,c,0,d)}return!0},e.prototype.onBlobLoaded=function(){this._levelBuffers=e._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},e._formatToExtension=function(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},e._createLevelBuffers=function(t,i,n,s,a,o,h){for(var u=new Array(n),l=t.byteOffset,f=o,c=h,d=f+s-1&~(s-1),p=c+a-1&~(a-1),v=d*p*qi[i],_=0;_<n;_++)u[_]={levelID:_,levelWidth:n>1?f:d,levelHeight:n>1?c:p,levelBuffer:new Uint8Array(t.buffer,l,v)},l+=v,f=f>>1||1,c=c>>1||1,d=f+s-1&~(s-1),p=c+a-1&~(a-1),v=d*p*qi[i];return u},e}(xd),bd=function(){function r(){}return r.use=function(e,t){var i=e.data,n=this;if(e.type===ct.TYPE.JSON&&i&&i.cacheID&&i.textures){for(var s=i.textures,a=void 0,o=void 0,h=0,u=s.length;h<u;h++){var l=s[h],f=l.src,c=l.format;if(c||(o=f),r.textureFormats[c]){a=f;break}}if(a=a||o,!a){t(new Error("Cannot load compressed-textures in "+e.url+", make sure you provide a fallback"));return}if(a===e.url){t(new Error("URL of compressed texture cannot be the same as the manifest's URL"));return}var d={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},p=Ne.resolve(e.url.replace(n.baseUrl,""),a),v=i.cacheID;n.add(v,p,d,function(_){if(_.error){t(_.error);return}var m=_.texture,g=m===void 0?null:m,y=_.textures,b=y===void 0?{}:y;Object.assign(e,{texture:g,textures:b}),t()})}else t()},Object.defineProperty(r,"textureExtensions",{get:function(){if(!r._textureExtensions){var e=F.ADAPTER.createCanvas(),t=e.getContext("webgl");if(!t)return console.warn("WebGL not available for compressed textures. Silently failing."),{};var i={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")};r._textureExtensions=i}return r._textureExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(r,"textureFormats",{get:function(){if(!r._textureFormats){var e=r.textureExtensions;r._textureFormats={};for(var t in e){var i=e[t];i&&Object.assign(r._textureFormats,Object.getPrototypeOf(i))}}return r._textureFormats},enumerable:!1,configurable:!0}),r.extension=tt.Loader,r}();function va(r,e,t){var i={textures:{},texture:null};if(!e)return i;var n=e.map(function(s){return new k(new V(s,Object.assign({mipmap:Ft.OFF,alphaMode:Nt.NO_PREMULTIPLIED_ALPHA},t)))});return n.forEach(function(s,a){var o=s.baseTexture,h=r+"-"+(a+1);V.addToCache(o,h),k.addToCache(s,h),a===0&&(V.addToCache(o,r),k.addToCache(s,r),i.texture=s),i.textures[h]=s}),i}var oi,Gt,hn=4,$i=124,Td=32,_a=20,wd=542327876,Zi={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Ed={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Ki={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},kt;(function(r){r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"})(kt||(kt={}));var un;(function(r){r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"})(un||(un={}));var Sd=1,Pd=2,Rd=4,Cd=64,Ad=512,Id=131072,Od=827611204,Md=861165636,Dd=894720068,Fd=808540228,Nd=4,Bd=(oi={},oi[Od]=H.COMPRESSED_RGBA_S3TC_DXT1_EXT,oi[Md]=H.COMPRESSED_RGBA_S3TC_DXT3_EXT,oi[Dd]=H.COMPRESSED_RGBA_S3TC_DXT5_EXT,oi),Ld=(Gt={},Gt[kt.DXGI_FORMAT_BC1_TYPELESS]=H.COMPRESSED_RGBA_S3TC_DXT1_EXT,Gt[kt.DXGI_FORMAT_BC1_UNORM]=H.COMPRESSED_RGBA_S3TC_DXT1_EXT,Gt[kt.DXGI_FORMAT_BC2_TYPELESS]=H.COMPRESSED_RGBA_S3TC_DXT3_EXT,Gt[kt.DXGI_FORMAT_BC2_UNORM]=H.COMPRESSED_RGBA_S3TC_DXT3_EXT,Gt[kt.DXGI_FORMAT_BC3_TYPELESS]=H.COMPRESSED_RGBA_S3TC_DXT5_EXT,Gt[kt.DXGI_FORMAT_BC3_UNORM]=H.COMPRESSED_RGBA_S3TC_DXT5_EXT,Gt[kt.DXGI_FORMAT_BC1_UNORM_SRGB]=H.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,Gt[kt.DXGI_FORMAT_BC2_UNORM_SRGB]=H.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,Gt[kt.DXGI_FORMAT_BC3_UNORM_SRGB]=H.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,Gt);function Ud(r){var e=new Uint32Array(r),t=e[0];if(t!==wd)throw new Error("Invalid DDS file magic word");var i=new Uint32Array(r,0,$i/Uint32Array.BYTES_PER_ELEMENT),n=i[Zi.HEIGHT],s=i[Zi.WIDTH],a=i[Zi.MIPMAP_COUNT],o=new Uint32Array(r,Zi.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Td/Uint32Array.BYTES_PER_ELEMENT),h=o[Sd];if(h&Rd){var u=o[Ed.FOURCC];if(u!==Fd){var l=Bd[u],f=hn+$i,c=new Uint8Array(r,f),d=new on(c,{format:l,width:s,height:n,levels:a});return[d]}var p=hn+$i,v=new Uint32Array(e.buffer,p,_a/Uint32Array.BYTES_PER_ELEMENT),_=v[Ki.DXGI_FORMAT],m=v[Ki.RESOURCE_DIMENSION],g=v[Ki.MISC_FLAG],y=v[Ki.ARRAY_SIZE],b=Ld[_];if(b===void 0)throw new Error("DDSParser cannot parse texture data with DXGI format "+_);if(g===Nd)throw new Error("DDSParser does not support cubemap textures");if(m===un.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");var x=new Array,T=hn+$i+_a;if(y===1)x.push(new Uint8Array(r,T));else{for(var w=qi[b],A=0,S=s,E=n,D=0;D<a;D++){var C=Math.max(1,S+3&-4),N=Math.max(1,E+3&-4),W=C*N*w;A+=W,S=S>>>1,E=E>>>1}for(var M=T,D=0;D<y;D++)x.push(new Uint8Array(r,M,A)),M+=A}return x.map(function(O){return new on(O,{format:b,width:s,height:n,levels:a})})}throw h&Cd?new Error("DDSParser does not support uncompressed texture data."):h&Ad?new Error("DDSParser does not supported YUV uncompressed texture data."):h&Id?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&Pd?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}var he,re,hi,ma=[171,75,84,88,32,49,49,187,13,10,26,10],Gd=67305985,Ht={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},ln=64,ga=(he={},he[L.UNSIGNED_BYTE]=1,he[L.UNSIGNED_SHORT]=2,he[L.INT]=4,he[L.UNSIGNED_INT]=4,he[L.FLOAT]=4,he[L.HALF_FLOAT]=8,he),kd=(re={},re[R.RGBA]=4,re[R.RGB]=3,re[R.RG]=2,re[R.RED]=1,re[R.LUMINANCE]=1,re[R.LUMINANCE_ALPHA]=2,re[R.ALPHA]=1,re),Hd=(hi={},hi[L.UNSIGNED_SHORT_4_4_4_4]=2,hi[L.UNSIGNED_SHORT_5_5_5_1]=2,hi[L.UNSIGNED_SHORT_5_6_5]=2,hi);function Xd(r,e,t){t===void 0&&(t=!1);var i=new DataView(e);if(!Wd(r,i))return null;var n=i.getUint32(Ht.ENDIANNESS,!0)===Gd,s=i.getUint32(Ht.GL_TYPE,n),a=i.getUint32(Ht.GL_FORMAT,n),o=i.getUint32(Ht.GL_INTERNAL_FORMAT,n),h=i.getUint32(Ht.PIXEL_WIDTH,n),u=i.getUint32(Ht.PIXEL_HEIGHT,n)||1,l=i.getUint32(Ht.PIXEL_DEPTH,n)||1,f=i.getUint32(Ht.NUMBER_OF_ARRAY_ELEMENTS,n)||1,c=i.getUint32(Ht.NUMBER_OF_FACES,n),d=i.getUint32(Ht.NUMBER_OF_MIPMAP_LEVELS,n),p=i.getUint32(Ht.BYTES_OF_KEY_VALUE_DATA,n);if(u===0||l!==1)throw new Error("Only 2D textures are supported");if(c!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(f!==1)throw new Error("WebGL does not support array textures");var v=4,_=4,m=h+3&-4,g=u+3&-4,y=new Array(f),b=h*u;s===0&&(b=m*g);var x;if(s!==0?ga[s]?x=ga[s]*kd[a]:x=Hd[s]:x=qi[o],x===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var T=t?zd(i,p,n):null,w=b*x,A=w,S=h,E=u,D=m,C=g,N=ln+p,W=0;W<d;W++){for(var M=i.getUint32(N,n),O=N+4,U=0;U<f;U++){var rt=y[U];rt||(rt=y[U]=new Array(d)),rt[W]={levelID:W,levelWidth:d>1||s!==0?S:D,levelHeight:d>1||s!==0?E:C,levelBuffer:new Uint8Array(e,O,A)},O+=A}N+=M+4,N=N%4!==0?N+4-N%4:N,S=S>>1||1,E=E>>1||1,D=S+v-1&~(v-1),C=E+_-1&~(_-1),A=D*C*x}return s!==0?{uncompressed:y.map(function(z){var I=z[0].levelBuffer,P=!1;return s===L.FLOAT?I=new Float32Array(z[0].levelBuffer.buffer,z[0].levelBuffer.byteOffset,z[0].levelBuffer.byteLength/4):s===L.UNSIGNED_INT?(P=!0,I=new Uint32Array(z[0].levelBuffer.buffer,z[0].levelBuffer.byteOffset,z[0].levelBuffer.byteLength/4)):s===L.INT&&(P=!0,I=new Int32Array(z[0].levelBuffer.buffer,z[0].levelBuffer.byteOffset,z[0].levelBuffer.byteLength/4)),{resource:new ei(I,{width:z[0].levelWidth,height:z[0].levelHeight}),type:s,format:P?jd(a):a}}),kvData:T}:{compressed:y.map(function(z){return new on(null,{format:o,width:h,height:u,levels:d,levelBuffers:z})}),kvData:T}}function Wd(r,e){for(var t=0;t<ma.length;t++)if(e.getUint8(t)!==ma[t])return console.error(r+" is not a valid *.ktx file!"),!1;return!0}function jd(r){switch(r){case R.RGBA:return R.RGBA_INTEGER;case R.RGB:return R.RGB_INTEGER;case R.RG:return R.RG_INTEGER;case R.RED:return R.RED_INTEGER;default:return r}}function zd(r,e,t){for(var i=new Map,n=0;n<e;){var s=r.getUint32(ln+n,t),a=ln+n+4,o=3-(s+3)%4;if(s===0||s>e-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(var h=0;h<s&&r.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}var u=new TextDecoder().decode(new Uint8Array(r.buffer,a,h)),l=new DataView(r.buffer,a+h+1,s-h-1);i.set(u,l),n+=4+s+o}return i}ct.setExtensionXhrType("dds",ct.XHR_RESPONSE_TYPE.BUFFER);var Yd=function(){function r(){}return r.use=function(e,t){if(e.extension==="dds"&&e.data)try{Object.assign(e,va(e.name||e.url,Ud(e.data),e.metadata))}catch(i){t(i);return}t()},r.extension=tt.Loader,r}();ct.setExtensionXhrType("ktx",ct.XHR_RESPONSE_TYPE.BUFFER);var Vd=function(){function r(){}return r.use=function(e,t){if(e.extension==="ktx"&&e.data)try{var i=e.name||e.url,n=Xd(i,e.data,this.loadKeyValueData),s=n.compressed,a=n.uncompressed,o=n.kvData;if(s){var h=va(i,s,e.metadata);if(o&&h.textures)for(var u in h.textures)h.textures[u].baseTexture.ktxKeyValueData=o;Object.assign(e,h)}else if(a){var l={};a.forEach(function(f,c){var d=new k(new V(f.resource,{mipmap:Ft.OFF,alphaMode:Nt.NO_PREMULTIPLIED_ALPHA,type:f.type,format:f.format})),p=i+"-"+(c+1);o&&(d.baseTexture.ktxKeyValueData=o),V.addToCache(d.baseTexture,p),k.addToCache(d,p),c===0&&(l[i]=d,V.addToCache(d.baseTexture,i),k.addToCache(d,i)),l[p]=d}),Object.assign(e,{textures:l})}}catch(f){t(f);return}t()},r.extension=tt.Loader,r.loadKeyValueData=!1,r}();var fn=function(r,e){return fn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},fn(r,e)};function ya(r,e){fn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){ya(e,r);function e(t,i,n,s){t===void 0&&(t=1500),n===void 0&&(n=16384),s===void 0&&(s=!1);var a=r.call(this)||this,o=16384;return n>o&&(n=o),a._properties=[!1,!0,!1,!1,!1],a._maxSize=t,a._batchSize=n,a._buffers=null,a._bufferUpdateIDs=[],a._updateID=0,a.interactiveChildren=!1,a.blendMode=G.NORMAL,a.autoResize=s,a.roundPixels=!0,a.baseTexture=null,a.setProperties(i),a._tint=0,a.tintRgb=new Float32Array(4),a.tint=16777215,a}return e.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},e.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,Be(t,this.tintRgb)},enumerable:!1,configurable:!0}),e.prototype.render=function(t){var i=this;!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return i.onChildrenChange(0)})),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},e.prototype.onChildrenChange=function(t){for(var i=Math.floor(t/this._batchSize);this._bufferUpdateIDs.length<i;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[i]=++this._updateID},e.prototype.dispose=function(){if(this._buffers){for(var t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},e})(Pt);var xa=function(){function r(e,t,i){this.geometry=new ii,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(var n=0;n<e.length;++n){var s=e[n];s={attributeName:s.attributeName,size:s.size,uploadFunction:s.uploadFunction,type:s.type||L.FLOAT,offset:s.offset},t[n]?this.dynamicProperties.push(s):this.staticProperties.push(s)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return r.prototype.initBuffers=function(){var e=this.geometry,t=0;this.indexBuffer=new yt(ff(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(var i=0;i<this.dynamicProperties.length;++i){var n=this.dynamicProperties[i];n.offset=t,t+=n.size,this.dynamicStride+=n.size}var s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new yt(this.dynamicData,!1,!1);var a=0;this.staticStride=0;for(var i=0;i<this.staticProperties.length;++i){var n=this.staticProperties[i];n.offset=a,a+=n.size,this.staticStride+=n.size}var o=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(o),this.staticDataUint32=new Uint32Array(o),this.staticBuffer=new yt(this.staticData,!0,!1);for(var i=0;i<this.dynamicProperties.length;++i){var n=this.dynamicProperties[i];e.addAttribute(n.attributeName,this.dynamicBuffer,0,n.type===L.UNSIGNED_BYTE,n.type,this.dynamicStride*4,n.offset*4)}for(var i=0;i<this.staticProperties.length;++i){var n=this.staticProperties[i];e.addAttribute(n.attributeName,this.staticBuffer,0,n.type===L.UNSIGNED_BYTE,n.type,this.staticStride*4,n.offset*4)}},r.prototype.uploadDynamic=function(e,t,i){for(var n=0;n<this.dynamicProperties.length;n++){var s=this.dynamicProperties[n];s.uploadFunction(e,t,i,s.type===L.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++},r.prototype.uploadStatic=function(e,t,i){for(var n=0;n<this.staticProperties.length;n++){var s=this.staticProperties[n];s.uploadFunction(e,t,i,s.type===L.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.offset)}this.staticBuffer._updateID++},r.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},r}(),qd=`varying vec2 vTextureCoord;
492
492
  varying vec4 vColor;
493
493
 
494
494
  uniform sampler2D uSampler;
@@ -496,7 +496,7 @@ uniform sampler2D uSampler;
496
496
  void main(void){
497
497
  vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
498
498
  gl_FragColor = color;
499
- }`,Yd=`attribute vec2 aVertexPosition;
499
+ }`,$d=`attribute vec2 aVertexPosition;
500
500
  attribute vec2 aTextureCoord;
501
501
  attribute vec4 aColor;
502
502
 
@@ -521,8 +521,8 @@ void main(void){
521
521
  vTextureCoord = aTextureCoord;
522
522
  vColor = aColor * uColor;
523
523
  }
524
- `,Vd=function(r){ga(e,r);function e(t){var i=r.call(this,t)||this;return i.shader=null,i.properties=null,i.tempMatrix=new gt,i.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:i.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:i.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:i.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:i.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:L.UNSIGNED_BYTE,uploadFunction:i.uploadTint,offset:0}],i.shader=se.from(Yd,jd,{}),i.state=Te.for2d(),i}return e.prototype.render=function(t){var i=t.children,n=t._maxSize,s=t._batchSize,a=this.renderer,o=i.length;if(o!==0){o>n&&!t.autoResize&&(o=n);var h=t._buffers;h||(h=t._buffers=this.generateBuffers(t));var u=i[0]._texture.baseTexture,l=u.alphaMode>0;this.state.blendMode=gs(t.blendMode,l),a.state.set(this.state);var f=a.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=of(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,l),this.shader.uniforms.uSampler=u,this.renderer.shader.bind(this.shader);for(var d=!1,p=0,v=0;p<o;p+=s,v+=1){var _=o-p;_>s&&(_=s),v>=h.length&&h.push(this._generateOneMoreBuffer(t));var m=h[v];m.uploadDynamic(i,p,_);var y=t._bufferUpdateIDs[v]||0;d=d||m._updateID<y,d&&(m._updateID=t._updateID,m.uploadStatic(i,p,_)),a.geometry.bind(m.geometry),f.drawElements(f.TRIANGLES,_*6,f.UNSIGNED_SHORT,0)}}},e.prototype.generateBuffers=function(t){for(var i=[],n=t._maxSize,s=t._batchSize,a=t._properties,o=0;o<n;o+=s)i.push(new ya(this.properties,a,s));return i},e.prototype._generateOneMoreBuffer=function(t){var i=t._batchSize,n=t._properties;return new ya(this.properties,n,i)},e.prototype.uploadVertices=function(t,i,n,s,a,o){for(var h=0,u=0,l=0,f=0,c=0;c<n;++c){var d=t[i+c],p=d._texture,v=d.scale.x,_=d.scale.y,m=p.trim,y=p.orig;m?(u=m.x-d.anchor.x*y.width,h=u+m.width,f=m.y-d.anchor.y*y.height,l=f+m.height):(h=y.width*(1-d.anchor.x),u=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),f=y.height*-d.anchor.y),s[o]=u*v,s[o+1]=f*_,s[o+a]=h*v,s[o+a+1]=f*_,s[o+a*2]=h*v,s[o+a*2+1]=l*_,s[o+a*3]=u*v,s[o+a*3+1]=l*_,o+=a*4}},e.prototype.uploadPosition=function(t,i,n,s,a,o){for(var h=0;h<n;h++){var u=t[i+h].position;s[o]=u.x,s[o+1]=u.y,s[o+a]=u.x,s[o+a+1]=u.y,s[o+a*2]=u.x,s[o+a*2+1]=u.y,s[o+a*3]=u.x,s[o+a*3+1]=u.y,o+=a*4}},e.prototype.uploadRotation=function(t,i,n,s,a,o){for(var h=0;h<n;h++){var u=t[i+h].rotation;s[o]=u,s[o+a]=u,s[o+a*2]=u,s[o+a*3]=u,o+=a*4}},e.prototype.uploadUvs=function(t,i,n,s,a,o){for(var h=0;h<n;++h){var u=t[i+h]._texture._uvs;u?(s[o]=u.x0,s[o+1]=u.y0,s[o+a]=u.x1,s[o+a+1]=u.y1,s[o+a*2]=u.x2,s[o+a*2+1]=u.y2,s[o+a*3]=u.x3,s[o+a*3+1]=u.y3,o+=a*4):(s[o]=0,s[o+1]=0,s[o+a]=0,s[o+a+1]=0,s[o+a*2]=0,s[o+a*2+1]=0,s[o+a*3]=0,s[o+a*3+1]=0,o+=a*4)}},e.prototype.uploadTint=function(t,i,n,s,a,o){for(var h=0;h<n;++h){var u=t[i+h],l=u._texture.baseTexture.alphaMode>0,f=u.alpha,c=f<1&&l?Cr(u._tintRGB,f):u._tintRGB+(f*255<<24);s[o]=c,s[o+a]=c,s[o+a*2]=c,s[o+a*3]=c,o+=a*4}},e.prototype.destroy=function(){r.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},e.extension={name:"particle",type:J.RendererPlugin},e}(Ni);var re;(function(r){r.MITER="miter",r.BEVEL="bevel",r.ROUND="round"})(re||(re={}));var he;(function(r){r.BUTT="butt",r.ROUND="round",r.SQUARE="square"})(he||(he={}));var oi={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(r,e){if(e===void 0&&(e=20),!this.adaptive||!r||isNaN(r))return e;var t=Math.ceil(r/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}},xa=function(){function r(){this.color=16777215,this.alpha=1,this.texture=k.WHITE,this.matrix=null,this.visible=!1,this.reset()}return r.prototype.clone=function(){var e=new r;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},r.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=k.WHITE,this.matrix=null,this.visible=!1},r.prototype.destroy=function(){this.texture=null,this.matrix=null},r}();var un=function(r,e){return un=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},un(r,e)};function ln(r,e){un(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function ba(r,e){var t,i;e===void 0&&(e=!1);var n=r.length;if(!(n<6)){for(var s=0,a=0,o=r[n-2],h=r[n-1];a<n;a+=2){var u=r[a],l=r[a+1];s+=(u-o)*(l+h),o=u,h=l}if(!e&&s>0||e&&s<=0)for(var f=n/2,a=f+f%2;a<n;a+=2){var c=n-a-2,d=n-a-1,p=a,v=a+1;t=[r[p],r[c]],r[c]=t[0],r[p]=t[1],i=[r[v],r[d]],r[d]=i[0],r[v]=i[1]}}}var Ta={build:function(r){r.points=r.shape.points.slice()},triangulate:function(r,e){var t=r.points,i=r.holes,n=e.points,s=e.indices;if(t.length>=6){ba(t,!1);for(var a=[],o=0;o<i.length;o++){var h=i[o];ba(h.points,!0),a.push(t.length/2),t=t.concat(h.points)}var u=wi.exports(t,a,2);if(!u)return;for(var l=n.length/2,o=0;o<u.length;o+=3)s.push(u[o]+l),s.push(u[o+1]+l),s.push(u[o+2]+l);for(var o=0;o<t.length;o++)n.push(t[o])}}},Zi={build:function(r){var e=r.points,t,i,n,s,a,o;if(r.type===xt.CIRC){var h=r.shape;t=h.x,i=h.y,a=o=h.radius,n=s=0}else if(r.type===xt.ELIP){var u=r.shape;t=u.x,i=u.y,a=u.width,o=u.height,n=s=0}else{var l=r.shape,f=l.width/2,c=l.height/2;t=l.x+f,i=l.y+c,a=o=Math.max(0,Math.min(l.radius,Math.min(f,c))),n=f-a,s=c-o}if(!(a>=0&&o>=0&&n>=0&&s>=0)){e.length=0;return}var d=Math.ceil(2.3*Math.sqrt(a+o)),p=d*8+(n?4:0)+(s?4:0);if(e.length=p,p!==0){if(d===0){e.length=8,e[0]=e[6]=t+n,e[1]=e[3]=i+s,e[2]=e[4]=t-n,e[5]=e[7]=i-s;return}var v=0,_=d*4+(n?2:0)+2,m=_,y=p;{var g=n+a,b=s,x=t+g,T=t-g,w=i+b;if(e[v++]=x,e[v++]=w,e[--_]=w,e[--_]=T,s){var A=i-b;e[m++]=T,e[m++]=A,e[--y]=A,e[--y]=x}}for(var E=1;E<d;E++){var S=Math.PI/2*(E/d),g=n+Math.cos(S)*a,b=s+Math.sin(S)*o,x=t+g,T=t-g,w=i+b,A=i-b;e[v++]=x,e[v++]=w,e[--_]=w,e[--_]=T,e[m++]=T,e[m++]=A,e[--y]=A,e[--y]=x}{var g=n,b=s+o,x=t+g,T=t-g,w=i+b,A=i-b;e[v++]=x,e[v++]=w,e[--y]=A,e[--y]=x,n&&(e[v++]=T,e[v++]=w,e[--y]=A,e[--y]=T)}}},triangulate:function(r,e){var t=r.points,i=e.points,n=e.indices;if(t.length!==0){var s=i.length/2,a=s,o,h;if(r.type!==xt.RREC){var u=r.shape;o=u.x,h=u.y}else{var l=r.shape;o=l.x+l.width/2,h=l.y+l.height/2}var f=r.matrix;i.push(r.matrix?f.a*o+f.c*h+f.tx:o,r.matrix?f.b*o+f.d*h+f.ty:h),s++,i.push(t[0],t[1]);for(var c=2;c<t.length;c+=2)i.push(t[c],t[c+1]),n.push(s++,a,s);n.push(a+1,a,s)}}},qd={build:function(r){var e=r.shape,t=e.x,i=e.y,n=e.width,s=e.height,a=r.points;a.length=0,a.push(t,i,t+n,i,t+n,i+s,t,i+s)},triangulate:function(r,e){var t=r.points,i=e.points,n=i.length/2;i.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function Ue(r,e,t){var i=e-r;return r+i*t}function Ki(r,e,t,i,n,s,a){a===void 0&&(a=[]);for(var o=20,h=a,u=0,l=0,f=0,c=0,d=0,p=0,v=0,_=0;v<=o;++v)_=v/o,u=Ue(r,t,_),l=Ue(e,i,_),f=Ue(t,n,_),c=Ue(i,s,_),d=Ue(u,f,_),p=Ue(l,c,_),!(v===0&&h[h.length-2]===d&&h[h.length-1]===p)&&h.push(d,p);return h}var $d={build:function(r){if(Ce.nextRoundedRectBehavior){Zi.build(r);return}var e=r.shape,t=r.points,i=e.x,n=e.y,s=e.width,a=e.height,o=Math.max(0,Math.min(e.radius,Math.min(s,a)/2));t.length=0,o?(Ki(i,n+o,i,n,i+o,n,t),Ki(i+s-o,n,i+s,n,i+s,n+o,t),Ki(i+s,n+a-o,i+s,n+a,i+s-o,n+a,t),Ki(i+o,n+a,i,n+a,i,n+a-o,t)):t.push(i,n,i+s,n,i+s,n+a,i,n+a)},triangulate:function(r,e){if(Ce.nextRoundedRectBehavior){Zi.triangulate(r,e);return}for(var t=r.points,i=e.points,n=e.indices,s=i.length/2,a=wi.exports(t,null,2),o=0,h=a.length;o<h;o+=3)n.push(a[o]+s),n.push(a[o+1]+s),n.push(a[o+2]+s);for(var o=0,h=t.length;o<h;o++)i.push(t[o],t[++o])}};function wa(r,e,t,i,n,s,a,o){var h=r-t*n,u=e-i*n,l=r+t*s,f=e+i*s,c,d;a?(c=i,d=-t):(c=-i,d=t);var p=h+c,v=u+d,_=l+c,m=f+d;return o.push(p,v),o.push(_,m),2}function Se(r,e,t,i,n,s,a,o){var h=t-r,u=i-e,l=Math.atan2(h,u),f=Math.atan2(n-r,s-e);o&&l<f?l+=Math.PI*2:!o&&l>f&&(f+=Math.PI*2);var c=l,d=f-l,p=Math.abs(d),v=Math.sqrt(h*h+u*u),_=(15*p*Math.sqrt(v)/Math.PI>>0)+1,m=d/_;if(c+=m,o){a.push(r,e),a.push(t,i);for(var y=1,g=c;y<_;y++,g+=m)a.push(r,e),a.push(r+Math.sin(g)*v,e+Math.cos(g)*v);a.push(r,e),a.push(n,s)}else{a.push(t,i),a.push(r,e);for(var y=1,g=c;y<_;y++,g+=m)a.push(r+Math.sin(g)*v,e+Math.cos(g)*v),a.push(r,e);a.push(n,s),a.push(r,e)}return _*2}function Zd(r,e){var t=r.shape,i=r.points||t.points.slice(),n=e.closePointEps;if(i.length!==0){var s=r.lineStyle,a=new W(i[0],i[1]),o=new W(i[i.length-2],i[i.length-1]),h=t.type!==xt.POLY||t.closeStroke,u=Math.abs(a.x-o.x)<n&&Math.abs(a.y-o.y)<n;if(h){i=i.slice(),u&&(i.pop(),i.pop(),o.set(i[i.length-2],i[i.length-1]));var l=(a.x+o.x)*.5,f=(o.y+a.y)*.5;i.unshift(l,f),i.push(l,f)}var c=e.points,d=i.length/2,p=i.length,v=c.length/2,_=s.width/2,m=_*_,y=s.miterLimit*s.miterLimit,g=i[0],b=i[1],x=i[2],T=i[3],w=0,A=0,E=-(b-T),S=g-x,D=0,C=0,N=Math.sqrt(E*E+S*S);E/=N,S/=N,E*=_,S*=_;var H=s.alignment,M=(1-H)*2,O=H*2;h||(s.cap===he.ROUND?p+=Se(g-E*(M-O)*.5,b-S*(M-O)*.5,g-E*M,b-S*M,g+E*O,b+S*O,c,!0)+2:s.cap===he.SQUARE&&(p+=wa(g,b,E,S,M,O,!0,c))),c.push(g-E*M,b-S*M),c.push(g+E*O,b+S*O);for(var G=1;G<d-1;++G){g=i[(G-1)*2],b=i[(G-1)*2+1],x=i[G*2],T=i[G*2+1],w=i[(G+1)*2],A=i[(G+1)*2+1],E=-(b-T),S=g-x,N=Math.sqrt(E*E+S*S),E/=N,S/=N,E*=_,S*=_,D=-(T-A),C=x-w,N=Math.sqrt(D*D+C*C),D/=N,C/=N,D*=_,C*=_;var lt=x-g,j=b-T,I=x-w,P=A-T,B=lt*I+j*P,$=j*I-P*lt,Z=$<0;if(Math.abs($)<.001*Math.abs(B)){c.push(x-E*M,T-S*M),c.push(x+E*O,T+S*O),B>=0&&(s.join===re.ROUND?p+=Se(x,T,x-E*M,T-S*M,x-D*M,T-C*M,c,!1)+4:p+=2,c.push(x-D*O,T-C*O),c.push(x+D*M,T+C*M));continue}var vt=(-E+g)*(-S+T)-(-E+x)*(-S+b),st=(-D+w)*(-C+T)-(-D+x)*(-C+A),at=(lt*st-I*vt)/$,Tt=(P*vt-j*st)/$,Et=(at-x)*(at-x)+(Tt-T)*(Tt-T),_t=x+(at-x)*M,tt=T+(Tt-T)*M,nt=x-(at-x)*O,ot=T-(Tt-T)*O,V=Math.min(lt*lt+j*j,I*I+P*P),Pt=Z?M:O,Ct=V+Pt*Pt*m,K=Et<=Ct;K?s.join===re.BEVEL||Et/m>y?(Z?(c.push(_t,tt),c.push(x+E*O,T+S*O),c.push(_t,tt),c.push(x+D*O,T+C*O)):(c.push(x-E*M,T-S*M),c.push(nt,ot),c.push(x-D*M,T-C*M),c.push(nt,ot)),p+=2):s.join===re.ROUND?Z?(c.push(_t,tt),c.push(x+E*O,T+S*O),p+=Se(x,T,x+E*O,T+S*O,x+D*O,T+C*O,c,!0)+4,c.push(_t,tt),c.push(x+D*O,T+C*O)):(c.push(x-E*M,T-S*M),c.push(nt,ot),p+=Se(x,T,x-E*M,T-S*M,x-D*M,T-C*M,c,!1)+4,c.push(x-D*M,T-C*M),c.push(nt,ot)):(c.push(_t,tt),c.push(nt,ot)):(c.push(x-E*M,T-S*M),c.push(x+E*O,T+S*O),s.join===re.ROUND?Z?p+=Se(x,T,x+E*O,T+S*O,x+D*O,T+C*O,c,!0)+2:p+=Se(x,T,x-E*M,T-S*M,x-D*M,T-C*M,c,!1)+2:s.join===re.MITER&&Et/m<=y&&(Z?(c.push(nt,ot),c.push(nt,ot)):(c.push(_t,tt),c.push(_t,tt)),p+=2),c.push(x-D*M,T-C*M),c.push(x+D*O,T+C*O),p+=2)}g=i[(d-2)*2],b=i[(d-2)*2+1],x=i[(d-1)*2],T=i[(d-1)*2+1],E=-(b-T),S=g-x,N=Math.sqrt(E*E+S*S),E/=N,S/=N,E*=_,S*=_,c.push(x-E*M,T-S*M),c.push(x+E*O,T+S*O),h||(s.cap===he.ROUND?p+=Se(x-E*(M-O)*.5,T-S*(M-O)*.5,x-E*M,T-S*M,x+E*O,T+S*O,c,!1)+2:s.cap===he.SQUARE&&(p+=wa(x,T,E,S,M,O,!1,c)));for(var $t=e.indices,Xe=oi.epsilon*oi.epsilon,G=v;G<p+v-2;++G)g=c[G*2],b=c[G*2+1],x=c[(G+1)*2],T=c[(G+1)*2+1],w=c[(G+2)*2],A=c[(G+2)*2+1],!(Math.abs(g*(T-A)+x*(A-b)+w*(b-T))<Xe)&&$t.push(G,G+1,G+2)}}function Kd(r,e){var t=0,i=r.shape,n=r.points||i.points,s=i.type!==xt.POLY||i.closeStroke;if(n.length!==0){var a=e.points,o=e.indices,h=n.length/2,u=a.length/2,l=u;for(a.push(n[0],n[1]),t=1;t<h;t++)a.push(n[t*2],n[t*2+1]),o.push(l,l+1),l++;s&&o.push(l,u)}}function Ea(r,e){r.lineStyle.native?Kd(r,e):Zd(r,e)}var Sa=function(){function r(){}return r.curveTo=function(e,t,i,n,s,a){var o=a[a.length-2],h=a[a.length-1],u=h-t,l=o-e,f=n-t,c=i-e,d=Math.abs(u*c-l*f);if(d<1e-8||s===0)return(a[a.length-2]!==e||a[a.length-1]!==t)&&a.push(e,t),null;var p=u*u+l*l,v=f*f+c*c,_=u*f+l*c,m=s*Math.sqrt(p)/d,y=s*Math.sqrt(v)/d,g=m*_/p,b=y*_/v,x=m*c+y*l,T=m*f+y*u,w=l*(y+g),A=u*(y+g),E=c*(m+b),S=f*(m+b),D=Math.atan2(A-T,w-x),C=Math.atan2(S-T,E-x);return{cx:x+e,cy:T+t,radius:s,startAngle:D,endAngle:C,anticlockwise:l*f>c*u}},r.arc=function(e,t,i,n,s,a,o,h,u){for(var l=o-a,f=oi._segmentsCount(Math.abs(l)*s,Math.ceil(Math.abs(l)/Xt)*40),c=l/(f*2),d=c*2,p=Math.cos(c),v=Math.sin(c),_=f-1,m=_%1/_,y=0;y<=_;++y){var g=y+m*y,b=c+a+d*g,x=Math.cos(b),T=-Math.sin(b);u.push((p*x+v*T)*s+i,(p*-T+v*x)*s+n)}},r}(),Qd=function(){function r(){}return r.curveLength=function(e,t,i,n,s,a,o,h){for(var u=10,l=0,f=0,c=0,d=0,p=0,v=0,_=0,m=0,y=0,g=0,b=0,x=e,T=t,w=1;w<=u;++w)f=w/u,c=f*f,d=c*f,p=1-f,v=p*p,_=v*p,m=_*e+3*v*f*i+3*p*c*s+d*o,y=_*t+3*v*f*n+3*p*c*a+d*h,g=x-m,b=T-y,x=m,T=y,l+=Math.sqrt(g*g+b*b);return l},r.curveTo=function(e,t,i,n,s,a,o){var h=o[o.length-2],u=o[o.length-1];o.length-=2;var l=oi._segmentsCount(r.curveLength(h,u,e,t,i,n,s,a)),f=0,c=0,d=0,p=0,v=0;o.push(h,u);for(var _=1,m=0;_<=l;++_)m=_/l,f=1-m,c=f*f,d=c*f,p=m*m,v=p*m,o.push(d*h+3*c*m*e+3*f*p*i+v*s,d*u+3*c*m*t+3*f*p*n+v*a)},r}(),Jd=function(){function r(){}return r.curveLength=function(e,t,i,n,s,a){var o=e-2*i+s,h=t-2*n+a,u=2*i-2*e,l=2*n-2*t,f=4*(o*o+h*h),c=4*(o*u+h*l),d=u*u+l*l,p=2*Math.sqrt(f+c+d),v=Math.sqrt(f),_=2*f*v,m=2*Math.sqrt(d),y=c/v;return(_*p+v*c*(p-m)+(4*d*f-c*c)*Math.log((2*v+y+p)/(y+m)))/(4*_)},r.curveTo=function(e,t,i,n,s){for(var a=s[s.length-2],o=s[s.length-1],h=oi._segmentsCount(r.curveLength(a,o,e,t,i,n)),u=0,l=0,f=1;f<=h;++f){var c=f/h;u=a+(e-a)*c,l=o+(t-o)*c,s.push(u+(e+(i-e)*c-u)*c,l+(t+(n-t)*c-l)*c)}},r}(),tp=function(){function r(){this.reset()}return r.prototype.begin=function(e,t,i){this.reset(),this.style=e,this.start=t,this.attribStart=i},r.prototype.end=function(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start},r.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},r}(),Pe,fn=(Pe={},Pe[xt.POLY]=Ta,Pe[xt.CIRC]=Zi,Pe[xt.ELIP]=Zi,Pe[xt.RECT]=qd,Pe[xt.RREC]=$d,Pe),Pa=[],Qi=[],Ca=function(){function r(e,t,i,n){t===void 0&&(t=null),i===void 0&&(i=null),n===void 0&&(n=null),this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=t,this.matrix=n,this.type=e.type}return r.prototype.clone=function(){return new r(this.shape,this.fillStyle,this.lineStyle,this.matrix)},r.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},r}(),Ge=new W,ep=function(r){ln(e,r);function e(){var t=r.call(this)||this;return t.closePointEps=1e-4,t.boundsPadding=0,t.uvsFloat32=null,t.indicesUint16=null,t.batchable=!1,t.points=[],t.colors=[],t.uvs=[],t.indices=[],t.textureIds=[],t.graphicsData=[],t.drawCalls=[],t.batchDirty=-1,t.batches=[],t.dirty=0,t.cacheDirty=-1,t.clearDirty=0,t.shapeIndex=0,t._bounds=new Mi,t.boundsDirty=-1,t}return Object.defineProperty(e.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),Qi.push(this.drawCalls[t]);this.drawCalls.length=0;for(var t=0;t<this.batches.length;t++){var i=this.batches[t];i.reset(),Pa.push(i)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,i,n,s){i===void 0&&(i=null),n===void 0&&(n=null),s===void 0&&(s=null);var a=new Ca(t,i,n,s);return this.graphicsData.push(a),this.dirty++,this},e.prototype.drawHole=function(t,i){if(i===void 0&&(i=null),!this.graphicsData.length)return null;var n=new Ca(t,null,null,i),s=this.graphicsData[this.graphicsData.length-1];return n.lineStyle=s.lineStyle,s.holes.push(n),this.dirty++,this},e.prototype.destroy=function(){r.prototype.destroy.call(this);for(var t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var i=this.graphicsData,n=0;n<i.length;++n){var s=i[n];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,Ge):Ge.copyFrom(t),s.shape.contains(Ge.x,Ge.y))){var a=!1;if(s.holes)for(var o=0;o<s.holes.length;o++){var h=s.holes[o];if(h.shape.contains(Ge.x,Ge.y)){a=!0;break}}if(!a)return!0}}return!1},e.prototype.updateBatches=function(){if(!this.graphicsData.length){this.batchable=!0;return}if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,i=this.graphicsData,n=null,s=null;this.batches.length>0&&(n=this.batches[this.batches.length-1],s=n.style);for(var a=this.shapeIndex;a<i.length;a++){this.shapeIndex++;var o=i[a],h=o.fillStyle,u=o.lineStyle,l=fn[o.type];l.build(o),o.matrix&&this.transformPoints(o.points,o.matrix),(h.visible||u.visible)&&this.processHoles(o.holes);for(var f=0;f<2;f++){var c=f===0?h:u;if(c.visible){var d=c.texture.baseTexture,p=this.indices.length,v=this.points.length/2;d.wrapMode=zt.REPEAT,f===0?this.processFill(o):this.processLine(o);var _=this.points.length/2-v;_!==0&&(n&&!this._compareStyles(s,c)&&(n.end(p,v),n=null),n||(n=Pa.pop()||new tp,n.begin(c,p,v),this.batches.push(n),s=c),this.addUvs(this.points,t,c.texture,v,_,c.matrix))}}}var m=this.indices.length,y=this.points.length/2;if(n&&n.end(m,y),this.batches.length===0){this.batchable=!0;return}var g=y>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&g===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=g?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}},e.prototype._compareStyles=function(t,i){return!(!t||!i||t.texture.baseTexture!==i.texture.baseTexture||t.color+t.alpha!==i.color+i.alpha||!!t.native!=!!i.native)},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,i=this.graphicsData.length;t<i;t++){var n=this.graphicsData[t],s=n.fillStyle,a=n.lineStyle;if(s&&!s.texture.baseTexture.valid||a&&!a.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,i=0,n=t.length;i<n;i++)for(var s=t[i],a=0;a<s.size;a++){var o=s.start+a;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>65535*2)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<e.BATCHABLE_SIZE*2},e.prototype.buildDrawCalls=function(){for(var t=++Y._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),Qi.push(this.drawCalls[i]);this.drawCalls.length=0;var n=this.colors,s=this.textureIds,a=Qi.pop();a||(a=new Vr,a.texArray=new qr),a.texArray.count=0,a.start=0,a.size=0,a.type=Ot.TRIANGLES;var o=0,h=null,u=0,l=!1,f=Ot.TRIANGLES,c=0;this.drawCalls.push(a);for(var i=0;i<this.batches.length;i++){var d=this.batches[i],p=8,v=d.style,_=v.texture.baseTexture;l!==!!v.native&&(l=!!v.native,f=l?Ot.LINES:Ot.TRIANGLES,h=null,o=p,t++),h!==_&&(h=_,_._batchEnabled!==t&&(o===p&&(t++,o=0,a.size>0&&(a=Qi.pop(),a||(a=new Vr,a.texArray=new qr),this.drawCalls.push(a)),a.start=c,a.size=0,a.texArray.count=0,a.type=f),_.touched=1,_._batchEnabled=t,_._batchLocation=o,_.wrapMode=zt.REPEAT,a.texArray.elements[a.texArray.count++]=_,o++)),a.size+=d.size,c+=d.size,u=_._batchLocation,this.addColors(n,v.color,v.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,u,d.attribSize,d.attribStart)}Y._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,i=this.uvs,n=this.colors,s=this.textureIds,a=new ArrayBuffer(t.length*3*4),o=new Float32Array(a),h=new Uint32Array(a),u=0,l=0;l<t.length/2;l++)o[u++]=t[l*2],o[u++]=t[l*2+1],o[u++]=i[l*2],o[u++]=i[l*2+1],h[u++]=n[l],o[u++]=s[l];this._buffer.update(a),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){if(t.holes.length)Ta.triangulate(t,this);else{var i=fn[t.type];i.triangulate(t,this)}},e.prototype.processLine=function(t){Ea(t,this);for(var i=0;i<t.holes.length;i++)Ea(t.holes[i],this)},e.prototype.processHoles=function(t){for(var i=0;i<t.length;i++){var n=t[i],s=fn[n.type];s.build(n),n.matrix&&this.transformPoints(n.points,n.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,i){for(var n=0;n<t.length/2;n++){var s=t[n*2],a=t[n*2+1];t[n*2]=i.a*s+i.c*a+i.tx,t[n*2+1]=i.b*s+i.d*a+i.ty}},e.prototype.addColors=function(t,i,n,s,a){a===void 0&&(a=0);var o=(i>>16)+(i&65280)+((i&255)<<16),h=Cr(o,n);t.length=Math.max(t.length,a+s);for(var u=0;u<s;u++)t[a+u]=h},e.prototype.addTextureIds=function(t,i,n,s){s===void 0&&(s=0),t.length=Math.max(t.length,s+n);for(var a=0;a<n;a++)t[s+a]=i},e.prototype.addUvs=function(t,i,n,s,a,o){o===void 0&&(o=null);for(var h=0,u=i.length,l=n.frame;h<a;){var f=t[(s+h)*2],c=t[(s+h)*2+1];if(o){var d=o.a*f+o.c*c+o.tx;c=o.b*f+o.d*c+o.ty,f=d}h++,i.push(f/l.width,c/l.height)}var p=n.baseTexture;(l.width<p.width||l.height<p.height)&&this.adjustUvs(i,n,u,a)},e.prototype.adjustUvs=function(t,i,n,s){for(var a=i.baseTexture,o=1e-6,h=n+s*2,u=i.frame,l=u.width/a.width,f=u.height/a.height,c=u.x/u.width,d=u.y/u.height,p=Math.floor(t[n]+o),v=Math.floor(t[n+1]+o),_=n+2;_<h;_+=2)p=Math.min(p,Math.floor(t[_]+o)),v=Math.min(v,Math.floor(t[_+1]+o));c-=p,d-=v;for(var _=n;_<h;_+=2)t[_]=(t[_]+c)*l,t[_+1]=(t[_+1]+d)*f},e.BATCHABLE_SIZE=100,e}(Js),ip=function(r){ln(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.width=0,t.alignment=.5,t.native=!1,t.cap=he.BUTT,t.join=re.MITER,t.miterLimit=10,t}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){r.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(xa),rp=new Float32Array(3),cn={},Ce=function(r){ln(e,r);function e(t){t===void 0&&(t=null);var i=r.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new xa,i._lineStyle=new ip,i._matrix=null,i._holeMode=!1,i.state=Te.for2d(),i._geometry=t||new ep,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=U.NORMAL,i}return Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t,i,n,s,a){return t===void 0&&(t=null),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=.5),a===void 0&&(a=!1),typeof t=="number"&&(t={width:t,color:i,alpha:n,alignment:s,native:a}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:k.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:he.BUTT,join:re.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,i=this.currentPath.points.length;i>2&&(this.drawShape(this.currentPath),this.currentPath=new mi,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[i-2],t[i-1]))}else this.currentPath=new mi,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,i){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=i,this},e.prototype.lineTo=function(t,i){this.currentPath||this.moveTo(0,0);var n=this.currentPath.points,s=n[n.length-2],a=n[n.length-1];return(s!==t||a!==i)&&n.push(t,i),this},e.prototype._initCurve=function(t,i){t===void 0&&(t=0),i===void 0&&(i=0),this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,i]):this.moveTo(t,i)},e.prototype.quadraticCurveTo=function(t,i,n,s){this._initCurve();var a=this.currentPath.points;return a.length===0&&this.moveTo(0,0),Jd.curveTo(t,i,n,s,a),this},e.prototype.bezierCurveTo=function(t,i,n,s,a,o){return this._initCurve(),Qd.curveTo(t,i,n,s,a,o,this.currentPath.points),this},e.prototype.arcTo=function(t,i,n,s,a){this._initCurve(t,i);var o=this.currentPath.points,h=Sa.curveTo(t,i,n,s,a,o);if(h){var u=h.cx,l=h.cy,f=h.radius,c=h.startAngle,d=h.endAngle,p=h.anticlockwise;this.arc(u,l,f,c,d,p)}return this},e.prototype.arc=function(t,i,n,s,a,o){if(o===void 0&&(o=!1),s===a)return this;!o&&a<=s?a+=Xt:o&&s<=a&&(s+=Xt);var h=a-s;if(h===0)return this;var u=t+Math.cos(s)*n,l=i+Math.sin(s)*n,f=this._geometry.closePointEps,c=this.currentPath?this.currentPath.points:null;if(c){var d=Math.abs(c[c.length-2]-u),p=Math.abs(c[c.length-1]-l);d<f&&p<f||c.push(u,l)}else this.moveTo(u,l),c=this.currentPath.points;return Sa.arc(u,l,t,i,n,s,a,o,c),this},e.prototype.beginFill=function(t,i){return t===void 0&&(t=0),i===void 0&&(i=1),this.beginTextureFill({texture:k.WHITE,color:t,alpha:i})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:k.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,i,n,s){return this.drawShape(new z(t,i,n,s))},e.prototype.drawRoundedRect=function(t,i,n,s,a){return this.drawShape(new _o(t,i,n,s,a))},e.prototype.drawCircle=function(t,i,n){return this.drawShape(new po(t,i,n))},e.prototype.drawEllipse=function(t,i,n,s){return this.drawShape(new vo(t,i,n,s))},e.prototype.drawPolygon=function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];var s,a=!0,o=i[0];o.points?(a=o.closeStroke,s=o.points):Array.isArray(i[0])?s=i[0]:s=i;var h=new mi(s);return h.closeStroke=a,this.drawShape(h),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===xt.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var i=this._geometry;i.updateBatches(),i.batchable?(this.batchDirty!==i.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,i=this.blendMode,n=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=n,this.vertexData=new Float32Array(t.points);for(var s=0;s<n;s++){var a=t.batches[s],o=a.style.color,h=new Float32Array(this.vertexData.buffer,a.attribStart*4*2,a.attribSize*2),u=new Float32Array(t.uvsFloat32.buffer,a.attribStart*4*2,a.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,a.start*2,a.size),f={vertexData:h,blendMode:i,indices:l,uvs:u,_batchRGB:Fe(o),_tintRGB:o,_texture:a.style.texture,alpha:a.style.alpha,worldAlpha:1};this.batches[s]=f}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var i=0,n=this.batches.length;i<n;i++){var s=this.batches[i];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}},e.prototype._renderDirect=function(t){var i=this._resolveDirectShader(t),n=this._geometry,s=this.tint,a=this.worldAlpha,o=i.uniforms,h=n.drawCalls;o.translationMatrix=this.transform.worldTransform,o.tint[0]=(s>>16&255)/255*a,o.tint[1]=(s>>8&255)/255*a,o.tint[2]=(s&255)/255*a,o.tint[3]=a,t.shader.bind(i),t.geometry.bind(n,i),t.state.set(this.state);for(var u=0,l=h.length;u<l;u++)this._renderDrawCallDirect(t,n.drawCalls[u])},e.prototype._renderDrawCallDirect=function(t,i){for(var n=i.texArray,s=i.type,a=i.size,o=i.start,h=n.count,u=0;u<h;u++)t.texture.bind(n.elements[u],u);t.geometry.draw(s,a,o)},e.prototype._resolveDirectShader=function(t){var i=this.shader,n=this.pluginName;if(!i){if(!cn[n]){for(var s=t.plugins[n].MAX_TEXTURES,a=new Int32Array(s),o=0;o<s;o++)a[o]=o;var h={tint:new Float32Array([1,1,1,1]),translationMatrix:new gt,default:be.from({uSamplers:a},!0)},u=t.plugins[n]._shader.program;cn[n]=new se(u,h)}i=cn[n]}return i},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var i=t.bounds,n=i.minX,s=i.minY,a=i.maxX,o=i.maxY;this._bounds.addFrame(this.transform,n,s,a,o)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=Fe(this.tint,rp),i=0;i<this.batches.length;i++){var n=this.batches[i],s=n._batchRGB,a=t[0]*s[0]*255,o=t[1]*s[1]*255,h=t[2]*s[2]*255,u=(a<<16)+(o<<8)+(h|0);n._tintRGB=(u>>16)+(u&65280)+((u&255)<<16)}}},e.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var i=this.transform.worldTransform,n=i.a,s=i.b,a=i.c,o=i.d,h=i.tx,u=i.ty,l=this._geometry.points,f=this.vertexData,c=0,d=0;d<l.length;d+=2){var p=l[d],v=l[d+1];f[c++]=n*p+a*v+h,f[c++]=o*v+s*p+u}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,r.prototype.destroy.call(this,t)},e.nextRoundedRectBehavior=!1,e._TEMP_POINT=new W,e}(St);var dn=function(r,e){return dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},dn(r,e)};function np(r,e){dn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var hi=new W,sp=new Uint16Array([0,1,2,0,2,3]),ui=function(r){np(e,r);function e(t){var i=r.call(this)||this;return i._anchor=new Ae(i._onAnchorUpdate,i,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),i._texture=null,i._width=0,i._height=0,i._tint=null,i._tintRGB=null,i.tint=16777215,i.blendMode=U.NORMAL,i._cachedTint=16777215,i.uvs=null,i.texture=t||k.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=sp,i.pluginName="batch",i.isSprite=!0,i._roundPixels=F.ROUND_PIXELS,i}return e.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Be(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Be(this.scale.y)*this._height/this._texture.orig.height)},e.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},e.prototype.calculateVertices=function(){var t=this._texture;if(!(this._transformID===this.transform._worldID&&this._textureID===t._updateID)){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var i=this.transform.worldTransform,n=i.a,s=i.b,a=i.c,o=i.d,h=i.tx,u=i.ty,l=this.vertexData,f=t.trim,c=t.orig,d=this._anchor,p=0,v=0,_=0,m=0;if(f?(v=f.x-d._x*c.width,p=v+f.width,m=f.y-d._y*c.height,_=m+f.height):(v=-d._x*c.width,p=v+c.width,m=-d._y*c.height,_=m+c.height),l[0]=n*v+a*m+h,l[1]=o*m+s*v+u,l[2]=n*p+a*m+h,l[3]=o*m+s*p+u,l[4]=n*p+a*_+h,l[5]=o*_+s*p+u,l[6]=n*v+a*_+h,l[7]=o*_+s*v+u,this._roundPixels)for(var y=F.RESOLUTION,g=0;g<l.length;++g)l[g]=Math.round((l[g]*y|0)/y)}},e.prototype.calculateTrimmedVertices=function(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,i=this.vertexTrimmedData,n=t.orig,s=this._anchor,a=this.transform.worldTransform,o=a.a,h=a.b,u=a.c,l=a.d,f=a.tx,c=a.ty,d=-s._x*n.width,p=d+n.width,v=-s._y*n.height,_=v+n.height;i[0]=o*d+u*v+f,i[1]=l*v+h*d+c,i[2]=o*p+u*v+f,i[3]=l*v+h*p+c,i[4]=o*p+u*_+f,i[5]=l*_+h*p+c,i[6]=o*d+u*_+f,i[7]=l*_+h*d+c},e.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)},e.prototype._calculateBounds=function(){var t=this._texture.trim,i=this._texture.orig;!t||t.width===i.width&&t.height===i.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},e.prototype.getLocalBounds=function(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Mi),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new z),t=this._localBoundsRect),this._localBounds.getRectangle(t)):r.prototype.getLocalBounds.call(this,t)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,hi);var i=this._texture.orig.width,n=this._texture.orig.height,s=-i*this.anchor.x,a=0;return hi.x>=s&&hi.x<s+i&&(a=-n*this.anchor.y,hi.y>=a&&hi.y<a+n)},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null;var i=typeof t=="boolean"?t:t&&t.texture;if(i){var n=typeof t=="boolean"?t:t&&t.baseTexture;this._texture.destroy(!!n)}this._texture=null},e.from=function(t,i){var n=t instanceof k?t:k.from(t,i);return new e(n)},Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){var i=Be(this.scale.x)||1;this.scale.x=i*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){var i=Be(this.scale.y)||1;this.scale.y=i*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,this._tintRGB=(t>>16)+(t&65280)+((t&255)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||k.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(St);var pn=function(r,e){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},pn(r,e)};function ap(r,e){pn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var li;(function(r){r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"})(li||(li={}));var vn={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:li.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},op=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Re=function(){function r(e){this.styleID=0,this.reset(),mn(this,e,e)}return r.prototype.clone=function(){var e={};return mn(e,this,vn),new r(e)},r.prototype.reset=function(){mn(this,vn,vn)},Object.defineProperty(r.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"breakWords",{get:function(){return this._breakWords},set:function(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(e){var t=_n(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fill",{get:function(){return this._fill},set:function(e){var t=_n(e);this._fill!==t&&(this._fill=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(e){hp(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leading",{get:function(){return this._leading},set:function(e){this._leading!==e&&(this._leading=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"padding",{get:function(){return this._padding},set:function(e){this._padding!==e&&(this._padding=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stroke",{get:function(){return this._stroke},set:function(e){var t=_n(e);this._stroke!==t&&(this._stroke=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"trim",{get:function(){return this._trim},set:function(e){this._trim!==e&&(this._trim=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)},enumerable:!1,configurable:!0}),r.prototype.toFontString=function(){var e=typeof this.fontSize=="number"?this.fontSize+"px":this.fontSize,t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(","));for(var i=t.length-1;i>=0;i--){var n=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&op.indexOf(n)<0&&(n='"'+n+'"'),t[i]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+e+" "+t.join(",")},r}();function Ra(r){return typeof r=="number"?vs(r):(typeof r=="string"&&r.indexOf("0x")===0&&(r=r.replace("0x","#")),r)}function _n(r){if(Array.isArray(r)){for(var e=0;e<r.length;++e)r[e]=Ra(r[e]);return r}else return Ra(r)}function hp(r,e){if(!Array.isArray(r)||!Array.isArray(e)||r.length!==e.length)return!1;for(var t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}function mn(r,e,t){for(var i in t)Array.isArray(e[i])?r[i]=e[i].slice():r[i]=e[i]}var Ji={willReadFrequently:!0},kt=function(){function r(e,t,i,n,s,a,o,h,u){this.text=e,this.style=t,this.width=i,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=u}return r.measureText=function(e,t,i,n){n===void 0&&(n=r._canvas),i=i??t.wordWrap;var s=t.toFontString(),a=r.measureFont(s);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);var o=n.getContext("2d",Ji);o.font=s;for(var h=i?r.wordWrap(e,t,n):e,u=h.split(/(?:\r\n|\r|\n)/),l=new Array(u.length),f=0,c=0;c<u.length;c++){var d=o.measureText(u[c]).width+(u[c].length-1)*t.letterSpacing;l[c]=d,f=Math.max(f,d)}var p=f+t.strokeThickness;t.dropShadow&&(p+=t.dropShadowDistance);var v=t.lineHeight||a.fontSize+t.strokeThickness,_=Math.max(v,a.fontSize+t.strokeThickness)+(u.length-1)*(v+t.leading);return t.dropShadow&&(_+=t.dropShadowDistance),new r(e,t,p,_,u,l,v+t.leading,f,a)},r.wordWrap=function(e,t,i){i===void 0&&(i=r._canvas);for(var n=i.getContext("2d",Ji),s=0,a="",o="",h=Object.create(null),u=t.letterSpacing,l=t.whiteSpace,f=r.collapseSpaces(l),c=r.collapseNewlines(l),d=!f,p=t.wordWrapWidth+u,v=r.tokenize(e),_=0;_<v.length;_++){var m=v[_];if(r.isNewline(m)){if(!c){o+=r.addLine(a),d=!f,a="",s=0;continue}m=" "}if(f){var y=r.isBreakingSpace(m),g=r.isBreakingSpace(a[a.length-1]);if(y&&g)continue}var b=r.getFromCache(m,u,h,n);if(b>p)if(a!==""&&(o+=r.addLine(a),a="",s=0),r.canBreakWords(m,t.breakWords))for(var x=r.wordWrapSplit(m),T=0;T<x.length;T++){for(var w=x[T],A=1;x[T+A];){var E=x[T+A],S=w[w.length-1];if(!r.canBreakChars(S,E,m,T,t.breakWords))w+=E;else break;A++}T+=w.length-1;var D=r.getFromCache(w,u,h,n);D+s>p&&(o+=r.addLine(a),d=!1,a="",s=0),a+=w,s+=D}else{a.length>0&&(o+=r.addLine(a),a="",s=0);var C=_===v.length-1;o+=r.addLine(m,!C),d=!1,a="",s=0}else b+s>p&&(d=!1,o+=r.addLine(a),a="",s=0),(a.length>0||!r.isBreakingSpace(m)||d)&&(a+=m,s+=b)}return o+=r.addLine(a,!1),o},r.addLine=function(e,t){return t===void 0&&(t=!0),e=r.trimRight(e),e=t?e+`
525
- `:e,e},r.getFromCache=function(e,t,i,n){var s=i[e];if(typeof s!="number"){var a=e.length*t;s=n.measureText(e).width+a,i[e]=s}return s},r.collapseSpaces=function(e){return e==="normal"||e==="pre-line"},r.collapseNewlines=function(e){return e==="normal"},r.trimRight=function(e){if(typeof e!="string")return"";for(var t=e.length-1;t>=0;t--){var i=e[t];if(!r.isBreakingSpace(i))break;e=e.slice(0,-1)}return e},r.isNewline=function(e){return typeof e!="string"?!1:r._newlines.indexOf(e.charCodeAt(0))>=0},r.isBreakingSpace=function(e,t){return typeof e!="string"?!1:r._breakingSpaces.indexOf(e.charCodeAt(0))>=0},r.tokenize=function(e){var t=[],i="";if(typeof e!="string")return t;for(var n=0;n<e.length;n++){var s=e[n],a=e[n+1];if(r.isBreakingSpace(s,a)||r.isNewline(s)){i!==""&&(t.push(i),i=""),t.push(s);continue}i+=s}return i!==""&&t.push(i),t},r.canBreakWords=function(e,t){return t},r.canBreakChars=function(e,t,i,n,s){return!0},r.wordWrapSplit=function(e){return e.split("")},r.measureFont=function(e){if(r._fonts[e])return r._fonts[e];var t={ascent:0,descent:0,fontSize:0},i=r._canvas,n=r._context;n.font=e;var s=r.METRICS_STRING+r.BASELINE_SYMBOL,a=Math.ceil(n.measureText(s).width),o=Math.ceil(n.measureText(r.BASELINE_SYMBOL).width),h=Math.ceil(r.HEIGHT_MULTIPLIER*o);o=o*r.BASELINE_MULTIPLIER|0,i.width=a,i.height=h,n.fillStyle="#f00",n.fillRect(0,0,a,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,o);var u=n.getImageData(0,0,a,h).data,l=u.length,f=a*4,c=0,d=0,p=!1;for(c=0;c<o;++c){for(var v=0;v<f;v+=4)if(u[d+v]!==255){p=!0;break}if(!p)d+=f;else break}for(t.ascent=o-c,d=l-f,p=!1,c=h;c>o;--c){for(var v=0;v<f;v+=4)if(u[d+v]!==255){p=!0;break}if(!p)d-=f;else break}return t.descent=c-o,t.fontSize=t.ascent+t.descent,r._fonts[e]=t,t},r.clearMetrics=function(e){e===void 0&&(e=""),e?delete r._fonts[e]:r._fonts={}},Object.defineProperty(r,"_canvas",{get:function(){if(!r.__canvas){var e=void 0;try{var t=new OffscreenCanvas(0,0),i=t.getContext("2d",Ji);if(i&&i.measureText)return r.__canvas=t,t;e=F.ADAPTER.createCanvas()}catch{e=F.ADAPTER.createCanvas()}e.width=e.height=10,r.__canvas=e}return r.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(r,"_context",{get:function(){return r.__context||(r.__context=r._canvas.getContext("2d",Ji)),r.__context},enumerable:!1,configurable:!0}),r}();kt._fonts={},kt.METRICS_STRING="|ÉqÅ",kt.BASELINE_SYMBOL="M",kt.BASELINE_MULTIPLIER=1.4,kt.HEIGHT_MULTIPLIER=2,kt._newlines=[10,13],kt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var up={texture:!0,children:!1,baseTexture:!0},Aa=function(r){ap(e,r);function e(t,i,n){var s=this,a=!1;n||(n=F.ADAPTER.createCanvas(),a=!0),n.width=3,n.height=3;var o=k.from(n);return o.orig=new z,o.trim=new z,s=r.call(this,o)||this,s._ownCanvas=a,s.canvas=n,s.context=n.getContext("2d",{willReadFrequently:!0}),s._resolution=F.RESOLUTION,s._autoResolution=!0,s._text=null,s._style=null,s._styleListener=null,s._font="",s.text=t,s.style=i,s.localStyleID=-1,s}return e.prototype.updateText=function(t){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),!(!this.dirty&&t)){this._font=this._style.toFontString();var n=this.context,s=kt.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=s.width,o=s.height,h=s.lines,u=s.lineHeight,l=s.lineWidths,f=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+i.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+i.padding*2)*this._resolution),n.scale(this._resolution,this._resolution),n.clearRect(0,0,this.canvas.width,this.canvas.height),n.font=this._font,n.lineWidth=i.strokeThickness,n.textBaseline=i.textBaseline,n.lineJoin=i.lineJoin,n.miterLimit=i.miterLimit;for(var d,p,v=i.dropShadow?2:1,_=0;_<v;++_){var m=i.dropShadow&&_===0,y=m?Math.ceil(Math.max(1,o)+i.padding*2):0,g=y*this._resolution;if(m){n.fillStyle="black",n.strokeStyle="black";var b=i.dropShadowColor,x=Fe(typeof b=="number"?b:_s(b)),T=i.dropShadowBlur*this._resolution,w=i.dropShadowDistance*this._resolution;n.shadowColor="rgba("+x[0]*255+","+x[1]*255+","+x[2]*255+","+i.dropShadowAlpha+")",n.shadowBlur=T,n.shadowOffsetX=Math.cos(i.dropShadowAngle)*w,n.shadowOffsetY=Math.sin(i.dropShadowAngle)*w+g}else n.fillStyle=this._generateFillStyle(i,h,s),n.strokeStyle=i.stroke,n.shadowColor="black",n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0;var A=(u-c.fontSize)/2;(!e.nextLineHeightBehavior||u-c.fontSize<0)&&(A=0);for(var E=0;E<h.length;E++)d=i.strokeThickness/2,p=i.strokeThickness/2+E*u+c.ascent+A,i.align==="right"?d+=f-l[E]:i.align==="center"&&(d+=(f-l[E])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(h[E],d+i.padding,p+i.padding-y,!0),i.fill&&this.drawLetterSpacing(h[E],d+i.padding,p+i.padding-y)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,i,n,s){s===void 0&&(s=!1);var a=this._style,o=a.letterSpacing,h=e.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(o===0||h){h&&(this.context.letterSpacing=o,this.context.textLetterSpacing=o),s?this.context.strokeText(t,i,n):this.context.fillText(t,i,n);return}for(var u=i,l=Array.from?Array.from(t):t.split(""),f=this.context.measureText(t).width,c=0,d=0;d<l.length;++d){var p=l[d];s?this.context.strokeText(p,u,n):this.context.fillText(p,u,n);for(var v="",_=d+1;_<l.length;++_)v+=l[_];c=this.context.measureText(v).width,u+=f-c+o,f=c}},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var i=lf(t);i.data&&(t.width=i.width,t.height=i.height,this.context.putImageData(i.data,0,0))}var n=this._texture,s=this._style,a=s.trim?0:s.padding,o=n.baseTexture;n.trim.width=n._frame.width=t.width/this._resolution,n.trim.height=n._frame.height=t.height/this._resolution,n.trim.x=-a,n.trim.y=-a,n.orig.width=n._frame.width-a*2,n.orig.height=n._frame.height-a*2,this._onTextureUpdate(),o.setRealSize(t.width,t.height,this._resolution),n.updateUvs(),this.dirty=!1},e.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),r.prototype._render.call(this,t)},e.prototype.updateTransform=function(){this.updateText(!0),r.prototype.updateTransform.call(this)},e.prototype.getBounds=function(t,i){return this.updateText(!0),this._textureID===-1&&(t=!1),r.prototype.getBounds.call(this,t,i)},e.prototype.getLocalBounds=function(t){return this.updateText(!0),r.prototype.getLocalBounds.call(this,t)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(t,i,n){var s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;var a,o=t.dropShadow?t.dropShadowDistance:0,h=t.padding||0,u=this.canvas.width/this._resolution-o-h*2,l=this.canvas.height/this._resolution-o-h*2,f=s.slice(),c=t.fillGradientStops.slice();if(!c.length)for(var d=f.length+1,p=1;p<d;++p)c.push(p/d);if(f.unshift(s[0]),c.unshift(0),f.push(s[s.length-1]),c.push(1),t.fillGradientType===li.LINEAR_VERTICAL){a=this.context.createLinearGradient(u/2,h,u/2,l+h);for(var v=n.fontProperties.fontSize+t.strokeThickness,p=0;p<i.length;p++){var _=n.lineHeight*(p-1)+v,m=n.lineHeight*p,y=m;p>0&&_>m&&(y=(m+_)/2);var g=m+v,b=n.lineHeight*(p+1),x=g;p+1<i.length&&b<g&&(x=(g+b)/2);for(var T=(x-y)/l,w=0;w<f.length;w++){var A=0;typeof c[w]=="number"?A=c[w]:A=w/f.length;var E=Math.min(1,Math.max(0,y/l+A*T));E=Number(E.toFixed(5)),a.addColorStop(E,f[w])}}}else{a=this.context.createLinearGradient(h,l/2,u+h,l/2);for(var S=f.length+1,D=1,p=0;p<f.length;p++){var C=void 0;typeof c[p]=="number"?C=c[p]:C=D/S,a.addColorStop(C,f[p]),D++}}return a},e.prototype.destroy=function(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},up,t),r.prototype.destroy.call(this,t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var i=Be(this.scale.x)||1;this.scale.x=i*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var i=Be(this.scale.y)||1;this.scale.y=i*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},t instanceof Re?this._style=t:this._style=new Re(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e.experimentalLetterSpacing=!1,e}(ui);F.UPLOADS_PER_FRAME=4;var gn=function(r,e){return gn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},gn(r,e)};function lp(r,e){gn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var fp=function(){function r(e){this.maxItemsPerFrame=e,this.itemsLeft=0}return r.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},r.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},r}();function cp(r,e){var t=!1;if(r&&r._textures&&r._textures.length){for(var i=0;i<r._textures.length;i++)if(r._textures[i]instanceof k){var n=r._textures[i].baseTexture;e.indexOf(n)===-1&&(e.push(n),t=!0)}}return t}function dp(r,e){if(r.baseTexture instanceof Y){var t=r.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function pp(r,e){if(r._texture&&r._texture instanceof k){var t=r._texture.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function vp(r,e){return e instanceof Aa?(e.updateText(!0),!0):!1}function _p(r,e){if(e instanceof Re){var t=e.toFontString();return kt.measureFont(t),!0}return!1}function mp(r,e){if(r instanceof Aa){e.indexOf(r.style)===-1&&e.push(r.style),e.indexOf(r)===-1&&e.push(r);var t=r._texture.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function gp(r,e){return r instanceof Re?(e.indexOf(r)===-1&&e.push(r),!0):!1}var yp=function(){function r(e){var t=this;this.limiter=new fp(F.UPLOADS_PER_FRAME),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){t.queue&&t.prepareItems()},this.registerFindHook(mp),this.registerFindHook(gp),this.registerFindHook(cp),this.registerFindHook(dp),this.registerFindHook(pp),this.registerUploadHook(vp),this.registerUploadHook(_p)}return r.prototype.upload=function(e,t){var i=this;return typeof e=="function"&&(t=e,e=null),t&&Bt("6.5.0","BasePrepare.upload callback is deprecated, use the return Promise instead."),new Promise(function(n){e&&i.add(e);var s=function(){t==null||t(),n()};i.queue.length?(i.completes.push(s),i.ticking||(i.ticking=!0,bt.system.addOnce(i.tick,i,te.UTILITY))):s()})},r.prototype.tick=function(){setTimeout(this.delayedTick,0)},r.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var e=this.queue[0],t=!1;if(e&&!e._destroyed){for(var i=0,n=this.uploadHooks.length;i<n;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)bt.system.addOnce(this.tick,this,te.UTILITY);else{this.ticking=!1;var s=this.completes.slice(0);this.completes.length=0;for(var i=0,n=s.length;i<n;i++)s[i]()}},r.prototype.registerFindHook=function(e){return e&&this.addHooks.push(e),this},r.prototype.registerUploadHook=function(e){return e&&this.uploadHooks.push(e),this},r.prototype.add=function(e){for(var t=0,i=this.addHooks.length;t<i&&!this.addHooks[t](e,this.queue);t++);if(e instanceof St)for(var t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this},r.prototype.destroy=function(){this.ticking&&bt.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},r}();function Ia(r,e){return e instanceof Y?(e._glTextures[r.CONTEXT_UID]||r.texture.bind(e),!0):!1}function xp(r,e){if(!(e instanceof Ce))return!1;var t=e.geometry;e.finishPoly(),t.updateBatches();for(var i=t.batches,n=0;n<i.length;n++){var s=i[n].style.texture;s&&Ia(r,s.baseTexture)}return t.batchable||r.geometry.bind(t,e._resolveDirectShader(r)),!0}function bp(r,e){return r instanceof Ce?(e.push(r),!0):!1}var Tp=function(r){lp(e,r);function e(t){var i=r.call(this,t)||this;return i.uploadHookHelper=i.renderer,i.registerFindHook(bp),i.registerUploadHook(Ia),i.registerUploadHook(xp),i}return e.extension={name:"prepare",type:J.RendererPlugin},e}(yp);var wp=function(){function r(e,t,i){i===void 0&&(i=null),this.linkedSheets=[],this._texture=e instanceof k?e:null,this.baseTexture=e instanceof Y?e:this._texture.baseTexture,this.textures={},this.animations={},this.data=t;var n=this.baseTexture.resource;this.resolution=this._updateResolution(i||(n?n.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return r.prototype._updateResolution=function(e){e===void 0&&(e=null);var t=this.data.meta.scale,i=Oi(e,null);return i===null&&(i=t!==void 0?parseFloat(t):1),i!==1&&this.baseTexture.setResolution(i),i},r.prototype.parse=function(e){var t=this;return e&&Bt("6.5.0","Spritesheet.parse callback is deprecated, use the return Promise instead."),new Promise(function(i){t._callback=function(n){e==null||e(n),i(n)},t._batchIndex=0,t._frameKeys.length<=r.BATCH_SIZE?(t._processFrames(0),t._processAnimations(),t._parseComplete()):t._nextBatch()})},r.prototype._processFrames=function(e){for(var t=e,i=r.BATCH_SIZE;t-e<i&&t<this._frameKeys.length;){var n=this._frameKeys[t],s=this._frames[n],a=s.frame;if(a){var o=null,h=null,u=s.trimmed!==!1&&s.sourceSize?s.sourceSize:s.frame,l=new z(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);s.rotated?o=new z(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new z(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),s.trimmed!==!1&&s.spriteSourceSize&&(h=new z(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new k(this.baseTexture,o,l,h,s.rotated?2:0,s.anchor),k.addToCache(this.textures[n],n)}t++}},r.prototype._processAnimations=function(){var e=this.data.animations||{};for(var t in e){this.animations[t]=[];for(var i=0;i<e[t].length;i++){var n=e[t][i];this.animations[t].push(this.textures[n])}}},r.prototype._parseComplete=function(){var e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)},r.prototype._nextBatch=function(){var e=this;this._processFrames(this._batchIndex*r.BATCH_SIZE),this._batchIndex++,setTimeout(function(){e._batchIndex*r.BATCH_SIZE<e._frameKeys.length?e._nextBatch():(e._processAnimations(),e._parseComplete())},0)},r.prototype.destroy=function(e){var t;e===void 0&&(e=!1);for(var i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((t=this._texture)===null||t===void 0||t.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]},r.BATCH_SIZE=1e3,r}(),Ep=function(){function r(){}return r.use=function(e,t){var i,n,s=this,a=e.name+"_image";if(!e.data||e.type!==dt.TYPE.JSON||!e.data.frames||s.resources[a]){t();return}var o=(n=(i=e.data)===null||i===void 0?void 0:i.meta)===null||n===void 0?void 0:n.related_multi_packs;if(Array.isArray(o))for(var h=function(p){if(typeof p!="string")return"continue";var v=p.replace(".json",""),_=De.resolve(e.url.replace(s.baseUrl,""),p);if(s.resources[v]||Object.values(s.resources).some(function(y){return De.format(De.parse(y.url))===_}))return"continue";var m={crossOrigin:e.crossOrigin,loadType:dt.LOAD_TYPE.XHR,xhrType:dt.XHR_RESPONSE_TYPE.JSON,parentResource:e,metadata:e.metadata};s.add(v,_,m)},u=0,l=o;u<l.length;u++){var f=l[u];h(f)}var c={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},d=r.getResourcePath(e,s.baseUrl);s.add(a,d,c,function(v){if(v.error){t(v.error);return}var _=new wp(v.texture,e.data,e.url);_.parse().then(function(){e.spritesheet=_,e.textures=_.textures,t()})})},r.getResourcePath=function(e,t){return e.isDataUrl?e.data.meta.image:De.resolve(e.url.replace(t,""),e.data.meta.image)},r.extension=J.Loader,r}();var yn=function(r,e){return yn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},yn(r,e)};function Oa(r,e){yn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var fi=new W;(function(r){Oa(e,r);function e(t,i,n){i===void 0&&(i=100),n===void 0&&(n=100);var s=r.call(this,t)||this;return s.tileTransform=new Hn,s._width=i,s._height=n,s.uvMatrix=s.texture.uvMatrix||new zr(t),s.pluginName="tilingSprite",s.uvRespectAnchor=!1,s}return Object.defineProperty(e.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(t){this.tileTransform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(t){this.tileTransform.position.copyFrom(t)},enumerable:!1,configurable:!0}),e.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},e.prototype._render=function(t){var i=this._texture;!i||!i.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))},e.prototype._calculateBounds=function(){var t=this._width*-this._anchor._x,i=this._height*-this._anchor._y,n=this._width*(1-this._anchor._x),s=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,i,n,s)},e.prototype.getLocalBounds=function(t){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new z),t=this._localBoundsRect),this._bounds.getRectangle(t)):r.prototype.getLocalBounds.call(this,t)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,fi);var i=this._width,n=this._height,s=-i*this.anchor._x;if(fi.x>=s&&fi.x<s+i){var a=-n*this.anchor._y;if(fi.y>=a&&fi.y<a+n)return!0}return!1},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this.tileTransform=null,this.uvMatrix=null},e.from=function(t,i){var n=t instanceof k?t:k.from(t,i);return new e(n,i.width,i.height)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),e})(ui);var Sp=`#version 100
524
+ `,Zd=function(r){ya(e,r);function e(t){var i=r.call(this,t)||this;return i.shader=null,i.properties=null,i.tempMatrix=new gt,i.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:i.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:i.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:i.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:i.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:L.UNSIGNED_BYTE,uploadFunction:i.uploadTint,offset:0}],i.shader=ae.from($d,qd,{}),i.state=Ee.for2d(),i}return e.prototype.render=function(t){var i=t.children,n=t._maxSize,s=t._batchSize,a=this.renderer,o=i.length;if(o!==0){o>n&&!t.autoResize&&(o=n);var h=t._buffers;h||(h=t._buffers=this.generateBuffers(t));var u=i[0]._texture.baseTexture,l=u.alphaMode>0;this.state.blendMode=ys(t.blendMode,l),a.state.set(this.state);var f=a.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=lf(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,l),this.shader.uniforms.uSampler=u,this.renderer.shader.bind(this.shader);for(var d=!1,p=0,v=0;p<o;p+=s,v+=1){var _=o-p;_>s&&(_=s),v>=h.length&&h.push(this._generateOneMoreBuffer(t));var m=h[v];m.uploadDynamic(i,p,_);var g=t._bufferUpdateIDs[v]||0;d=d||m._updateID<g,d&&(m._updateID=t._updateID,m.uploadStatic(i,p,_)),a.geometry.bind(m.geometry),f.drawElements(f.TRIANGLES,_*6,f.UNSIGNED_SHORT,0)}}},e.prototype.generateBuffers=function(t){for(var i=[],n=t._maxSize,s=t._batchSize,a=t._properties,o=0;o<n;o+=s)i.push(new xa(this.properties,a,s));return i},e.prototype._generateOneMoreBuffer=function(t){var i=t._batchSize,n=t._properties;return new xa(this.properties,n,i)},e.prototype.uploadVertices=function(t,i,n,s,a,o){for(var h=0,u=0,l=0,f=0,c=0;c<n;++c){var d=t[i+c],p=d._texture,v=d.scale.x,_=d.scale.y,m=p.trim,g=p.orig;m?(u=m.x-d.anchor.x*g.width,h=u+m.width,f=m.y-d.anchor.y*g.height,l=f+m.height):(h=g.width*(1-d.anchor.x),u=g.width*-d.anchor.x,l=g.height*(1-d.anchor.y),f=g.height*-d.anchor.y),s[o]=u*v,s[o+1]=f*_,s[o+a]=h*v,s[o+a+1]=f*_,s[o+a*2]=h*v,s[o+a*2+1]=l*_,s[o+a*3]=u*v,s[o+a*3+1]=l*_,o+=a*4}},e.prototype.uploadPosition=function(t,i,n,s,a,o){for(var h=0;h<n;h++){var u=t[i+h].position;s[o]=u.x,s[o+1]=u.y,s[o+a]=u.x,s[o+a+1]=u.y,s[o+a*2]=u.x,s[o+a*2+1]=u.y,s[o+a*3]=u.x,s[o+a*3+1]=u.y,o+=a*4}},e.prototype.uploadRotation=function(t,i,n,s,a,o){for(var h=0;h<n;h++){var u=t[i+h].rotation;s[o]=u,s[o+a]=u,s[o+a*2]=u,s[o+a*3]=u,o+=a*4}},e.prototype.uploadUvs=function(t,i,n,s,a,o){for(var h=0;h<n;++h){var u=t[i+h]._texture._uvs;u?(s[o]=u.x0,s[o+1]=u.y0,s[o+a]=u.x1,s[o+a+1]=u.y1,s[o+a*2]=u.x2,s[o+a*2+1]=u.y2,s[o+a*3]=u.x3,s[o+a*3+1]=u.y3,o+=a*4):(s[o]=0,s[o+1]=0,s[o+a]=0,s[o+a+1]=0,s[o+a*2]=0,s[o+a*2+1]=0,s[o+a*3]=0,s[o+a*3+1]=0,o+=a*4)}},e.prototype.uploadTint=function(t,i,n,s,a,o){for(var h=0;h<n;++h){var u=t[i+h],l=u._texture.baseTexture.alphaMode>0,f=u.alpha,c=f<1&&l?Ir(u._tintRGB,f):u._tintRGB+(f*255<<24);s[o]=c,s[o+a]=c,s[o+a*2]=c,s[o+a*3]=c,o+=a*4}},e.prototype.destroy=function(){r.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},e.extension={name:"particle",type:tt.RendererPlugin},e}(Li);var ne;(function(r){r.MITER="miter",r.BEVEL="bevel",r.ROUND="round"})(ne||(ne={}));var ue;(function(r){r.BUTT="butt",r.ROUND="round",r.SQUARE="square"})(ue||(ue={}));var ui={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(r,e){if(e===void 0&&(e=20),!this.adaptive||!r||isNaN(r))return e;var t=Math.ceil(r/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}},ba=function(){function r(){this.color=16777215,this.alpha=1,this.texture=k.WHITE,this.matrix=null,this.visible=!1,this.reset()}return r.prototype.clone=function(){var e=new r;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},r.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=k.WHITE,this.matrix=null,this.visible=!1},r.prototype.destroy=function(){this.texture=null,this.matrix=null},r}();var cn=function(r,e){return cn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},cn(r,e)};function dn(r,e){cn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Ta(r,e){var t,i;e===void 0&&(e=!1);var n=r.length;if(!(n<6)){for(var s=0,a=0,o=r[n-2],h=r[n-1];a<n;a+=2){var u=r[a],l=r[a+1];s+=(u-o)*(l+h),o=u,h=l}if(!e&&s>0||e&&s<=0)for(var f=n/2,a=f+f%2;a<n;a+=2){var c=n-a-2,d=n-a-1,p=a,v=a+1;t=[r[p],r[c]],r[c]=t[0],r[p]=t[1],i=[r[v],r[d]],r[d]=i[0],r[v]=i[1]}}}var wa={build:function(r){r.points=r.shape.points.slice()},triangulate:function(r,e){var t=r.points,i=r.holes,n=e.points,s=e.indices;if(t.length>=6){Ta(t,!1);for(var a=[],o=0;o<i.length;o++){var h=i[o];Ta(h.points,!0),a.push(t.length/2),t=t.concat(h.points)}var u=Si.exports(t,a,2);if(!u)return;for(var l=n.length/2,o=0;o<u.length;o+=3)s.push(u[o]+l),s.push(u[o+1]+l),s.push(u[o+2]+l);for(var o=0;o<t.length;o++)n.push(t[o])}}},Qi={build:function(r){var e=r.points,t,i,n,s,a,o;if(r.type===bt.CIRC){var h=r.shape;t=h.x,i=h.y,a=o=h.radius,n=s=0}else if(r.type===bt.ELIP){var u=r.shape;t=u.x,i=u.y,a=u.width,o=u.height,n=s=0}else{var l=r.shape,f=l.width/2,c=l.height/2;t=l.x+f,i=l.y+c,a=o=Math.max(0,Math.min(l.radius,Math.min(f,c))),n=f-a,s=c-o}if(!(a>=0&&o>=0&&n>=0&&s>=0)){e.length=0;return}var d=Math.ceil(2.3*Math.sqrt(a+o)),p=d*8+(n?4:0)+(s?4:0);if(e.length=p,p!==0){if(d===0){e.length=8,e[0]=e[6]=t+n,e[1]=e[3]=i+s,e[2]=e[4]=t-n,e[5]=e[7]=i-s;return}var v=0,_=d*4+(n?2:0)+2,m=_,g=p;{var y=n+a,b=s,x=t+y,T=t-y,w=i+b;if(e[v++]=x,e[v++]=w,e[--_]=w,e[--_]=T,s){var A=i-b;e[m++]=T,e[m++]=A,e[--g]=A,e[--g]=x}}for(var S=1;S<d;S++){var E=Math.PI/2*(S/d),y=n+Math.cos(E)*a,b=s+Math.sin(E)*o,x=t+y,T=t-y,w=i+b,A=i-b;e[v++]=x,e[v++]=w,e[--_]=w,e[--_]=T,e[m++]=T,e[m++]=A,e[--g]=A,e[--g]=x}{var y=n,b=s+o,x=t+y,T=t-y,w=i+b,A=i-b;e[v++]=x,e[v++]=w,e[--g]=A,e[--g]=x,n&&(e[v++]=T,e[v++]=w,e[--g]=A,e[--g]=T)}}},triangulate:function(r,e){var t=r.points,i=e.points,n=e.indices;if(t.length!==0){var s=i.length/2,a=s,o,h;if(r.type!==bt.RREC){var u=r.shape;o=u.x,h=u.y}else{var l=r.shape;o=l.x+l.width/2,h=l.y+l.height/2}var f=r.matrix;i.push(r.matrix?f.a*o+f.c*h+f.tx:o,r.matrix?f.b*o+f.d*h+f.ty:h),s++,i.push(t[0],t[1]);for(var c=2;c<t.length;c+=2)i.push(t[c],t[c+1]),n.push(s++,a,s);n.push(a+1,a,s)}}},Kd={build:function(r){var e=r.shape,t=e.x,i=e.y,n=e.width,s=e.height,a=r.points;a.length=0,a.push(t,i,t+n,i,t+n,i+s,t,i+s)},triangulate:function(r,e){var t=r.points,i=e.points,n=i.length/2;i.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function ke(r,e,t){var i=e-r;return r+i*t}function Ji(r,e,t,i,n,s,a){a===void 0&&(a=[]);for(var o=20,h=a,u=0,l=0,f=0,c=0,d=0,p=0,v=0,_=0;v<=o;++v)_=v/o,u=ke(r,t,_),l=ke(e,i,_),f=ke(t,n,_),c=ke(i,s,_),d=ke(u,f,_),p=ke(l,c,_),!(v===0&&h[h.length-2]===d&&h[h.length-1]===p)&&h.push(d,p);return h}var Qd={build:function(r){if(Ae.nextRoundedRectBehavior){Qi.build(r);return}var e=r.shape,t=r.points,i=e.x,n=e.y,s=e.width,a=e.height,o=Math.max(0,Math.min(e.radius,Math.min(s,a)/2));t.length=0,o?(Ji(i,n+o,i,n,i+o,n,t),Ji(i+s-o,n,i+s,n,i+s,n+o,t),Ji(i+s,n+a-o,i+s,n+a,i+s-o,n+a,t),Ji(i+o,n+a,i,n+a,i,n+a-o,t)):t.push(i,n,i+s,n,i+s,n+a,i,n+a)},triangulate:function(r,e){if(Ae.nextRoundedRectBehavior){Qi.triangulate(r,e);return}for(var t=r.points,i=e.points,n=e.indices,s=i.length/2,a=Si.exports(t,null,2),o=0,h=a.length;o<h;o+=3)n.push(a[o]+s),n.push(a[o+1]+s),n.push(a[o+2]+s);for(var o=0,h=t.length;o<h;o++)i.push(t[o],t[++o])}};function Ea(r,e,t,i,n,s,a,o){var h=r-t*n,u=e-i*n,l=r+t*s,f=e+i*s,c,d;a?(c=i,d=-t):(c=-i,d=t);var p=h+c,v=u+d,_=l+c,m=f+d;return o.push(p,v),o.push(_,m),2}function Re(r,e,t,i,n,s,a,o){var h=t-r,u=i-e,l=Math.atan2(h,u),f=Math.atan2(n-r,s-e);o&&l<f?l+=Math.PI*2:!o&&l>f&&(f+=Math.PI*2);var c=l,d=f-l,p=Math.abs(d),v=Math.sqrt(h*h+u*u),_=(15*p*Math.sqrt(v)/Math.PI>>0)+1,m=d/_;if(c+=m,o){a.push(r,e),a.push(t,i);for(var g=1,y=c;g<_;g++,y+=m)a.push(r,e),a.push(r+Math.sin(y)*v,e+Math.cos(y)*v);a.push(r,e),a.push(n,s)}else{a.push(t,i),a.push(r,e);for(var g=1,y=c;g<_;g++,y+=m)a.push(r+Math.sin(y)*v,e+Math.cos(y)*v),a.push(r,e);a.push(n,s),a.push(r,e)}return _*2}function Jd(r,e){var t=r.shape,i=r.points||t.points.slice(),n=e.closePointEps;if(i.length!==0){var s=r.lineStyle,a=new X(i[0],i[1]),o=new X(i[i.length-2],i[i.length-1]),h=t.type!==bt.POLY||t.closeStroke,u=Math.abs(a.x-o.x)<n&&Math.abs(a.y-o.y)<n;if(h){i=i.slice(),u&&(i.pop(),i.pop(),o.set(i[i.length-2],i[i.length-1]));var l=(a.x+o.x)*.5,f=(o.y+a.y)*.5;i.unshift(l,f),i.push(l,f)}var c=e.points,d=i.length/2,p=i.length,v=c.length/2,_=s.width/2,m=_*_,g=s.miterLimit*s.miterLimit,y=i[0],b=i[1],x=i[2],T=i[3],w=0,A=0,S=-(b-T),E=y-x,D=0,C=0,N=Math.sqrt(S*S+E*E);S/=N,E/=N,S*=_,E*=_;var W=s.alignment,M=(1-W)*2,O=W*2;h||(s.cap===ue.ROUND?p+=Re(y-S*(M-O)*.5,b-E*(M-O)*.5,y-S*M,b-E*M,y+S*O,b+E*O,c,!0)+2:s.cap===ue.SQUARE&&(p+=Ea(y,b,S,E,M,O,!0,c))),c.push(y-S*M,b-E*M),c.push(y+S*O,b+E*O);for(var U=1;U<d-1;++U){y=i[(U-1)*2],b=i[(U-1)*2+1],x=i[U*2],T=i[U*2+1],w=i[(U+1)*2],A=i[(U+1)*2+1],S=-(b-T),E=y-x,N=Math.sqrt(S*S+E*E),S/=N,E/=N,S*=_,E*=_,D=-(T-A),C=x-w,N=Math.sqrt(D*D+C*C),D/=N,C/=N,D*=_,C*=_;var rt=x-y,z=b-T,I=x-w,P=A-T,B=rt*I+z*P,$=z*I-P*rt,Z=$<0;if(Math.abs($)<.001*Math.abs(B)){c.push(x-S*M,T-E*M),c.push(x+S*O,T+E*O),B>=0&&(s.join===ne.ROUND?p+=Re(x,T,x-S*M,T-E*M,x-D*M,T-C*M,c,!1)+4:p+=2,c.push(x-D*O,T-C*O),c.push(x+D*M,T+C*M));continue}var vt=(-S+y)*(-E+T)-(-S+x)*(-E+b),st=(-D+w)*(-C+T)-(-D+x)*(-C+A),at=(rt*st-I*vt)/$,wt=(P*vt-z*st)/$,St=(at-x)*(at-x)+(wt-T)*(wt-T),_t=x+(at-x)*M,et=T+(wt-T)*M,nt=x-(at-x)*O,ot=T-(wt-T)*O,q=Math.min(rt*rt+z*z,I*I+P*P),Rt=Z?M:O,Ct=q+Rt*Rt*m,Q=St<=Ct;Q?s.join===ne.BEVEL||St/m>g?(Z?(c.push(_t,et),c.push(x+S*O,T+E*O),c.push(_t,et),c.push(x+D*O,T+C*O)):(c.push(x-S*M,T-E*M),c.push(nt,ot),c.push(x-D*M,T-C*M),c.push(nt,ot)),p+=2):s.join===ne.ROUND?Z?(c.push(_t,et),c.push(x+S*O,T+E*O),p+=Re(x,T,x+S*O,T+E*O,x+D*O,T+C*O,c,!0)+4,c.push(_t,et),c.push(x+D*O,T+C*O)):(c.push(x-S*M,T-E*M),c.push(nt,ot),p+=Re(x,T,x-S*M,T-E*M,x-D*M,T-C*M,c,!1)+4,c.push(x-D*M,T-C*M),c.push(nt,ot)):(c.push(_t,et),c.push(nt,ot)):(c.push(x-S*M,T-E*M),c.push(x+S*O,T+E*O),s.join===ne.ROUND?Z?p+=Re(x,T,x+S*O,T+E*O,x+D*O,T+C*O,c,!0)+2:p+=Re(x,T,x-S*M,T-E*M,x-D*M,T-C*M,c,!1)+2:s.join===ne.MITER&&St/m<=g&&(Z?(c.push(nt,ot),c.push(nt,ot)):(c.push(_t,et),c.push(_t,et)),p+=2),c.push(x-D*M,T-C*M),c.push(x+D*O,T+C*O),p+=2)}y=i[(d-2)*2],b=i[(d-2)*2+1],x=i[(d-1)*2],T=i[(d-1)*2+1],S=-(b-T),E=y-x,N=Math.sqrt(S*S+E*E),S/=N,E/=N,S*=_,E*=_,c.push(x-S*M,T-E*M),c.push(x+S*O,T+E*O),h||(s.cap===ue.ROUND?p+=Re(x-S*(M-O)*.5,T-E*(M-O)*.5,x-S*M,T-E*M,x+S*O,T+E*O,c,!1)+2:s.cap===ue.SQUARE&&(p+=Ea(x,T,S,E,M,O,!1,c)));for(var Kt=e.indices,je=ui.epsilon*ui.epsilon,U=v;U<p+v-2;++U)y=c[U*2],b=c[U*2+1],x=c[(U+1)*2],T=c[(U+1)*2+1],w=c[(U+2)*2],A=c[(U+2)*2+1],!(Math.abs(y*(T-A)+x*(A-b)+w*(b-T))<je)&&Kt.push(U,U+1,U+2)}}function tp(r,e){var t=0,i=r.shape,n=r.points||i.points,s=i.type!==bt.POLY||i.closeStroke;if(n.length!==0){var a=e.points,o=e.indices,h=n.length/2,u=a.length/2,l=u;for(a.push(n[0],n[1]),t=1;t<h;t++)a.push(n[t*2],n[t*2+1]),o.push(l,l+1),l++;s&&o.push(l,u)}}function Sa(r,e){r.lineStyle.native?tp(r,e):Jd(r,e)}var Pa=function(){function r(){}return r.curveTo=function(e,t,i,n,s,a){var o=a[a.length-2],h=a[a.length-1],u=h-t,l=o-e,f=n-t,c=i-e,d=Math.abs(u*c-l*f);if(d<1e-8||s===0)return(a[a.length-2]!==e||a[a.length-1]!==t)&&a.push(e,t),null;var p=u*u+l*l,v=f*f+c*c,_=u*f+l*c,m=s*Math.sqrt(p)/d,g=s*Math.sqrt(v)/d,y=m*_/p,b=g*_/v,x=m*c+g*l,T=m*f+g*u,w=l*(g+y),A=u*(g+y),S=c*(m+b),E=f*(m+b),D=Math.atan2(A-T,w-x),C=Math.atan2(E-T,S-x);return{cx:x+e,cy:T+t,radius:s,startAngle:D,endAngle:C,anticlockwise:l*f>c*u}},r.arc=function(e,t,i,n,s,a,o,h,u){for(var l=o-a,f=ui._segmentsCount(Math.abs(l)*s,Math.ceil(Math.abs(l)/Wt)*40),c=l/(f*2),d=c*2,p=Math.cos(c),v=Math.sin(c),_=f-1,m=_%1/_,g=0;g<=_;++g){var y=g+m*g,b=c+a+d*y,x=Math.cos(b),T=-Math.sin(b);u.push((p*x+v*T)*s+i,(p*-T+v*x)*s+n)}},r}(),ep=function(){function r(){}return r.curveLength=function(e,t,i,n,s,a,o,h){for(var u=10,l=0,f=0,c=0,d=0,p=0,v=0,_=0,m=0,g=0,y=0,b=0,x=e,T=t,w=1;w<=u;++w)f=w/u,c=f*f,d=c*f,p=1-f,v=p*p,_=v*p,m=_*e+3*v*f*i+3*p*c*s+d*o,g=_*t+3*v*f*n+3*p*c*a+d*h,y=x-m,b=T-g,x=m,T=g,l+=Math.sqrt(y*y+b*b);return l},r.curveTo=function(e,t,i,n,s,a,o){var h=o[o.length-2],u=o[o.length-1];o.length-=2;var l=ui._segmentsCount(r.curveLength(h,u,e,t,i,n,s,a)),f=0,c=0,d=0,p=0,v=0;o.push(h,u);for(var _=1,m=0;_<=l;++_)m=_/l,f=1-m,c=f*f,d=c*f,p=m*m,v=p*m,o.push(d*h+3*c*m*e+3*f*p*i+v*s,d*u+3*c*m*t+3*f*p*n+v*a)},r}(),ip=function(){function r(){}return r.curveLength=function(e,t,i,n,s,a){var o=e-2*i+s,h=t-2*n+a,u=2*i-2*e,l=2*n-2*t,f=4*(o*o+h*h),c=4*(o*u+h*l),d=u*u+l*l,p=2*Math.sqrt(f+c+d),v=Math.sqrt(f),_=2*f*v,m=2*Math.sqrt(d),g=c/v;return(_*p+v*c*(p-m)+(4*d*f-c*c)*Math.log((2*v+g+p)/(g+m)))/(4*_)},r.curveTo=function(e,t,i,n,s){for(var a=s[s.length-2],o=s[s.length-1],h=ui._segmentsCount(r.curveLength(a,o,e,t,i,n)),u=0,l=0,f=1;f<=h;++f){var c=f/h;u=a+(e-a)*c,l=o+(t-o)*c,s.push(u+(e+(i-e)*c-u)*c,l+(t+(n-t)*c-l)*c)}},r}(),rp=function(){function r(){this.reset()}return r.prototype.begin=function(e,t,i){this.reset(),this.style=e,this.start=t,this.attribStart=i},r.prototype.end=function(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start},r.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},r}(),Ce,pn=(Ce={},Ce[bt.POLY]=wa,Ce[bt.CIRC]=Qi,Ce[bt.ELIP]=Qi,Ce[bt.RECT]=Kd,Ce[bt.RREC]=Qd,Ce),Ra=[],tr=[],Ca=function(){function r(e,t,i,n){t===void 0&&(t=null),i===void 0&&(i=null),n===void 0&&(n=null),this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=t,this.matrix=n,this.type=e.type}return r.prototype.clone=function(){return new r(this.shape,this.fillStyle,this.lineStyle,this.matrix)},r.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},r}(),He=new X,np=function(r){dn(e,r);function e(){var t=r.call(this)||this;return t.closePointEps=1e-4,t.boundsPadding=0,t.uvsFloat32=null,t.indicesUint16=null,t.batchable=!1,t.points=[],t.colors=[],t.uvs=[],t.indices=[],t.textureIds=[],t.graphicsData=[],t.drawCalls=[],t.batchDirty=-1,t.batches=[],t.dirty=0,t.cacheDirty=-1,t.clearDirty=0,t.shapeIndex=0,t._bounds=new Fi,t.boundsDirty=-1,t}return Object.defineProperty(e.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),tr.push(this.drawCalls[t]);this.drawCalls.length=0;for(var t=0;t<this.batches.length;t++){var i=this.batches[t];i.reset(),Ra.push(i)}this.batches.length=0},e.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},e.prototype.drawShape=function(t,i,n,s){i===void 0&&(i=null),n===void 0&&(n=null),s===void 0&&(s=null);var a=new Ca(t,i,n,s);return this.graphicsData.push(a),this.dirty++,this},e.prototype.drawHole=function(t,i){if(i===void 0&&(i=null),!this.graphicsData.length)return null;var n=new Ca(t,null,null,i),s=this.graphicsData[this.graphicsData.length-1];return n.lineStyle=s.lineStyle,s.holes.push(n),this.dirty++,this},e.prototype.destroy=function(){r.prototype.destroy.call(this);for(var t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},e.prototype.containsPoint=function(t){for(var i=this.graphicsData,n=0;n<i.length;++n){var s=i[n];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,He):He.copyFrom(t),s.shape.contains(He.x,He.y))){var a=!1;if(s.holes)for(var o=0;o<s.holes.length;o++){var h=s.holes[o];if(h.shape.contains(He.x,He.y)){a=!0;break}}if(!a)return!0}}return!1},e.prototype.updateBatches=function(){if(!this.graphicsData.length){this.batchable=!0;return}if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,i=this.graphicsData,n=null,s=null;this.batches.length>0&&(n=this.batches[this.batches.length-1],s=n.style);for(var a=this.shapeIndex;a<i.length;a++){this.shapeIndex++;var o=i[a],h=o.fillStyle,u=o.lineStyle,l=pn[o.type];l.build(o),o.matrix&&this.transformPoints(o.points,o.matrix),(h.visible||u.visible)&&this.processHoles(o.holes);for(var f=0;f<2;f++){var c=f===0?h:u;if(c.visible){var d=c.texture.baseTexture,p=this.indices.length,v=this.points.length/2;d.wrapMode=zt.REPEAT,f===0?this.processFill(o):this.processLine(o);var _=this.points.length/2-v;_!==0&&(n&&!this._compareStyles(s,c)&&(n.end(p,v),n=null),n||(n=Ra.pop()||new rp,n.begin(c,p,v),this.batches.push(n),s=c),this.addUvs(this.points,t,c.texture,v,_,c.matrix))}}}var m=this.indices.length,g=this.points.length/2;if(n&&n.end(m,g),this.batches.length===0){this.batchable=!0;return}var y=g>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&y===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=y?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}},e.prototype._compareStyles=function(t,i){return!(!t||!i||t.texture.baseTexture!==i.texture.baseTexture||t.color+t.alpha!==i.color+i.alpha||!!t.native!=!!i.native)},e.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,i=this.graphicsData.length;t<i;t++){var n=this.graphicsData[t],s=n.fillStyle,a=n.lineStyle;if(s&&!s.texture.baseTexture.valid||a&&!a.texture.baseTexture.valid)return!1}return!0},e.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,i=0,n=t.length;i<n;i++)for(var s=t[i],a=0;a<s.size;a++){var o=s.start+a;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}},e.prototype.isBatchable=function(){if(this.points.length>65535*2)return!1;for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<e.BATCHABLE_SIZE*2},e.prototype.buildDrawCalls=function(){for(var t=++V._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),tr.push(this.drawCalls[i]);this.drawCalls.length=0;var n=this.colors,s=this.textureIds,a=tr.pop();a||(a=new Zr,a.texArray=new Kr),a.texArray.count=0,a.start=0,a.size=0,a.type=Dt.TRIANGLES;var o=0,h=null,u=0,l=!1,f=Dt.TRIANGLES,c=0;this.drawCalls.push(a);for(var i=0;i<this.batches.length;i++){var d=this.batches[i],p=8,v=d.style,_=v.texture.baseTexture;l!==!!v.native&&(l=!!v.native,f=l?Dt.LINES:Dt.TRIANGLES,h=null,o=p,t++),h!==_&&(h=_,_._batchEnabled!==t&&(o===p&&(t++,o=0,a.size>0&&(a=tr.pop(),a||(a=new Zr,a.texArray=new Kr),this.drawCalls.push(a)),a.start=c,a.size=0,a.texArray.count=0,a.type=f),_.touched=1,_._batchEnabled=t,_._batchLocation=o,_.wrapMode=zt.REPEAT,a.texArray.elements[a.texArray.count++]=_,o++)),a.size+=d.size,c+=d.size,u=_._batchLocation,this.addColors(n,v.color,v.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,u,d.attribSize,d.attribStart)}V._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,i=this.uvs,n=this.colors,s=this.textureIds,a=new ArrayBuffer(t.length*3*4),o=new Float32Array(a),h=new Uint32Array(a),u=0,l=0;l<t.length/2;l++)o[u++]=t[l*2],o[u++]=t[l*2+1],o[u++]=i[l*2],o[u++]=i[l*2+1],h[u++]=n[l],o[u++]=s[l];this._buffer.update(a),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){if(t.holes.length)wa.triangulate(t,this);else{var i=pn[t.type];i.triangulate(t,this)}},e.prototype.processLine=function(t){Sa(t,this);for(var i=0;i<t.holes.length;i++)Sa(t.holes[i],this)},e.prototype.processHoles=function(t){for(var i=0;i<t.length;i++){var n=t[i],s=pn[n.type];s.build(n),n.matrix&&this.transformPoints(n.points,n.matrix)}},e.prototype.calculateBounds=function(){var t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)},e.prototype.transformPoints=function(t,i){for(var n=0;n<t.length/2;n++){var s=t[n*2],a=t[n*2+1];t[n*2]=i.a*s+i.c*a+i.tx,t[n*2+1]=i.b*s+i.d*a+i.ty}},e.prototype.addColors=function(t,i,n,s,a){a===void 0&&(a=0);var o=(i>>16)+(i&65280)+((i&255)<<16),h=Ir(o,n);t.length=Math.max(t.length,a+s);for(var u=0;u<s;u++)t[a+u]=h},e.prototype.addTextureIds=function(t,i,n,s){s===void 0&&(s=0),t.length=Math.max(t.length,s+n);for(var a=0;a<n;a++)t[s+a]=i},e.prototype.addUvs=function(t,i,n,s,a,o){o===void 0&&(o=null);for(var h=0,u=i.length,l=n.frame;h<a;){var f=t[(s+h)*2],c=t[(s+h)*2+1];if(o){var d=o.a*f+o.c*c+o.tx;c=o.b*f+o.d*c+o.ty,f=d}h++,i.push(f/l.width,c/l.height)}var p=n.baseTexture;(l.width<p.width||l.height<p.height)&&this.adjustUvs(i,n,u,a)},e.prototype.adjustUvs=function(t,i,n,s){for(var a=i.baseTexture,o=1e-6,h=n+s*2,u=i.frame,l=u.width/a.width,f=u.height/a.height,c=u.x/u.width,d=u.y/u.height,p=Math.floor(t[n]+o),v=Math.floor(t[n+1]+o),_=n+2;_<h;_+=2)p=Math.min(p,Math.floor(t[_]+o)),v=Math.min(v,Math.floor(t[_+1]+o));c-=p,d-=v;for(var _=n;_<h;_+=2)t[_]=(t[_]+c)*l,t[_+1]=(t[_+1]+d)*f},e.BATCHABLE_SIZE=100,e}(ta),sp=function(r){dn(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.width=0,t.alignment=.5,t.native=!1,t.cap=ue.BUTT,t.join=ne.MITER,t.miterLimit=10,t}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},e.prototype.reset=function(){r.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},e}(ba),ap=new Float32Array(3),vn={},Ae=function(r){dn(e,r);function e(t){t===void 0&&(t=null);var i=r.call(this)||this;return i.shader=null,i.pluginName="batch",i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i._fillStyle=new ba,i._lineStyle=new sp,i._matrix=null,i._holeMode=!1,i.state=Ee.for2d(),i._geometry=t||new np,i._geometry.refCount++,i._transformID=-1,i.tint=16777215,i.blendMode=G.NORMAL,i}return Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return this.finishPoly(),new e(this._geometry)},Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),e.prototype.lineStyle=function(t,i,n,s,a){return t===void 0&&(t=null),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=.5),a===void 0&&(a=!1),typeof t=="number"&&(t={width:t,color:i,alpha:n,alignment:s,native:a}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:k.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:ue.BUTT,join:ne.MITER,miterLimit:10},t),this.currentPath&&this.startPoly();var i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this},e.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,i=this.currentPath.points.length;i>2&&(this.drawShape(this.currentPath),this.currentPath=new yi,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[i-2],t[i-1]))}else this.currentPath=new yi,this.currentPath.closeStroke=!1},e.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},e.prototype.moveTo=function(t,i){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=i,this},e.prototype.lineTo=function(t,i){this.currentPath||this.moveTo(0,0);var n=this.currentPath.points,s=n[n.length-2],a=n[n.length-1];return(s!==t||a!==i)&&n.push(t,i),this},e.prototype._initCurve=function(t,i){t===void 0&&(t=0),i===void 0&&(i=0),this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,i]):this.moveTo(t,i)},e.prototype.quadraticCurveTo=function(t,i,n,s){this._initCurve();var a=this.currentPath.points;return a.length===0&&this.moveTo(0,0),ip.curveTo(t,i,n,s,a),this},e.prototype.bezierCurveTo=function(t,i,n,s,a,o){return this._initCurve(),ep.curveTo(t,i,n,s,a,o,this.currentPath.points),this},e.prototype.arcTo=function(t,i,n,s,a){this._initCurve(t,i);var o=this.currentPath.points,h=Pa.curveTo(t,i,n,s,a,o);if(h){var u=h.cx,l=h.cy,f=h.radius,c=h.startAngle,d=h.endAngle,p=h.anticlockwise;this.arc(u,l,f,c,d,p)}return this},e.prototype.arc=function(t,i,n,s,a,o){if(o===void 0&&(o=!1),s===a)return this;!o&&a<=s?a+=Wt:o&&s<=a&&(s+=Wt);var h=a-s;if(h===0)return this;var u=t+Math.cos(s)*n,l=i+Math.sin(s)*n,f=this._geometry.closePointEps,c=this.currentPath?this.currentPath.points:null;if(c){var d=Math.abs(c[c.length-2]-u),p=Math.abs(c[c.length-1]-l);d<f&&p<f||c.push(u,l)}else this.moveTo(u,l),c=this.currentPath.points;return Pa.arc(u,l,t,i,n,s,a,o,c),this},e.prototype.beginFill=function(t,i){return t===void 0&&(t=0),i===void 0&&(i=1),this.beginTextureFill({texture:k.WHITE,color:t,alpha:i})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:k.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this},e.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},e.prototype.drawRect=function(t,i,n,s){return this.drawShape(new j(t,i,n,s))},e.prototype.drawRoundedRect=function(t,i,n,s,a){return this.drawShape(new go(t,i,n,s,a))},e.prototype.drawCircle=function(t,i,n){return this.drawShape(new _o(t,i,n))},e.prototype.drawEllipse=function(t,i,n,s){return this.drawShape(new mo(t,i,n,s))},e.prototype.drawPolygon=function(){for(var t=arguments,i=[],n=0;n<arguments.length;n++)i[n]=t[n];var s,a=!0,o=i[0];o.points?(a=o.closeStroke,s=o.points):Array.isArray(i[0])?s=i[0]:s=i;var h=new yi(s);return h.closeStroke=a,this.drawShape(h),this},e.prototype.drawShape=function(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},e.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},e.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===bt.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},e.prototype._render=function(t){this.finishPoly();var i=this._geometry;i.updateBatches(),i.batchable?(this.batchDirty!==i.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},e.prototype._populateBatches=function(){var t=this._geometry,i=this.blendMode,n=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=n,this.vertexData=new Float32Array(t.points);for(var s=0;s<n;s++){var a=t.batches[s],o=a.style.color,h=new Float32Array(this.vertexData.buffer,a.attribStart*4*2,a.attribSize*2),u=new Float32Array(t.uvsFloat32.buffer,a.attribStart*4*2,a.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,a.start*2,a.size),f={vertexData:h,blendMode:i,indices:l,uvs:u,_batchRGB:Be(o),_tintRGB:o,_texture:a.style.texture,alpha:a.style.alpha,worldAlpha:1};this.batches[s]=f}},e.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var i=0,n=this.batches.length;i<n;i++){var s=this.batches[i];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}},e.prototype._renderDirect=function(t){var i=this._resolveDirectShader(t),n=this._geometry,s=this.tint,a=this.worldAlpha,o=i.uniforms,h=n.drawCalls;o.translationMatrix=this.transform.worldTransform,o.tint[0]=(s>>16&255)/255*a,o.tint[1]=(s>>8&255)/255*a,o.tint[2]=(s&255)/255*a,o.tint[3]=a,t.shader.bind(i),t.geometry.bind(n,i),t.state.set(this.state);for(var u=0,l=h.length;u<l;u++)this._renderDrawCallDirect(t,n.drawCalls[u])},e.prototype._renderDrawCallDirect=function(t,i){for(var n=i.texArray,s=i.type,a=i.size,o=i.start,h=n.count,u=0;u<h;u++)t.texture.bind(n.elements[u],u);t.geometry.draw(s,a,o)},e.prototype._resolveDirectShader=function(t){var i=this.shader,n=this.pluginName;if(!i){if(!vn[n]){for(var s=t.plugins[n].MAX_TEXTURES,a=new Int32Array(s),o=0;o<s;o++)a[o]=o;var h={tint:new Float32Array([1,1,1,1]),translationMatrix:new gt,default:we.from({uSamplers:a},!0)},u=t.plugins[n]._shader.program;vn[n]=new ae(u,h)}i=vn[n]}return i},e.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var i=t.bounds,n=i.minX,s=i.minY,a=i.maxX,o=i.maxY;this._bounds.addFrame(this.transform,n,s,a,o)}},e.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)},e.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=Be(this.tint,ap),i=0;i<this.batches.length;i++){var n=this.batches[i],s=n._batchRGB,a=t[0]*s[0]*255,o=t[1]*s[1]*255,h=t[2]*s[2]*255,u=(a<<16)+(o<<8)+(h|0);n._tintRGB=(u>>16)+(u&65280)+((u&255)<<16)}}},e.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var i=this.transform.worldTransform,n=i.a,s=i.b,a=i.c,o=i.d,h=i.tx,u=i.ty,l=this._geometry.points,f=this.vertexData,c=0,d=0;d<l.length;d+=2){var p=l[d],v=l[d+1];f[c++]=n*p+a*v+h,f[c++]=o*v+s*p+u}}},e.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this},e.prototype.setMatrix=function(t){return this._matrix=t,this},e.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},e.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},e.prototype.destroy=function(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,r.prototype.destroy.call(this,t)},e.nextRoundedRectBehavior=!1,e._TEMP_POINT=new X,e}(Pt);var _n=function(r,e){return _n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},_n(r,e)};function op(r,e){_n(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var li=new X,hp=new Uint16Array([0,1,2,0,2,3]),fi=function(r){op(e,r);function e(t){var i=r.call(this)||this;return i._anchor=new Oe(i._onAnchorUpdate,i,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),i._texture=null,i._width=0,i._height=0,i._tint=null,i._tintRGB=null,i.tint=16777215,i.blendMode=G.NORMAL,i._cachedTint=16777215,i.uvs=null,i.texture=t||k.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=hp,i.pluginName="batch",i.isSprite=!0,i._roundPixels=F.ROUND_PIXELS,i}return e.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Ue(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Ue(this.scale.y)*this._height/this._texture.orig.height)},e.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},e.prototype.calculateVertices=function(){var t=this._texture;if(!(this._transformID===this.transform._worldID&&this._textureID===t._updateID)){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var i=this.transform.worldTransform,n=i.a,s=i.b,a=i.c,o=i.d,h=i.tx,u=i.ty,l=this.vertexData,f=t.trim,c=t.orig,d=this._anchor,p=0,v=0,_=0,m=0;if(f?(v=f.x-d._x*c.width,p=v+f.width,m=f.y-d._y*c.height,_=m+f.height):(v=-d._x*c.width,p=v+c.width,m=-d._y*c.height,_=m+c.height),l[0]=n*v+a*m+h,l[1]=o*m+s*v+u,l[2]=n*p+a*m+h,l[3]=o*m+s*p+u,l[4]=n*p+a*_+h,l[5]=o*_+s*p+u,l[6]=n*v+a*_+h,l[7]=o*_+s*v+u,this._roundPixels)for(var g=F.RESOLUTION,y=0;y<l.length;++y)l[y]=Math.round((l[y]*g|0)/g)}},e.prototype.calculateTrimmedVertices=function(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,i=this.vertexTrimmedData,n=t.orig,s=this._anchor,a=this.transform.worldTransform,o=a.a,h=a.b,u=a.c,l=a.d,f=a.tx,c=a.ty,d=-s._x*n.width,p=d+n.width,v=-s._y*n.height,_=v+n.height;i[0]=o*d+u*v+f,i[1]=l*v+h*d+c,i[2]=o*p+u*v+f,i[3]=l*v+h*p+c,i[4]=o*p+u*_+f,i[5]=l*_+h*p+c,i[6]=o*d+u*_+f,i[7]=l*_+h*d+c},e.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)},e.prototype._calculateBounds=function(){var t=this._texture.trim,i=this._texture.orig;!t||t.width===i.width&&t.height===i.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},e.prototype.getLocalBounds=function(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Fi),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._localBounds.getRectangle(t)):r.prototype.getLocalBounds.call(this,t)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,li);var i=this._texture.orig.width,n=this._texture.orig.height,s=-i*this.anchor.x,a=0;return li.x>=s&&li.x<s+i&&(a=-n*this.anchor.y,li.y>=a&&li.y<a+n)},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null;var i=typeof t=="boolean"?t:t&&t.texture;if(i){var n=typeof t=="boolean"?t:t&&t.baseTexture;this._texture.destroy(!!n)}this._texture=null},e.from=function(t,i){var n=t instanceof k?t:k.from(t,i);return new e(n)},Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){var i=Ue(this.scale.x)||1;this.scale.x=i*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){var i=Ue(this.scale.y)||1;this.scale.y=i*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,this._tintRGB=(t>>16)+(t&65280)+((t&255)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||k.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(Pt);var mn=function(r,e){return mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},mn(r,e)};function up(r,e){mn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ci;(function(r){r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"})(ci||(ci={}));var gn={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ci.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},lp=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],le=function(){function r(e){this.styleID=0,this.reset(),xn(this,e,e)}return r.prototype.clone=function(){var e={};return xn(e,this,gn),new r(e)},r.prototype.reset=function(){xn(this,gn,gn)},Object.defineProperty(r.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"breakWords",{get:function(){return this._breakWords},set:function(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(e){var t=yn(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fill",{get:function(){return this._fill},set:function(e){var t=yn(e);this._fill!==t&&(this._fill=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(e){fp(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leading",{get:function(){return this._leading},set:function(e){this._leading!==e&&(this._leading=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"padding",{get:function(){return this._padding},set:function(e){this._padding!==e&&(this._padding=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stroke",{get:function(){return this._stroke},set:function(e){var t=yn(e);this._stroke!==t&&(this._stroke=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"trim",{get:function(){return this._trim},set:function(e){this._trim!==e&&(this._trim=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)},enumerable:!1,configurable:!0}),r.prototype.toFontString=function(){var e=typeof this.fontSize=="number"?this.fontSize+"px":this.fontSize,t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(","));for(var i=t.length-1;i>=0;i--){var n=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&lp.indexOf(n)<0&&(n='"'+n+'"'),t[i]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+e+" "+t.join(",")},r}();function Aa(r){return typeof r=="number"?_s(r):(typeof r=="string"&&r.indexOf("0x")===0&&(r=r.replace("0x","#")),r)}function yn(r){if(Array.isArray(r)){for(var e=0;e<r.length;++e)r[e]=Aa(r[e]);return r}else return Aa(r)}function fp(r,e){if(!Array.isArray(r)||!Array.isArray(e)||r.length!==e.length)return!1;for(var t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}function xn(r,e,t){for(var i in t)Array.isArray(e[i])?r[i]=e[i].slice():r[i]=e[i]}var er={willReadFrequently:!0},Xt=function(){function r(e,t,i,n,s,a,o,h,u){this.text=e,this.style=t,this.width=i,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=u}return r.measureText=function(e,t,i,n){n===void 0&&(n=r._canvas),i=i??t.wordWrap;var s=t.toFontString(),a=r.measureFont(s);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);var o=n.getContext("2d",er);o.font=s;for(var h=i?r.wordWrap(e,t,n):e,u=h.split(/(?:\r\n|\r|\n)/),l=new Array(u.length),f=0,c=0;c<u.length;c++){var d=o.measureText(u[c]).width+(u[c].length-1)*t.letterSpacing;l[c]=d,f=Math.max(f,d)}var p=f+t.strokeThickness;t.dropShadow&&(p+=t.dropShadowDistance);var v=t.lineHeight||a.fontSize+t.strokeThickness,_=Math.max(v,a.fontSize+t.strokeThickness)+(u.length-1)*(v+t.leading);return t.dropShadow&&(_+=t.dropShadowDistance),new r(e,t,p,_,u,l,v+t.leading,f,a)},r.wordWrap=function(e,t,i){i===void 0&&(i=r._canvas);for(var n=i.getContext("2d",er),s=0,a="",o="",h=Object.create(null),u=t.letterSpacing,l=t.whiteSpace,f=r.collapseSpaces(l),c=r.collapseNewlines(l),d=!f,p=t.wordWrapWidth+u,v=r.tokenize(e),_=0;_<v.length;_++){var m=v[_];if(r.isNewline(m)){if(!c){o+=r.addLine(a),d=!f,a="",s=0;continue}m=" "}if(f){var g=r.isBreakingSpace(m),y=r.isBreakingSpace(a[a.length-1]);if(g&&y)continue}var b=r.getFromCache(m,u,h,n);if(b>p)if(a!==""&&(o+=r.addLine(a),a="",s=0),r.canBreakWords(m,t.breakWords))for(var x=r.wordWrapSplit(m),T=0;T<x.length;T++){for(var w=x[T],A=1;x[T+A];){var S=x[T+A],E=w[w.length-1];if(!r.canBreakChars(E,S,m,T,t.breakWords))w+=S;else break;A++}T+=w.length-1;var D=r.getFromCache(w,u,h,n);D+s>p&&(o+=r.addLine(a),d=!1,a="",s=0),a+=w,s+=D}else{a.length>0&&(o+=r.addLine(a),a="",s=0);var C=_===v.length-1;o+=r.addLine(m,!C),d=!1,a="",s=0}else b+s>p&&(d=!1,o+=r.addLine(a),a="",s=0),(a.length>0||!r.isBreakingSpace(m)||d)&&(a+=m,s+=b)}return o+=r.addLine(a,!1),o},r.addLine=function(e,t){return t===void 0&&(t=!0),e=r.trimRight(e),e=t?e+`
525
+ `:e,e},r.getFromCache=function(e,t,i,n){var s=i[e];if(typeof s!="number"){var a=e.length*t;s=n.measureText(e).width+a,i[e]=s}return s},r.collapseSpaces=function(e){return e==="normal"||e==="pre-line"},r.collapseNewlines=function(e){return e==="normal"},r.trimRight=function(e){if(typeof e!="string")return"";for(var t=e.length-1;t>=0;t--){var i=e[t];if(!r.isBreakingSpace(i))break;e=e.slice(0,-1)}return e},r.isNewline=function(e){return typeof e!="string"?!1:r._newlines.indexOf(e.charCodeAt(0))>=0},r.isBreakingSpace=function(e,t){return typeof e!="string"?!1:r._breakingSpaces.indexOf(e.charCodeAt(0))>=0},r.tokenize=function(e){var t=[],i="";if(typeof e!="string")return t;for(var n=0;n<e.length;n++){var s=e[n],a=e[n+1];if(r.isBreakingSpace(s,a)||r.isNewline(s)){i!==""&&(t.push(i),i=""),t.push(s);continue}i+=s}return i!==""&&t.push(i),t},r.canBreakWords=function(e,t){return t},r.canBreakChars=function(e,t,i,n,s){return!0},r.wordWrapSplit=function(e){return e.split("")},r.measureFont=function(e){if(r._fonts[e])return r._fonts[e];var t={ascent:0,descent:0,fontSize:0},i=r._canvas,n=r._context;n.font=e;var s=r.METRICS_STRING+r.BASELINE_SYMBOL,a=Math.ceil(n.measureText(s).width),o=Math.ceil(n.measureText(r.BASELINE_SYMBOL).width),h=Math.ceil(r.HEIGHT_MULTIPLIER*o);o=o*r.BASELINE_MULTIPLIER|0,i.width=a,i.height=h,n.fillStyle="#f00",n.fillRect(0,0,a,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,o);var u=n.getImageData(0,0,a,h).data,l=u.length,f=a*4,c=0,d=0,p=!1;for(c=0;c<o;++c){for(var v=0;v<f;v+=4)if(u[d+v]!==255){p=!0;break}if(!p)d+=f;else break}for(t.ascent=o-c,d=l-f,p=!1,c=h;c>o;--c){for(var v=0;v<f;v+=4)if(u[d+v]!==255){p=!0;break}if(!p)d-=f;else break}return t.descent=c-o,t.fontSize=t.ascent+t.descent,r._fonts[e]=t,t},r.clearMetrics=function(e){e===void 0&&(e=""),e?delete r._fonts[e]:r._fonts={}},Object.defineProperty(r,"_canvas",{get:function(){if(!r.__canvas){var e=void 0;try{var t=new OffscreenCanvas(0,0),i=t.getContext("2d",er);if(i&&i.measureText)return r.__canvas=t,t;e=F.ADAPTER.createCanvas()}catch{e=F.ADAPTER.createCanvas()}e.width=e.height=10,r.__canvas=e}return r.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(r,"_context",{get:function(){return r.__context||(r.__context=r._canvas.getContext("2d",er)),r.__context},enumerable:!1,configurable:!0}),r}();Xt._fonts={},Xt.METRICS_STRING="|ÉqÅ",Xt.BASELINE_SYMBOL="M",Xt.BASELINE_MULTIPLIER=1.4,Xt.HEIGHT_MULTIPLIER=2,Xt._newlines=[10,13],Xt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var cp={texture:!0,children:!1,baseTexture:!0},Ia=function(r){up(e,r);function e(t,i,n){var s=this,a=!1;n||(n=F.ADAPTER.createCanvas(),a=!0),n.width=3,n.height=3;var o=k.from(n);return o.orig=new j,o.trim=new j,s=r.call(this,o)||this,s._ownCanvas=a,s.canvas=n,s.context=n.getContext("2d",{willReadFrequently:!0}),s._resolution=F.RESOLUTION,s._autoResolution=!0,s._text=null,s._style=null,s._styleListener=null,s._font="",s.text=t,s.style=i,s.localStyleID=-1,s}return e.prototype.updateText=function(t){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),!(!this.dirty&&t)){this._font=this._style.toFontString();var n=this.context,s=Xt.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=s.width,o=s.height,h=s.lines,u=s.lineHeight,l=s.lineWidths,f=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+i.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+i.padding*2)*this._resolution),n.scale(this._resolution,this._resolution),n.clearRect(0,0,this.canvas.width,this.canvas.height),n.font=this._font,n.lineWidth=i.strokeThickness,n.textBaseline=i.textBaseline,n.lineJoin=i.lineJoin,n.miterLimit=i.miterLimit;for(var d,p,v=i.dropShadow?2:1,_=0;_<v;++_){var m=i.dropShadow&&_===0,g=m?Math.ceil(Math.max(1,o)+i.padding*2):0,y=g*this._resolution;if(m){n.fillStyle="black",n.strokeStyle="black";var b=i.dropShadowColor,x=Be(typeof b=="number"?b:ms(b)),T=i.dropShadowBlur*this._resolution,w=i.dropShadowDistance*this._resolution;n.shadowColor="rgba("+x[0]*255+","+x[1]*255+","+x[2]*255+","+i.dropShadowAlpha+")",n.shadowBlur=T,n.shadowOffsetX=Math.cos(i.dropShadowAngle)*w,n.shadowOffsetY=Math.sin(i.dropShadowAngle)*w+y}else n.fillStyle=this._generateFillStyle(i,h,s),n.strokeStyle=i.stroke,n.shadowColor="black",n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0;var A=(u-c.fontSize)/2;(!e.nextLineHeightBehavior||u-c.fontSize<0)&&(A=0);for(var S=0;S<h.length;S++)d=i.strokeThickness/2,p=i.strokeThickness/2+S*u+c.ascent+A,i.align==="right"?d+=f-l[S]:i.align==="center"&&(d+=(f-l[S])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(h[S],d+i.padding,p+i.padding-g,!0),i.fill&&this.drawLetterSpacing(h[S],d+i.padding,p+i.padding-g)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,i,n,s){s===void 0&&(s=!1);var a=this._style,o=a.letterSpacing,h=e.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(o===0||h){h&&(this.context.letterSpacing=o,this.context.textLetterSpacing=o),s?this.context.strokeText(t,i,n):this.context.fillText(t,i,n);return}for(var u=i,l=Array.from?Array.from(t):t.split(""),f=this.context.measureText(t).width,c=0,d=0;d<l.length;++d){var p=l[d];s?this.context.strokeText(p,u,n):this.context.fillText(p,u,n);for(var v="",_=d+1;_<l.length;++_)v+=l[_];c=this.context.measureText(v).width,u+=f-c+o,f=c}},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var i=df(t);i.data&&(t.width=i.width,t.height=i.height,this.context.putImageData(i.data,0,0))}var n=this._texture,s=this._style,a=s.trim?0:s.padding,o=n.baseTexture;n.trim.width=n._frame.width=t.width/this._resolution,n.trim.height=n._frame.height=t.height/this._resolution,n.trim.x=-a,n.trim.y=-a,n.orig.width=n._frame.width-a*2,n.orig.height=n._frame.height-a*2,this._onTextureUpdate(),o.setRealSize(t.width,t.height,this._resolution),n.updateUvs(),this.dirty=!1},e.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),r.prototype._render.call(this,t)},e.prototype.updateTransform=function(){this.updateText(!0),r.prototype.updateTransform.call(this)},e.prototype.getBounds=function(t,i){return this.updateText(!0),this._textureID===-1&&(t=!1),r.prototype.getBounds.call(this,t,i)},e.prototype.getLocalBounds=function(t){return this.updateText(!0),r.prototype.getLocalBounds.call(this,t)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(t,i,n){var s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;var a,o=t.dropShadow?t.dropShadowDistance:0,h=t.padding||0,u=this.canvas.width/this._resolution-o-h*2,l=this.canvas.height/this._resolution-o-h*2,f=s.slice(),c=t.fillGradientStops.slice();if(!c.length)for(var d=f.length+1,p=1;p<d;++p)c.push(p/d);if(f.unshift(s[0]),c.unshift(0),f.push(s[s.length-1]),c.push(1),t.fillGradientType===ci.LINEAR_VERTICAL){a=this.context.createLinearGradient(u/2,h,u/2,l+h);for(var v=n.fontProperties.fontSize+t.strokeThickness,p=0;p<i.length;p++){var _=n.lineHeight*(p-1)+v,m=n.lineHeight*p,g=m;p>0&&_>m&&(g=(m+_)/2);var y=m+v,b=n.lineHeight*(p+1),x=y;p+1<i.length&&b<y&&(x=(y+b)/2);for(var T=(x-g)/l,w=0;w<f.length;w++){var A=0;typeof c[w]=="number"?A=c[w]:A=w/f.length;var S=Math.min(1,Math.max(0,g/l+A*T));S=Number(S.toFixed(5)),a.addColorStop(S,f[w])}}}else{a=this.context.createLinearGradient(h,l/2,u+h,l/2);for(var E=f.length+1,D=1,p=0;p<f.length;p++){var C=void 0;typeof c[p]=="number"?C=c[p]:C=D/E,a.addColorStop(C,f[p]),D++}}return a},e.prototype.destroy=function(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},cp,t),r.prototype.destroy.call(this,t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var i=Ue(this.scale.x)||1;this.scale.x=i*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var i=Ue(this.scale.y)||1;this.scale.y=i*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},t instanceof le?this._style=t:this._style=new le(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e.experimentalLetterSpacing=!1,e}(fi);F.UPLOADS_PER_FRAME=4;var bn=function(r,e){return bn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},bn(r,e)};function dp(r,e){bn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var pp=function(){function r(e){this.maxItemsPerFrame=e,this.itemsLeft=0}return r.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},r.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},r}();function vp(r,e){var t=!1;if(r&&r._textures&&r._textures.length){for(var i=0;i<r._textures.length;i++)if(r._textures[i]instanceof k){var n=r._textures[i].baseTexture;e.indexOf(n)===-1&&(e.push(n),t=!0)}}return t}function _p(r,e){if(r.baseTexture instanceof V){var t=r.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function mp(r,e){if(r._texture&&r._texture instanceof k){var t=r._texture.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function gp(r,e){return e instanceof Ia?(e.updateText(!0),!0):!1}function yp(r,e){if(e instanceof le){var t=e.toFontString();return Xt.measureFont(t),!0}return!1}function xp(r,e){if(r instanceof Ia){e.indexOf(r.style)===-1&&e.push(r.style),e.indexOf(r)===-1&&e.push(r);var t=r._texture.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function bp(r,e){return r instanceof le?(e.indexOf(r)===-1&&e.push(r),!0):!1}var Tp=function(){function r(e){var t=this;this.limiter=new pp(F.UPLOADS_PER_FRAME),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){t.queue&&t.prepareItems()},this.registerFindHook(xp),this.registerFindHook(bp),this.registerFindHook(vp),this.registerFindHook(_p),this.registerFindHook(mp),this.registerUploadHook(gp),this.registerUploadHook(yp)}return r.prototype.upload=function(e,t){var i=this;return typeof e=="function"&&(t=e,e=null),t&&Ut("6.5.0","BasePrepare.upload callback is deprecated, use the return Promise instead."),new Promise(function(n){e&&i.add(e);var s=function(){t==null||t(),n()};i.queue.length?(i.completes.push(s),i.ticking||(i.ticking=!0,Tt.system.addOnce(i.tick,i,$t.UTILITY))):s()})},r.prototype.tick=function(){setTimeout(this.delayedTick,0)},r.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var e=this.queue[0],t=!1;if(e&&!e._destroyed){for(var i=0,n=this.uploadHooks.length;i<n;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)Tt.system.addOnce(this.tick,this,$t.UTILITY);else{this.ticking=!1;var s=this.completes.slice(0);this.completes.length=0;for(var i=0,n=s.length;i<n;i++)s[i]()}},r.prototype.registerFindHook=function(e){return e&&this.addHooks.push(e),this},r.prototype.registerUploadHook=function(e){return e&&this.uploadHooks.push(e),this},r.prototype.add=function(e){for(var t=0,i=this.addHooks.length;t<i&&!this.addHooks[t](e,this.queue);t++);if(e instanceof Pt)for(var t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this},r.prototype.destroy=function(){this.ticking&&Tt.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},r}();function Oa(r,e){return e instanceof V?(e._glTextures[r.CONTEXT_UID]||r.texture.bind(e),!0):!1}function wp(r,e){if(!(e instanceof Ae))return!1;var t=e.geometry;e.finishPoly(),t.updateBatches();for(var i=t.batches,n=0;n<i.length;n++){var s=i[n].style.texture;s&&Oa(r,s.baseTexture)}return t.batchable||r.geometry.bind(t,e._resolveDirectShader(r)),!0}function Ep(r,e){return r instanceof Ae?(e.push(r),!0):!1}var Sp=function(r){dp(e,r);function e(t){var i=r.call(this,t)||this;return i.uploadHookHelper=i.renderer,i.registerFindHook(Ep),i.registerUploadHook(Oa),i.registerUploadHook(wp),i}return e.extension={name:"prepare",type:tt.RendererPlugin},e}(Tp);var Pp=function(){function r(e,t,i){i===void 0&&(i=null),this.linkedSheets=[],this._texture=e instanceof k?e:null,this.baseTexture=e instanceof V?e:this._texture.baseTexture,this.textures={},this.animations={},this.data=t;var n=this.baseTexture.resource;this.resolution=this._updateResolution(i||(n?n.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return r.prototype._updateResolution=function(e){e===void 0&&(e=null);var t=this.data.meta.scale,i=Di(e,null);return i===null&&(i=t!==void 0?parseFloat(t):1),i!==1&&this.baseTexture.setResolution(i),i},r.prototype.parse=function(e){var t=this;return e&&Ut("6.5.0","Spritesheet.parse callback is deprecated, use the return Promise instead."),new Promise(function(i){t._callback=function(n){e==null||e(n),i(n)},t._batchIndex=0,t._frameKeys.length<=r.BATCH_SIZE?(t._processFrames(0),t._processAnimations(),t._parseComplete()):t._nextBatch()})},r.prototype._processFrames=function(e){for(var t=e,i=r.BATCH_SIZE;t-e<i&&t<this._frameKeys.length;){var n=this._frameKeys[t],s=this._frames[n],a=s.frame;if(a){var o=null,h=null,u=s.trimmed!==!1&&s.sourceSize?s.sourceSize:s.frame,l=new j(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);s.rotated?o=new j(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new j(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),s.trimmed!==!1&&s.spriteSourceSize&&(h=new j(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new k(this.baseTexture,o,l,h,s.rotated?2:0,s.anchor),k.addToCache(this.textures[n],n)}t++}},r.prototype._processAnimations=function(){var e=this.data.animations||{};for(var t in e){this.animations[t]=[];for(var i=0;i<e[t].length;i++){var n=e[t][i];this.animations[t].push(this.textures[n])}}},r.prototype._parseComplete=function(){var e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)},r.prototype._nextBatch=function(){var e=this;this._processFrames(this._batchIndex*r.BATCH_SIZE),this._batchIndex++,setTimeout(function(){e._batchIndex*r.BATCH_SIZE<e._frameKeys.length?e._nextBatch():(e._processAnimations(),e._parseComplete())},0)},r.prototype.destroy=function(e){var t;e===void 0&&(e=!1);for(var i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((t=this._texture)===null||t===void 0||t.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]},r.BATCH_SIZE=1e3,r}(),Rp=function(){function r(){}return r.use=function(e,t){var i,n,s=this,a=e.name+"_image";if(!e.data||e.type!==ct.TYPE.JSON||!e.data.frames||s.resources[a]){t();return}var o=(n=(i=e.data)===null||i===void 0?void 0:i.meta)===null||n===void 0?void 0:n.related_multi_packs;if(Array.isArray(o))for(var h=function(p){if(typeof p!="string")return"continue";var v=p.replace(".json",""),_=Ne.resolve(e.url.replace(s.baseUrl,""),p);if(s.resources[v]||Object.values(s.resources).some(function(g){return Ne.format(Ne.parse(g.url))===_}))return"continue";var m={crossOrigin:e.crossOrigin,loadType:ct.LOAD_TYPE.XHR,xhrType:ct.XHR_RESPONSE_TYPE.JSON,parentResource:e,metadata:e.metadata};s.add(v,_,m)},u=0,l=o;u<l.length;u++){var f=l[u];h(f)}var c={crossOrigin:e.crossOrigin,metadata:e.metadata.imageMetadata,parentResource:e},d=r.getResourcePath(e,s.baseUrl);s.add(a,d,c,function(v){if(v.error){t(v.error);return}var _=new Pp(v.texture,e.data,e.url);_.parse().then(function(){e.spritesheet=_,e.textures=_.textures,t()})})},r.getResourcePath=function(e,t){return e.isDataUrl?e.data.meta.image:Ne.resolve(e.url.replace(t,""),e.data.meta.image)},r.extension=tt.Loader,r}();var Tn=function(r,e){return Tn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Tn(r,e)};function Ma(r,e){Tn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var di=new X;(function(r){Ma(e,r);function e(t,i,n){i===void 0&&(i=100),n===void 0&&(n=100);var s=r.call(this,t)||this;return s.tileTransform=new Wn,s._width=i,s._height=n,s.uvMatrix=s.texture.uvMatrix||new Vr(t),s.pluginName="tilingSprite",s.uvRespectAnchor=!1,s}return Object.defineProperty(e.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(t){this.tileTransform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(t){this.tileTransform.position.copyFrom(t)},enumerable:!1,configurable:!0}),e.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},e.prototype._render=function(t){var i=this._texture;!i||!i.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))},e.prototype._calculateBounds=function(){var t=this._width*-this._anchor._x,i=this._height*-this._anchor._y,n=this._width*(1-this._anchor._x),s=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,i,n,s)},e.prototype.getLocalBounds=function(t){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._bounds.getRectangle(t)):r.prototype.getLocalBounds.call(this,t)},e.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,di);var i=this._width,n=this._height,s=-i*this.anchor._x;if(di.x>=s&&di.x<s+i){var a=-n*this.anchor._y;if(di.y>=a&&di.y<a+n)return!0}return!1},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this.tileTransform=null,this.uvMatrix=null},e.from=function(t,i){var n=t instanceof k?t:k.from(t,i);return new e(n,i.width,i.height)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),e})(fi);var Cp=`#version 100
526
526
  #define SHADER_NAME Tiling-Sprite-Simple-100
527
527
 
528
528
  precision lowp float;
@@ -537,7 +537,7 @@ void main(void)
537
537
  vec4 texSample = texture2D(uSampler, vTextureCoord);
538
538
  gl_FragColor = texSample * uColor;
539
539
  }
540
- `,Ma=`#version 100
540
+ `,Da=`#version 100
541
541
  #define SHADER_NAME Tiling-Sprite-100
542
542
 
543
543
  precision lowp float;
@@ -557,7 +557,7 @@ void main(void)
557
557
 
558
558
  vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
559
559
  }
560
- `,Pp=`#version 100
560
+ `,Ap=`#version 100
561
561
  #ifdef GL_EXT_shader_texture_lod
562
562
  #extension GL_EXT_shader_texture_lod : enable
563
563
  #endif
@@ -590,7 +590,7 @@ void main(void)
590
590
 
591
591
  gl_FragColor = texSample * uColor;
592
592
  }
593
- `,Cp=`#version 300 es
593
+ `,Ip=`#version 300 es
594
594
  #define SHADER_NAME Tiling-Sprite-300
595
595
 
596
596
  precision lowp float;
@@ -610,7 +610,7 @@ void main(void)
610
610
 
611
611
  vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
612
612
  }
613
- `,Rp=`#version 300 es
613
+ `,Op=`#version 300 es
614
614
  #define SHADER_NAME Tiling-Sprite-100
615
615
 
616
616
  precision lowp float;
@@ -636,7 +636,7 @@ void main(void)
636
636
 
637
637
  fragmentColor = texSample * uColor;
638
638
  }
639
- `,tr=new gt,Ap=function(r){Oa(e,r);function e(t){var i=r.call(this,t)||this;return t.runners.contextChange.add(i),i.quad=new Bs,i.state=Te.for2d(),i}return e.prototype.contextChange=function(){var t=this.renderer,i={globals:t.globalUniforms};this.simpleShader=se.from(Ma,Sp,i),this.shader=t.context.webGLVersion>1?se.from(Cp,Rp,i):se.from(Ma,Pp,i)},e.prototype.render=function(t){var i=this.renderer,n=this.quad,s=n.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);var a=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=n.uvs,s[0]=s[6]=-a,s[1]=s[3]=-o,s[2]=s[4]=1-a,s[5]=s[7]=1-o,n.invalidate();var h=t._texture,u=h.baseTexture,l=u.alphaMode>0,f=t.tileTransform.localTransform,c=t.uvMatrix,d=u.isPowerOfTwo&&h.frame.width===u.width&&h.frame.height===u.height;d&&(u._glTextures[i.CONTEXT_UID]?d=u.wrapMode!==zt.CLAMP:u.wrapMode===zt.CLAMP&&(u.wrapMode=zt.REPEAT));var p=d?this.simpleShader:this.shader,v=h.width,_=h.height,m=t._width,y=t._height;tr.set(f.a*v/m,f.b*v/y,f.c*_/m,f.d*_/y,f.tx/m,f.ty/y),tr.invert(),d?tr.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=tr.toArray(!0),p.uniforms.uColor=ys(t.tint,t.worldAlpha,p.uniforms.uColor,l),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=h,i.shader.bind(p),i.geometry.bind(n),this.state.blendMode=gs(t.blendMode,l),i.state.set(this.state),i.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},e.extension={name:"tilingSprite",type:J.RendererPlugin},e}(Ni);var xn=function(r,e){return xn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},xn(r,e)};function bn(r,e){xn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ip=function(){function r(e,t){this.uvBuffer=e,this.uvMatrix=t,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return r.prototype.update=function(e){if(!(!e&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var t=this.uvBuffer.data;(!this.data||this.data.length!==t.length)&&(this.data=new Float32Array(t.length)),this.uvMatrix.multiplyUvs(t,this.data),this._updateID++}},r}(),Tn=new W,Da=new mi,ci=function(r){bn(e,r);function e(t,i,n,s){s===void 0&&(s=Ot.TRIANGLES);var a=r.call(this)||this;return a.geometry=t,a.shader=i,a.state=n||Te.for2d(),a.drawMode=s,a.start=0,a.size=0,a.uvs=null,a.indices=null,a.vertexData=new Float32Array(1),a.vertexDirty=-1,a._transformID=-1,a._roundPixels=F.ROUND_PIXELS,a.batchUvs=null,a}return Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},set:function(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){var i=this.geometry.buffers[0].data,n=this.shader;n.batchable&&this.drawMode===Ot.TRIANGLES&&i.length<e.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)},e.prototype._renderDefault=function(t){var i=this.shader;i.alpha=this.worldAlpha,i.update&&i.update(),t.batch.flush(),i.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(i),t.state.set(this.state),t.geometry.bind(this.geometry,i),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},e.prototype._renderToBatch=function(t){var i=this.geometry,n=this.shader;n.uvMatrix&&(n.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=i.indexBuffer.data,this._tintRGB=n._tintRGB,this._texture=n.texture;var s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)},e.prototype.calculateVertices=function(){var t=this.geometry,i=t.buffers[0],n=i.data,s=i._updateID;if(!(s===this.vertexDirty&&this._transformID===this.transform._worldID)){this._transformID=this.transform._worldID,this.vertexData.length!==n.length&&(this.vertexData=new Float32Array(n.length));for(var a=this.transform.worldTransform,o=a.a,h=a.b,u=a.c,l=a.d,f=a.tx,c=a.ty,d=this.vertexData,p=0;p<d.length/2;p++){var v=n[p*2],_=n[p*2+1];d[p*2]=o*v+u*_+f,d[p*2+1]=h*v+l*_+c}if(this._roundPixels)for(var m=F.RESOLUTION,p=0;p<d.length;++p)d[p]=Math.round((d[p]*m|0)/m);this.vertexDirty=s}},e.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],i=this.shader;i.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Ip(t,i.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},e.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Tn);for(var i=this.geometry.getBuffer("aVertexPosition").data,n=Da.points,s=this.geometry.getIndex().data,a=s.length,o=this.drawMode===4?3:1,h=0;h+2<a;h+=o){var u=s[h]*2,l=s[h+1]*2,f=s[h+2]*2;if(n[0]=i[u],n[1]=i[u+1],n[2]=i[l],n[3]=i[l+1],n[4]=i[f],n[5]=i[f+1],Da.contains(Tn.x,Tn.y))return!0}return!1},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},e.BATCHABLE_SIZE=100,e}(St),Op=`varying vec2 vTextureCoord;
639
+ `,ir=new gt,Mp=function(r){Ma(e,r);function e(t){var i=r.call(this,t)||this;return t.runners.contextChange.add(i),i.quad=new Ls,i.state=Ee.for2d(),i}return e.prototype.contextChange=function(){var t=this.renderer,i={globals:t.globalUniforms};this.simpleShader=ae.from(Da,Cp,i),this.shader=t.context.webGLVersion>1?ae.from(Ip,Op,i):ae.from(Da,Ap,i)},e.prototype.render=function(t){var i=this.renderer,n=this.quad,s=n.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);var a=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=n.uvs,s[0]=s[6]=-a,s[1]=s[3]=-o,s[2]=s[4]=1-a,s[5]=s[7]=1-o,n.invalidate();var h=t._texture,u=h.baseTexture,l=u.alphaMode>0,f=t.tileTransform.localTransform,c=t.uvMatrix,d=u.isPowerOfTwo&&h.frame.width===u.width&&h.frame.height===u.height;d&&(u._glTextures[i.CONTEXT_UID]?d=u.wrapMode!==zt.CLAMP:u.wrapMode===zt.CLAMP&&(u.wrapMode=zt.REPEAT));var p=d?this.simpleShader:this.shader,v=h.width,_=h.height,m=t._width,g=t._height;ir.set(f.a*v/m,f.b*v/g,f.c*_/m,f.d*_/g,f.tx/m,f.ty/g),ir.invert(),d?ir.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=ir.toArray(!0),p.uniforms.uColor=xs(t.tint,t.worldAlpha,p.uniforms.uColor,l),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=h,i.shader.bind(p),i.geometry.bind(n),this.state.blendMode=ys(t.blendMode,l),i.state.set(this.state),i.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},e.extension={name:"tilingSprite",type:tt.RendererPlugin},e}(Li);var wn=function(r,e){return wn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},wn(r,e)};function En(r,e){wn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Dp=function(){function r(e,t){this.uvBuffer=e,this.uvMatrix=t,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return r.prototype.update=function(e){if(!(!e&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var t=this.uvBuffer.data;(!this.data||this.data.length!==t.length)&&(this.data=new Float32Array(t.length)),this.uvMatrix.multiplyUvs(t,this.data),this._updateID++}},r}(),Sn=new X,Fa=new yi,pi=function(r){En(e,r);function e(t,i,n,s){s===void 0&&(s=Dt.TRIANGLES);var a=r.call(this)||this;return a.geometry=t,a.shader=i,a.state=n||Ee.for2d(),a.drawMode=s,a.start=0,a.size=0,a.uvs=null,a.indices=null,a.vertexData=new Float32Array(1),a.vertexDirty=-1,a._transformID=-1,a._roundPixels=F.ROUND_PIXELS,a.batchUvs=null,a}return Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},set:function(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){var i=this.geometry.buffers[0].data,n=this.shader;n.batchable&&this.drawMode===Dt.TRIANGLES&&i.length<e.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)},e.prototype._renderDefault=function(t){var i=this.shader;i.alpha=this.worldAlpha,i.update&&i.update(),t.batch.flush(),i.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(i),t.state.set(this.state),t.geometry.bind(this.geometry,i),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},e.prototype._renderToBatch=function(t){var i=this.geometry,n=this.shader;n.uvMatrix&&(n.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=i.indexBuffer.data,this._tintRGB=n._tintRGB,this._texture=n.texture;var s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)},e.prototype.calculateVertices=function(){var t=this.geometry,i=t.buffers[0],n=i.data,s=i._updateID;if(!(s===this.vertexDirty&&this._transformID===this.transform._worldID)){this._transformID=this.transform._worldID,this.vertexData.length!==n.length&&(this.vertexData=new Float32Array(n.length));for(var a=this.transform.worldTransform,o=a.a,h=a.b,u=a.c,l=a.d,f=a.tx,c=a.ty,d=this.vertexData,p=0;p<d.length/2;p++){var v=n[p*2],_=n[p*2+1];d[p*2]=o*v+u*_+f,d[p*2+1]=h*v+l*_+c}if(this._roundPixels)for(var m=F.RESOLUTION,p=0;p<d.length;++p)d[p]=Math.round((d[p]*m|0)/m);this.vertexDirty=s}},e.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],i=this.shader;i.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Dp(t,i.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},e.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Sn);for(var i=this.geometry.getBuffer("aVertexPosition").data,n=Fa.points,s=this.geometry.getIndex().data,a=s.length,o=this.drawMode===4?3:1,h=0;h+2<a;h+=o){var u=s[h]*2,l=s[h+1]*2,f=s[h+2]*2;if(n[0]=i[u],n[1]=i[u+1],n[2]=i[l],n[3]=i[l+1],n[4]=i[f],n[5]=i[f+1],Fa.contains(Sn.x,Sn.y))return!0}return!1},e.prototype.destroy=function(t){r.prototype.destroy.call(this,t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},e.BATCHABLE_SIZE=100,e}(Pt),Fp=`varying vec2 vTextureCoord;
640
640
  uniform vec4 uColor;
641
641
 
642
642
  uniform sampler2D uSampler;
@@ -645,7 +645,7 @@ void main(void)
645
645
  {
646
646
  gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
647
647
  }
648
- `,Mp=`attribute vec2 aVertexPosition;
648
+ `,Np=`attribute vec2 aVertexPosition;
649
649
  attribute vec2 aTextureCoord;
650
650
 
651
651
  uniform mat3 projectionMatrix;
@@ -660,7 +660,7 @@ void main(void)
660
660
 
661
661
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
662
662
  }
663
- `,di=function(r){bn(e,r);function e(t,i){var n=this,s={uSampler:t,alpha:1,uTextureMatrix:gt.IDENTITY,uColor:new Float32Array([1,1,1,1])};return i=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},i),i.uniforms&&Object.assign(s,i.uniforms),n=r.call(this,i.program||ri.from(Mp,Op),s)||this,n._colorDirty=!1,n.uvMatrix=new zr(t),n.batchable=i.program===void 0,n.pluginName=i.pluginName,n.tint=i.tint,n.alpha=i.alpha,n}return Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(t&65280)+((t&255)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;ys(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(se),er=function(r){bn(e,r);function e(t,i,n){var s=r.call(this)||this,a=new yt(t),o=new yt(i,!0),h=new yt(n,!0,!0);return s.addAttribute("aVertexPosition",a,2,!1,L.FLOAT).addAttribute("aTextureCoord",o,2,!1,L.FLOAT).addIndex(h),s._updateId=-1,s}return Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(ti);var wn=function(r,e){return wn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},wn(r,e)};function Dp(r,e){wn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ir=function(){function r(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}return r}(),Fp=function(){function r(){}return r.test=function(e){return typeof e=="string"&&e.indexOf("info face=")===0},r.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var n in t){var s=t[n].match(/^[a-z]+/gm)[0],a=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var h in a){var u=a[h].split("="),l=u[0],f=u[1].replace(/"/gm,""),c=parseFloat(f),d=isNaN(c)?f:c;o[l]=d}i[s].push(o)}var p=new ir;return i.info.forEach(function(v){return p.info.push({face:v.face,size:parseInt(v.size,10)})}),i.common.forEach(function(v){return p.common.push({lineHeight:parseInt(v.lineHeight,10)})}),i.page.forEach(function(v){return p.page.push({id:parseInt(v.id,10),file:v.file})}),i.char.forEach(function(v){return p.char.push({id:parseInt(v.id,10),page:parseInt(v.page,10),x:parseInt(v.x,10),y:parseInt(v.y,10),width:parseInt(v.width,10),height:parseInt(v.height,10),xoffset:parseInt(v.xoffset,10),yoffset:parseInt(v.yoffset,10),xadvance:parseInt(v.xadvance,10)})}),i.kerning.forEach(function(v){return p.kerning.push({first:parseInt(v.first,10),second:parseInt(v.second,10),amount:parseInt(v.amount,10)})}),i.distanceField.forEach(function(v){return p.distanceField.push({distanceRange:parseInt(v.distanceRange,10),fieldType:v.fieldType})}),p},r}(),En=function(){function r(){}return r.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},r.parse=function(e){for(var t=new ir,i=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),s=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),h=e.getElementsByTagName("distanceField"),u=0;u<i.length;u++)t.info.push({face:i[u].getAttribute("face"),size:parseInt(i[u].getAttribute("size"),10)});for(var u=0;u<n.length;u++)t.common.push({lineHeight:parseInt(n[u].getAttribute("lineHeight"),10)});for(var u=0;u<s.length;u++)t.page.push({id:parseInt(s[u].getAttribute("id"),10)||0,file:s[u].getAttribute("file")});for(var u=0;u<a.length;u++){var l=a[u];t.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(var u=0;u<o.length;u++)t.kerning.push({first:parseInt(o[u].getAttribute("first"),10),second:parseInt(o[u].getAttribute("second"),10),amount:parseInt(o[u].getAttribute("amount"),10)});for(var u=0;u<h.length;u++)t.distanceField.push({fieldType:h[u].getAttribute("fieldType"),distanceRange:parseInt(h[u].getAttribute("distanceRange"),10)});return t},r}(),Np=function(){function r(){}return r.test=function(e){if(typeof e=="string"&&e.indexOf("<font>")>-1){var t=new globalThis.DOMParser().parseFromString(e,"text/xml");return En.test(t)}return!1},r.parse=function(e){var t=new globalThis.DOMParser().parseFromString(e,"text/xml");return En.parse(t)},r}(),Sn=[Fp,En,Np];function Fa(r){for(var e=0;e<Sn.length;e++)if(Sn[e].test(r))return Sn[e];return null}function Bp(r,e,t,i,n,s){var a=t.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;var o,h=t.dropShadow?t.dropShadowDistance:0,u=t.padding||0,l=r.width/i-h-u*2,f=r.height/i-h-u*2,c=a.slice(),d=t.fillGradientStops.slice();if(!d.length)for(var p=c.length+1,v=1;v<p;++v)d.push(v/p);if(c.unshift(a[0]),d.unshift(0),c.push(a[a.length-1]),d.push(1),t.fillGradientType===li.LINEAR_VERTICAL){o=e.createLinearGradient(l/2,u,l/2,f+u);for(var _=0,m=s.fontProperties.fontSize+t.strokeThickness,y=m/f,v=0;v<n.length;v++)for(var g=s.lineHeight*v,b=0;b<c.length;b++){var x=0;typeof d[b]=="number"?x=d[b]:x=b/c.length;var T=g/f+x*y,w=Math.max(_,T);w=Math.min(w,1),o.addColorStop(w,c[b]),_=w}}else{o=e.createLinearGradient(u,f/2,l+u,f/2);for(var A=c.length+1,E=1,v=0;v<c.length;v++){var S=void 0;typeof d[v]=="number"?S=d[v]:S=E/A,o.addColorStop(S,c[v]),E++}}return o}function Lp(r,e,t,i,n,s,a){var o=t.text,h=t.fontProperties;e.translate(i,n),e.scale(s,s);var u=a.strokeThickness/2,l=-(a.strokeThickness/2);if(e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=Bp(r,e,a,s,[o],t),e.strokeStyle=a.stroke,a.dropShadow){var f=a.dropShadowColor,c=Fe(typeof f=="number"?f:_s(f)),d=a.dropShadowBlur*s,p=a.dropShadowDistance*s;e.shadowColor="rgba("+c[0]*255+","+c[1]*255+","+c[2]*255+","+a.dropShadowAlpha+")",e.shadowBlur=d,e.shadowOffsetX=Math.cos(a.dropShadowAngle)*p,e.shadowOffsetY=Math.sin(a.dropShadowAngle)*p}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;a.stroke&&a.strokeThickness&&e.strokeText(o,u,l+t.lineHeight-h.descent),a.fill&&e.fillText(o,u,l+t.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function Na(r){return Array.from?Array.from(r):r.split("")}function Up(r){typeof r=="string"&&(r=[r]);for(var e=[],t=0,i=r.length;t<i;t++){var n=r[t];if(Array.isArray(n)){if(n.length!==2)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+n.length+".");var s=n[0].charCodeAt(0),a=n[1].charCodeAt(0);if(a<s)throw new Error("[BitmapFont]: Invalid character range.");for(var o=s,h=a;o<=h;o++)e.push(String.fromCharCode(o))}else e.push.apply(e,Na(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}function rr(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}var Ht=function(){function r(e,t,i){var n,s,a=e.info[0],o=e.common[0],h=e.page[0],u=e.distanceField[0],l=Oi(h.file),f={};this._ownsTextures=i,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/l,this.chars={},this.pageTextures=f;for(var c=0;c<e.page.length;c++){var d=e.page[c],p=d.id,v=d.file;f[p]=t instanceof Array?t[c]:t[v],u!=null&&u.fieldType&&u.fieldType!=="none"&&(f[p].baseTexture.alphaMode=Dt.NO_PREMULTIPLIED_ALPHA,f[p].baseTexture.mipmap=Mt.OFF)}for(var c=0;c<e.char.length;c++){var _=e.char[c],p=_.id,m=_.page,y=e.char[c],g=y.x,b=y.y,x=y.width,T=y.height,w=y.xoffset,A=y.yoffset,E=y.xadvance;g/=l,b/=l,x/=l,T/=l,w/=l,A/=l,E/=l;var S=new z(g+f[m].frame.x/l,b+f[m].frame.y/l,x,T);this.chars[p]={xOffset:w,yOffset:A,xAdvance:E,kerning:{},texture:new k(f[m].baseTexture,S),page:m}}for(var c=0;c<e.kerning.length;c++){var D=e.kerning[c],C=D.first,N=D.second,H=D.amount;C/=l,N/=l,H/=l,this.chars[N]&&(this.chars[N].kerning[C]=H)}this.distanceFieldRange=u==null?void 0:u.distanceRange,this.distanceFieldType=(s=(n=u==null?void 0:u.fieldType)===null||n===void 0?void 0:n.toLowerCase())!==null&&s!==void 0?s:"none"}return r.prototype.destroy=function(){for(var e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(var e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null},r.install=function(e,t,i){var n;if(e instanceof ir)n=e;else{var s=Fa(e);if(!s)throw new Error("Unrecognized data format for font.");n=s.parse(e)}t instanceof k&&(t=[t]);var a=new r(n,t,i);return r.available[a.font]=a,a},r.uninstall=function(e){var t=r.available[e];if(!t)throw new Error("No font found named '"+e+"'");t.destroy(),delete r.available[e]},r.from=function(e,t,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");var n=Object.assign({},r.defaultOptions,i),s=n.chars,a=n.padding,o=n.resolution,h=n.textureWidth,u=n.textureHeight,l=Up(s),f=t instanceof Re?t:new Re(t),c=h,d=new ir;d.info[0]={face:f.fontFamily,size:f.fontSize},d.common[0]={lineHeight:f.fontSize};for(var p=0,v=0,_,m,y,g=0,b=[],x=0;x<l.length;x++){_||(_=F.ADAPTER.createCanvas(),_.width=h,_.height=u,m=_.getContext("2d"),y=new Y(_,{resolution:o}),b.push(new k(y)),d.page.push({id:b.length-1,file:""}));var T=l[x],w=kt.measureText(T,f,!1,_),A=w.width,E=Math.ceil(w.height),S=Math.ceil((f.fontStyle==="italic"?2:1)*A);if(v>=u-E*o){if(v===0)throw new Error("[BitmapFont] textureHeight "+u+"px is too small "+("(fontFamily: '"+f.fontFamily+"', fontSize: "+f.fontSize+"px, char: '"+T+"')"));--x,_=null,m=null,y=null,v=0,p=0,g=0;continue}if(g=Math.max(E+w.fontProperties.descent,g),S*o+p>=c){if(p===0)throw new Error("[BitmapFont] textureWidth "+h+"px is too small "+("(fontFamily: '"+f.fontFamily+"', fontSize: "+f.fontSize+"px, char: '"+T+"')"));--x,v+=g*o,v=Math.ceil(v),p=0,g=0;continue}Lp(_,m,w,p,v,o,f);var D=rr(w.text);d.char.push({id:D,page:b.length-1,x:p/o,y:v/o,width:S,height:E,xoffset:0,yoffset:0,xadvance:Math.ceil(A-(f.dropShadow?f.dropShadowDistance:0)-(f.stroke?f.strokeThickness:0))}),p+=(S+2*a)*o,p=Math.ceil(p)}for(var x=0,C=l.length;x<C;x++)for(var N=l[x],H=0;H<C;H++){var M=l[H],O=m.measureText(N).width,G=m.measureText(M).width,lt=m.measureText(N+M).width,j=lt-(O+G);j&&d.kerning.push({first:rr(N),second:rr(M),amount:j})}var I=new r(d,b,!0);return r.available[e]!==void 0&&r.uninstall(e),r.available[e]=I,I},r.ALPHA=[["a","z"],["A","Z"]," "],r.NUMERIC=[["0","9"]],r.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],r.ASCII=[[" ","~"]],r.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:r.ALPHANUMERIC},r.available={},r}(),Gp=`// Pixi texture info\r
663
+ `,vi=function(r){En(e,r);function e(t,i){var n=this,s={uSampler:t,alpha:1,uTextureMatrix:gt.IDENTITY,uColor:new Float32Array([1,1,1,1])};return i=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},i),i.uniforms&&Object.assign(s,i.uniforms),n=r.call(this,i.program||si.from(Np,Fp),s)||this,n._colorDirty=!1,n.uvMatrix=new Vr(t),n.batchable=i.program===void 0,n.pluginName=i.pluginName,n.tint=i.tint,n.alpha=i.alpha,n}return Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(t&65280)+((t&255)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;xs(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(ae),rr=function(r){En(e,r);function e(t,i,n){var s=r.call(this)||this,a=new yt(t),o=new yt(i,!0),h=new yt(n,!0,!0);return s.addAttribute("aVertexPosition",a,2,!1,L.FLOAT).addAttribute("aTextureCoord",o,2,!1,L.FLOAT).addIndex(h),s._updateId=-1,s}return Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(ii);var Pn=function(r,e){return Pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Pn(r,e)};function Bp(r,e){Pn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var nr=function(){function r(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}return r}(),Lp=function(){function r(){}return r.test=function(e){return typeof e=="string"&&e.indexOf("info face=")===0},r.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var n in t){var s=t[n].match(/^[a-z]+/gm)[0],a=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var h in a){var u=a[h].split("="),l=u[0],f=u[1].replace(/"/gm,""),c=parseFloat(f),d=isNaN(c)?f:c;o[l]=d}i[s].push(o)}var p=new nr;return i.info.forEach(function(v){return p.info.push({face:v.face,size:parseInt(v.size,10)})}),i.common.forEach(function(v){return p.common.push({lineHeight:parseInt(v.lineHeight,10)})}),i.page.forEach(function(v){return p.page.push({id:parseInt(v.id,10),file:v.file})}),i.char.forEach(function(v){return p.char.push({id:parseInt(v.id,10),page:parseInt(v.page,10),x:parseInt(v.x,10),y:parseInt(v.y,10),width:parseInt(v.width,10),height:parseInt(v.height,10),xoffset:parseInt(v.xoffset,10),yoffset:parseInt(v.yoffset,10),xadvance:parseInt(v.xadvance,10)})}),i.kerning.forEach(function(v){return p.kerning.push({first:parseInt(v.first,10),second:parseInt(v.second,10),amount:parseInt(v.amount,10)})}),i.distanceField.forEach(function(v){return p.distanceField.push({distanceRange:parseInt(v.distanceRange,10),fieldType:v.fieldType})}),p},r}(),Rn=function(){function r(){}return r.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null},r.parse=function(e){for(var t=new nr,i=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),s=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),h=e.getElementsByTagName("distanceField"),u=0;u<i.length;u++)t.info.push({face:i[u].getAttribute("face"),size:parseInt(i[u].getAttribute("size"),10)});for(var u=0;u<n.length;u++)t.common.push({lineHeight:parseInt(n[u].getAttribute("lineHeight"),10)});for(var u=0;u<s.length;u++)t.page.push({id:parseInt(s[u].getAttribute("id"),10)||0,file:s[u].getAttribute("file")});for(var u=0;u<a.length;u++){var l=a[u];t.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(var u=0;u<o.length;u++)t.kerning.push({first:parseInt(o[u].getAttribute("first"),10),second:parseInt(o[u].getAttribute("second"),10),amount:parseInt(o[u].getAttribute("amount"),10)});for(var u=0;u<h.length;u++)t.distanceField.push({fieldType:h[u].getAttribute("fieldType"),distanceRange:parseInt(h[u].getAttribute("distanceRange"),10)});return t},r}(),Up=function(){function r(){}return r.test=function(e){if(typeof e=="string"&&e.indexOf("<font>")>-1){var t=new globalThis.DOMParser().parseFromString(e,"text/xml");return Rn.test(t)}return!1},r.parse=function(e){var t=new globalThis.DOMParser().parseFromString(e,"text/xml");return Rn.parse(t)},r}(),Cn=[Lp,Rn,Up];function Na(r){for(var e=0;e<Cn.length;e++)if(Cn[e].test(r))return Cn[e];return null}function Gp(r,e,t,i,n,s){var a=t.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;var o,h=t.dropShadow?t.dropShadowDistance:0,u=t.padding||0,l=r.width/i-h-u*2,f=r.height/i-h-u*2,c=a.slice(),d=t.fillGradientStops.slice();if(!d.length)for(var p=c.length+1,v=1;v<p;++v)d.push(v/p);if(c.unshift(a[0]),d.unshift(0),c.push(a[a.length-1]),d.push(1),t.fillGradientType===ci.LINEAR_VERTICAL){o=e.createLinearGradient(l/2,u,l/2,f+u);for(var _=0,m=s.fontProperties.fontSize+t.strokeThickness,g=m/f,v=0;v<n.length;v++)for(var y=s.lineHeight*v,b=0;b<c.length;b++){var x=0;typeof d[b]=="number"?x=d[b]:x=b/c.length;var T=y/f+x*g,w=Math.max(_,T);w=Math.min(w,1),o.addColorStop(w,c[b]),_=w}}else{o=e.createLinearGradient(u,f/2,l+u,f/2);for(var A=c.length+1,S=1,v=0;v<c.length;v++){var E=void 0;typeof d[v]=="number"?E=d[v]:E=S/A,o.addColorStop(E,c[v]),S++}}return o}function kp(r,e,t,i,n,s,a){var o=t.text,h=t.fontProperties;e.translate(i,n),e.scale(s,s);var u=a.strokeThickness/2,l=-(a.strokeThickness/2);if(e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=Gp(r,e,a,s,[o],t),e.strokeStyle=a.stroke,a.dropShadow){var f=a.dropShadowColor,c=Be(typeof f=="number"?f:ms(f)),d=a.dropShadowBlur*s,p=a.dropShadowDistance*s;e.shadowColor="rgba("+c[0]*255+","+c[1]*255+","+c[2]*255+","+a.dropShadowAlpha+")",e.shadowBlur=d,e.shadowOffsetX=Math.cos(a.dropShadowAngle)*p,e.shadowOffsetY=Math.sin(a.dropShadowAngle)*p}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;a.stroke&&a.strokeThickness&&e.strokeText(o,u,l+t.lineHeight-h.descent),a.fill&&e.fillText(o,u,l+t.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function Ba(r){return Array.from?Array.from(r):r.split("")}function Hp(r){typeof r=="string"&&(r=[r]);for(var e=[],t=0,i=r.length;t<i;t++){var n=r[t];if(Array.isArray(n)){if(n.length!==2)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+n.length+".");var s=n[0].charCodeAt(0),a=n[1].charCodeAt(0);if(a<s)throw new Error("[BitmapFont]: Invalid character range.");for(var o=s,h=a;o<=h;o++)e.push(String.fromCharCode(o))}else e.push.apply(e,Ba(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}function sr(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}var Mt=function(){function r(e,t,i){var n,s,a=e.info[0],o=e.common[0],h=e.page[0],u=e.distanceField[0],l=Di(h.file),f={};this._ownsTextures=i,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/l,this.chars={},this.pageTextures=f;for(var c=0;c<e.page.length;c++){var d=e.page[c],p=d.id,v=d.file;f[p]=t instanceof Array?t[c]:t[v],u!=null&&u.fieldType&&u.fieldType!=="none"&&(f[p].baseTexture.alphaMode=Nt.NO_PREMULTIPLIED_ALPHA,f[p].baseTexture.mipmap=Ft.OFF)}for(var c=0;c<e.char.length;c++){var _=e.char[c],p=_.id,m=_.page,g=e.char[c],y=g.x,b=g.y,x=g.width,T=g.height,w=g.xoffset,A=g.yoffset,S=g.xadvance;y/=l,b/=l,x/=l,T/=l,w/=l,A/=l,S/=l;var E=new j(y+f[m].frame.x/l,b+f[m].frame.y/l,x,T);this.chars[p]={xOffset:w,yOffset:A,xAdvance:S,kerning:{},texture:new k(f[m].baseTexture,E),page:m}}for(var c=0;c<e.kerning.length;c++){var D=e.kerning[c],C=D.first,N=D.second,W=D.amount;C/=l,N/=l,W/=l,this.chars[N]&&(this.chars[N].kerning[C]=W)}this.distanceFieldRange=u==null?void 0:u.distanceRange,this.distanceFieldType=(s=(n=u==null?void 0:u.fieldType)===null||n===void 0?void 0:n.toLowerCase())!==null&&s!==void 0?s:"none"}return r.prototype.destroy=function(){for(var e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(var e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null},r.install=function(e,t,i){var n;if(e instanceof nr)n=e;else{var s=Na(e);if(!s)throw new Error("Unrecognized data format for font.");n=s.parse(e)}t instanceof k&&(t=[t]);var a=new r(n,t,i);return r.available[a.font]=a,a},r.uninstall=function(e){var t=r.available[e];if(!t)throw new Error("No font found named '"+e+"'");t.destroy(),delete r.available[e]},r.from=function(e,t,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");var n=Object.assign({},r.defaultOptions,i),s=n.chars,a=n.padding,o=n.resolution,h=n.textureWidth,u=n.textureHeight,l=Hp(s),f=t instanceof le?t:new le(t),c=h,d=new nr;d.info[0]={face:f.fontFamily,size:f.fontSize},d.common[0]={lineHeight:f.fontSize};for(var p=0,v=0,_,m,g,y=0,b=[],x=0;x<l.length;x++){_||(_=F.ADAPTER.createCanvas(),_.width=h,_.height=u,m=_.getContext("2d"),g=new V(_,{resolution:o}),b.push(new k(g)),d.page.push({id:b.length-1,file:""}));var T=l[x],w=Xt.measureText(T,f,!1,_),A=w.width,S=Math.ceil(w.height),E=Math.ceil((f.fontStyle==="italic"?2:1)*A);if(v>=u-S*o){if(v===0)throw new Error("[BitmapFont] textureHeight "+u+"px is too small "+("(fontFamily: '"+f.fontFamily+"', fontSize: "+f.fontSize+"px, char: '"+T+"')"));--x,_=null,m=null,g=null,v=0,p=0,y=0;continue}if(y=Math.max(S+w.fontProperties.descent,y),E*o+p>=c){if(p===0)throw new Error("[BitmapFont] textureWidth "+h+"px is too small "+("(fontFamily: '"+f.fontFamily+"', fontSize: "+f.fontSize+"px, char: '"+T+"')"));--x,v+=y*o,v=Math.ceil(v),p=0,y=0;continue}kp(_,m,w,p,v,o,f);var D=sr(w.text);d.char.push({id:D,page:b.length-1,x:p/o,y:v/o,width:E,height:S,xoffset:0,yoffset:0,xadvance:Math.ceil(A-(f.dropShadow?f.dropShadowDistance:0)-(f.stroke?f.strokeThickness:0))}),p+=(E+2*a)*o,p=Math.ceil(p)}for(var x=0,C=l.length;x<C;x++)for(var N=l[x],W=0;W<C;W++){var M=l[W],O=m.measureText(N).width,U=m.measureText(M).width,rt=m.measureText(N+M).width,z=rt-(O+U);z&&d.kerning.push({first:sr(N),second:sr(M),amount:z})}var I=new r(d,b,!0);return r.available[e]!==void 0&&r.uninstall(e),r.available[e]=I,I},r.ALPHA=[["a","z"],["A","Z"]," "],r.NUMERIC=[["0","9"]],r.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],r.ASCII=[[" ","~"]],r.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:r.ALPHANUMERIC},r.available={},r}(),Xp=`// Pixi texture info\r
664
664
  varying vec2 vTextureCoord;\r
665
665
  uniform sampler2D uSampler;\r
666
666
  \r
@@ -694,7 +694,7 @@ void main(void) {\r
694
694
  gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r
695
695
  \r
696
696
  }\r
697
- `,kp=`// Mesh material default fragment\r
697
+ `,Wp=`// Mesh material default fragment\r
698
698
  attribute vec2 aVertexPosition;\r
699
699
  attribute vec2 aTextureCoord;\r
700
700
  \r
@@ -710,10 +710,10 @@ void main(void)\r
710
710
  \r
711
711
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
712
712
  }\r
713
- `,Ba=[],La=[],Ua=[],Pn=function(r){Dp(e,r);function e(t,i){i===void 0&&(i={});var n=r.call(this)||this;n._tint=16777215;var s=Object.assign({},e.styleDefaults,i),a=s.align,o=s.tint,h=s.maxWidth,u=s.letterSpacing,l=s.fontName,f=s.fontSize;if(!Ht.available[l])throw new Error('Missing BitmapFont "'+l+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=a,n._tint=o,n._font=void 0,n._fontName=l,n._fontSize=f,n.text=t,n._maxWidth=h,n._maxLineHeight=0,n._letterSpacing=u,n._anchor=new Ae(function(){n.dirty=!0},n,0,0),n._roundPixels=F.ROUND_PIXELS,n.dirty=!0,n._resolution=F.RESOLUTION,n._autoResolution=!0,n._textureCache={},n}return e.prototype.updateText=function(){for(var t,i=Ht.available[this._fontName],n=this.fontSize,s=n/i.size,a=new W,o=[],h=[],u=[],l=this._text.replace(/(?:\r\n|\r)/g,`
714
- `)||" ",f=Na(l),c=this._maxWidth*i.size/n,d=i.distanceFieldType==="none"?Ba:La,p=null,v=0,_=0,m=0,y=-1,g=0,b=0,x=0,T=0,w=0;w<f.length;w++){var A=f[w],E=rr(A);if(/(?:\s)/.test(A)&&(y=w,g=v,T++),A==="\r"||A===`
715
- `){h.push(v),u.push(-1),_=Math.max(_,v),++m,++b,a.x=0,a.y+=i.lineHeight,p=null,T=0;continue}var S=i.chars[E];if(S){p&&S.kerning[p]&&(a.x+=S.kerning[p]);var D=Ua.pop()||{texture:k.EMPTY,line:0,charCode:0,prevSpaces:0,position:new W};D.texture=S.texture,D.line=m,D.charCode=E,D.position.x=a.x+S.xOffset+this._letterSpacing/2,D.position.y=a.y+S.yOffset,D.prevSpaces=T,o.push(D),v=D.position.x+Math.max(S.xAdvance-S.xOffset,S.texture.orig.width),a.x+=S.xAdvance+this._letterSpacing,x=Math.max(x,S.yOffset+S.texture.height),p=E,y!==-1&&c>0&&a.x>c&&(++b,Ne(o,1+y-b,1+w-y),w=y,y=-1,h.push(g),u.push(o.length>0?o[o.length-1].prevSpaces:0),_=Math.max(_,g),m++,a.x=0,a.y+=i.lineHeight,p=null,T=0)}}var C=f[f.length-1];C!=="\r"&&C!==`
716
- `&&(/(?:\s)/.test(C)&&(v=g),h.push(v),_=Math.max(_,v),u.push(-1));for(var N=[],w=0;w<=m;w++){var H=0;this._align==="right"?H=_-h[w]:this._align==="center"?H=(_-h[w])/2:this._align==="justify"&&(H=u[w]<0?0:(_-h[w])/u[w]),N.push(H)}var M=o.length,O={},G=[],lt=this._activePagesMeshData;d.push.apply(d,lt);for(var w=0;w<M;w++){var j=o[w].texture,I=j.baseTexture.uid;if(!O[I]){var P=d.pop();if(!P){var B=new er,$=void 0,Z=void 0;i.distanceFieldType==="none"?($=new di(k.EMPTY),Z=U.NORMAL):($=new di(k.EMPTY,{program:ri.from(kp,Gp),uniforms:{uFWidth:0}}),Z=U.NORMAL_NPM);var vt=new ci(B,$);vt.blendMode=Z,P={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:vt,vertices:null,uvs:null,indices:null}}P.index=0,P.indexCount=0,P.vertexCount=0,P.uvsCount=0,P.total=0;var st=this._textureCache;st[I]=st[I]||new k(j.baseTexture),P.mesh.texture=st[I],P.mesh.tint=this._tint,G.push(P),O[I]=P}O[I].total++}for(var w=0;w<lt.length;w++)G.indexOf(lt[w])===-1&&this.removeChild(lt[w].mesh);for(var w=0;w<G.length;w++)G[w].mesh.parent!==this&&this.addChild(G[w].mesh);this._activePagesMeshData=G;for(var w in O){var P=O[w],at=P.total;if(!(((t=P.indices)===null||t===void 0?void 0:t.length)>6*at)||P.vertices.length<ci.BATCHABLE_SIZE*2)P.vertices=new Float32Array(4*2*at),P.uvs=new Float32Array(4*2*at),P.indices=new Uint16Array(6*at);else for(var Tt=P.total,Et=P.vertices,_t=Tt*4*2;_t<Et.length;_t++)Et[_t]=0;P.mesh.size=6*at}for(var w=0;w<M;w++){var A=o[w],tt=A.position.x+N[A.line]*(this._align==="justify"?A.prevSpaces:1);this._roundPixels&&(tt=Math.round(tt));var nt=tt*s,ot=A.position.y*s,j=A.texture,V=O[j.baseTexture.uid],Pt=j.frame,Ct=j._uvs,K=V.index++;V.indices[K*6+0]=0+K*4,V.indices[K*6+1]=1+K*4,V.indices[K*6+2]=2+K*4,V.indices[K*6+3]=0+K*4,V.indices[K*6+4]=2+K*4,V.indices[K*6+5]=3+K*4,V.vertices[K*8+0]=nt,V.vertices[K*8+1]=ot,V.vertices[K*8+2]=nt+Pt.width*s,V.vertices[K*8+3]=ot,V.vertices[K*8+4]=nt+Pt.width*s,V.vertices[K*8+5]=ot+Pt.height*s,V.vertices[K*8+6]=nt,V.vertices[K*8+7]=ot+Pt.height*s,V.uvs[K*8+0]=Ct.x0,V.uvs[K*8+1]=Ct.y0,V.uvs[K*8+2]=Ct.x1,V.uvs[K*8+3]=Ct.y1,V.uvs[K*8+4]=Ct.x2,V.uvs[K*8+5]=Ct.y2,V.uvs[K*8+6]=Ct.x3,V.uvs[K*8+7]=Ct.y3}this._textWidth=_*s,this._textHeight=(a.y+i.lineHeight)*s;for(var w in O){var P=O[w];if(this.anchor.x!==0||this.anchor.y!==0)for(var $t=0,Xe=this._textWidth*this.anchor.x,ur=this._textHeight*this.anchor.y,oo=0;oo<P.total;oo++)P.vertices[$t++]-=Xe,P.vertices[$t++]-=ur,P.vertices[$t++]-=Xe,P.vertices[$t++]-=ur,P.vertices[$t++]-=Xe,P.vertices[$t++]-=ur,P.vertices[$t++]-=Xe,P.vertices[$t++]-=ur;this._maxLineHeight=x*s;var ho=P.mesh.geometry.getBuffer("aVertexPosition"),uo=P.mesh.geometry.getBuffer("aTextureCoord"),lo=P.mesh.geometry.getIndex();ho.data=P.vertices,uo.data=P.uvs,lo.data=P.indices,ho.update(),uo.update(),lo.update()}for(var w=0;w<o.length;w++)Ua.push(o[w]);this._font=i,this.dirty=!1},e.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},e.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);var i=Ht.available[this._fontName],n=i.distanceFieldRange,s=i.distanceFieldType,a=i.size;if(s!=="none")for(var o=this.worldTransform,h=o.a,u=o.b,l=o.c,f=o.d,c=Math.sqrt(h*h+u*u),d=Math.sqrt(l*l+f*f),p=(Math.abs(c)+Math.abs(d))/2,v=this.fontSize/a,_=0,m=this._activePagesMeshData;_<m.length;_++){var y=m[_];y.mesh.shader.uniforms.uFWidth=p*n*v*this._resolution}r.prototype._render.call(this,t)},e.prototype.getLocalBounds=function(){return this.validate(),r.prototype.getLocalBounds.call(this)},e.prototype.validate=function(){var t=Ht.available[this._fontName];if(!t)throw new Error('Missing BitmapFont "'+this._fontName+'"');this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()},Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){if(this._tint!==t){this._tint=t;for(var i=0;i<this._activePagesMeshData.length;i++)this._activePagesMeshData[i].mesh.tint=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontName",{get:function(){return this._fontName},set:function(t){if(!Ht.available[t])throw new Error('Missing BitmapFont "'+t+'"');this._fontName!==t&&(this._fontName=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){var t;return(t=this._fontSize)!==null&&t!==void 0?t:Ht.available[this._fontName].size},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.prototype.destroy=function(t){var i=this._textureCache,n=Ht.available[this._fontName],s=n.distanceFieldType==="none"?Ba:La;s.push.apply(s,this._activePagesMeshData);for(var a=0,o=this._activePagesMeshData;a<o.length;a++){var h=o[a];this.removeChild(h.mesh)}this._activePagesMeshData=[],s.filter(function(f){return i[f.mesh.texture.baseTexture.uid]}).forEach(function(f){f.mesh.texture=k.EMPTY});for(var u in i){var l=i[u];l.destroy(),delete i[u]}this._font=null,this._textureCache=null,r.prototype.destroy.call(this,t)},e.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},e}(St),Hp=function(){function r(){}return r.add=function(){dt.setExtensionXhrType("fnt",dt.XHR_RESPONSE_TYPE.TEXT)},r.use=function(e,t){var i=Fa(e.data);if(!i){t();return}for(var n=r.getBaseUrl(this,e),s=i.parse(e.data),a={},o=function(v){a[v.metadata.pageFile]=v.texture,Object.keys(a).length===s.page.length&&(e.bitmapFont=Ht.install(s,a,!0),t())},h=0;h<s.page.length;++h){var u=s.page[h].file,l=n+u,f=!1;for(var c in this.resources){var d=this.resources[c];if(d.url===l){d.metadata.pageFile=u,d.texture?o(d):d.onAfterMiddleware.add(o),f=!0;break}}if(!f){var p={crossOrigin:e.crossOrigin,loadType:dt.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},e.metadata.imageMetadata),parentResource:e};this.add(l,p,o)}}},r.getBaseUrl=function(e,t){var i=t.isDataUrl?"":r.dirname(t.url);return t.isDataUrl&&(i==="."&&(i=""),e.baseUrl&&i&&e.baseUrl.charAt(e.baseUrl.length-1)==="/"&&(i+="/")),i=i.replace(e.baseUrl,""),i&&i.charAt(i.length-1)!=="/"&&(i+="/"),i},r.dirname=function(e){var t=e.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return t===e?".":t===""?"/":t},r.extension=J.Loader,r}();var Cn=function(r,e){return Cn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Cn(r,e)};function Xp(r,e){Cn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Wp=`varying vec2 vTextureCoord;
713
+ `,La=[],Ua=[],Ga=[],An=function(r){Bp(e,r);function e(t,i){i===void 0&&(i={});var n=r.call(this)||this;n._tint=16777215;var s=Object.assign({},e.styleDefaults,i),a=s.align,o=s.tint,h=s.maxWidth,u=s.letterSpacing,l=s.fontName,f=s.fontSize;if(!Mt.available[l])throw new Error('Missing BitmapFont "'+l+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=a,n._tint=o,n._font=void 0,n._fontName=l,n._fontSize=f,n.text=t,n._maxWidth=h,n._maxLineHeight=0,n._letterSpacing=u,n._anchor=new Oe(function(){n.dirty=!0},n,0,0),n._roundPixels=F.ROUND_PIXELS,n.dirty=!0,n._resolution=F.RESOLUTION,n._autoResolution=!0,n._textureCache={},n}return e.prototype.updateText=function(){for(var t,i=Mt.available[this._fontName],n=this.fontSize,s=n/i.size,a=new X,o=[],h=[],u=[],l=this._text.replace(/(?:\r\n|\r)/g,`
714
+ `)||" ",f=Ba(l),c=this._maxWidth*i.size/n,d=i.distanceFieldType==="none"?La:Ua,p=null,v=0,_=0,m=0,g=-1,y=0,b=0,x=0,T=0,w=0;w<f.length;w++){var A=f[w],S=sr(A);if(/(?:\s)/.test(A)&&(g=w,y=v,T++),A==="\r"||A===`
715
+ `){h.push(v),u.push(-1),_=Math.max(_,v),++m,++b,a.x=0,a.y+=i.lineHeight,p=null,T=0;continue}var E=i.chars[S];if(E){p&&E.kerning[p]&&(a.x+=E.kerning[p]);var D=Ga.pop()||{texture:k.EMPTY,line:0,charCode:0,prevSpaces:0,position:new X};D.texture=E.texture,D.line=m,D.charCode=S,D.position.x=a.x+E.xOffset+this._letterSpacing/2,D.position.y=a.y+E.yOffset,D.prevSpaces=T,o.push(D),v=D.position.x+Math.max(E.xAdvance-E.xOffset,E.texture.orig.width),a.x+=E.xAdvance+this._letterSpacing,x=Math.max(x,E.yOffset+E.texture.height),p=S,g!==-1&&c>0&&a.x>c&&(++b,Le(o,1+g-b,1+w-g),w=g,g=-1,h.push(y),u.push(o.length>0?o[o.length-1].prevSpaces:0),_=Math.max(_,y),m++,a.x=0,a.y+=i.lineHeight,p=null,T=0)}}var C=f[f.length-1];C!=="\r"&&C!==`
716
+ `&&(/(?:\s)/.test(C)&&(v=y),h.push(v),_=Math.max(_,v),u.push(-1));for(var N=[],w=0;w<=m;w++){var W=0;this._align==="right"?W=_-h[w]:this._align==="center"?W=(_-h[w])/2:this._align==="justify"&&(W=u[w]<0?0:(_-h[w])/u[w]),N.push(W)}var M=o.length,O={},U=[],rt=this._activePagesMeshData;d.push.apply(d,rt);for(var w=0;w<M;w++){var z=o[w].texture,I=z.baseTexture.uid;if(!O[I]){var P=d.pop();if(!P){var B=new rr,$=void 0,Z=void 0;i.distanceFieldType==="none"?($=new vi(k.EMPTY),Z=G.NORMAL):($=new vi(k.EMPTY,{program:si.from(Wp,Xp),uniforms:{uFWidth:0}}),Z=G.NORMAL_NPM);var vt=new pi(B,$);vt.blendMode=Z,P={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:vt,vertices:null,uvs:null,indices:null}}P.index=0,P.indexCount=0,P.vertexCount=0,P.uvsCount=0,P.total=0;var st=this._textureCache;st[I]=st[I]||new k(z.baseTexture),P.mesh.texture=st[I],P.mesh.tint=this._tint,U.push(P),O[I]=P}O[I].total++}for(var w=0;w<rt.length;w++)U.indexOf(rt[w])===-1&&this.removeChild(rt[w].mesh);for(var w=0;w<U.length;w++)U[w].mesh.parent!==this&&this.addChild(U[w].mesh);this._activePagesMeshData=U;for(var w in O){var P=O[w],at=P.total;if(!(((t=P.indices)===null||t===void 0?void 0:t.length)>6*at)||P.vertices.length<pi.BATCHABLE_SIZE*2)P.vertices=new Float32Array(4*2*at),P.uvs=new Float32Array(4*2*at),P.indices=new Uint16Array(6*at);else for(var wt=P.total,St=P.vertices,_t=wt*4*2;_t<St.length;_t++)St[_t]=0;P.mesh.size=6*at}for(var w=0;w<M;w++){var A=o[w],et=A.position.x+N[A.line]*(this._align==="justify"?A.prevSpaces:1);this._roundPixels&&(et=Math.round(et));var nt=et*s,ot=A.position.y*s,z=A.texture,q=O[z.baseTexture.uid],Rt=z.frame,Ct=z._uvs,Q=q.index++;q.indices[Q*6+0]=0+Q*4,q.indices[Q*6+1]=1+Q*4,q.indices[Q*6+2]=2+Q*4,q.indices[Q*6+3]=0+Q*4,q.indices[Q*6+4]=2+Q*4,q.indices[Q*6+5]=3+Q*4,q.vertices[Q*8+0]=nt,q.vertices[Q*8+1]=ot,q.vertices[Q*8+2]=nt+Rt.width*s,q.vertices[Q*8+3]=ot,q.vertices[Q*8+4]=nt+Rt.width*s,q.vertices[Q*8+5]=ot+Rt.height*s,q.vertices[Q*8+6]=nt,q.vertices[Q*8+7]=ot+Rt.height*s,q.uvs[Q*8+0]=Ct.x0,q.uvs[Q*8+1]=Ct.y0,q.uvs[Q*8+2]=Ct.x1,q.uvs[Q*8+3]=Ct.y1,q.uvs[Q*8+4]=Ct.x2,q.uvs[Q*8+5]=Ct.y2,q.uvs[Q*8+6]=Ct.x3,q.uvs[Q*8+7]=Ct.y3}this._textWidth=_*s,this._textHeight=(a.y+i.lineHeight)*s;for(var w in O){var P=O[w];if(this.anchor.x!==0||this.anchor.y!==0)for(var Kt=0,je=this._textWidth*this.anchor.x,fr=this._textHeight*this.anchor.y,uo=0;uo<P.total;uo++)P.vertices[Kt++]-=je,P.vertices[Kt++]-=fr,P.vertices[Kt++]-=je,P.vertices[Kt++]-=fr,P.vertices[Kt++]-=je,P.vertices[Kt++]-=fr,P.vertices[Kt++]-=je,P.vertices[Kt++]-=fr;this._maxLineHeight=x*s;var lo=P.mesh.geometry.getBuffer("aVertexPosition"),fo=P.mesh.geometry.getBuffer("aTextureCoord"),co=P.mesh.geometry.getIndex();lo.data=P.vertices,fo.data=P.uvs,co.data=P.indices,lo.update(),fo.update(),co.update()}for(var w=0;w<o.length;w++)Ga.push(o[w]);this._font=i,this.dirty=!1},e.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},e.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);var i=Mt.available[this._fontName],n=i.distanceFieldRange,s=i.distanceFieldType,a=i.size;if(s!=="none")for(var o=this.worldTransform,h=o.a,u=o.b,l=o.c,f=o.d,c=Math.sqrt(h*h+u*u),d=Math.sqrt(l*l+f*f),p=(Math.abs(c)+Math.abs(d))/2,v=this.fontSize/a,_=0,m=this._activePagesMeshData;_<m.length;_++){var g=m[_];g.mesh.shader.uniforms.uFWidth=p*n*v*this._resolution}r.prototype._render.call(this,t)},e.prototype.getLocalBounds=function(){return this.validate(),r.prototype.getLocalBounds.call(this)},e.prototype.validate=function(){var t=Mt.available[this._fontName];if(!t)throw new Error('Missing BitmapFont "'+this._fontName+'"');this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()},Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){if(this._tint!==t){this._tint=t;for(var i=0;i<this._activePagesMeshData.length;i++)this._activePagesMeshData[i].mesh.tint=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontName",{get:function(){return this._fontName},set:function(t){if(!Mt.available[t])throw new Error('Missing BitmapFont "'+t+'"');this._fontName!==t&&(this._fontName=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){var t;return(t=this._fontSize)!==null&&t!==void 0?t:Mt.available[this._fontName].size},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},set:function(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.prototype.destroy=function(t){var i=this._textureCache,n=Mt.available[this._fontName],s=n.distanceFieldType==="none"?La:Ua;s.push.apply(s,this._activePagesMeshData);for(var a=0,o=this._activePagesMeshData;a<o.length;a++){var h=o[a];this.removeChild(h.mesh)}this._activePagesMeshData=[],s.filter(function(f){return i[f.mesh.texture.baseTexture.uid]}).forEach(function(f){f.mesh.texture=k.EMPTY});for(var u in i){var l=i[u];l.destroy(),delete i[u]}this._font=null,this._textureCache=null,r.prototype.destroy.call(this,t)},e.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},e}(Pt),jp=function(){function r(){}return r.add=function(){ct.setExtensionXhrType("fnt",ct.XHR_RESPONSE_TYPE.TEXT)},r.use=function(e,t){var i=Na(e.data);if(!i){t();return}for(var n=r.getBaseUrl(this,e),s=i.parse(e.data),a={},o=function(v){a[v.metadata.pageFile]=v.texture,Object.keys(a).length===s.page.length&&(e.bitmapFont=Mt.install(s,a,!0),t())},h=0;h<s.page.length;++h){var u=s.page[h].file,l=n+u,f=!1;for(var c in this.resources){var d=this.resources[c];if(d.url===l){d.metadata.pageFile=u,d.texture?o(d):d.onAfterMiddleware.add(o),f=!0;break}}if(!f){var p={crossOrigin:e.crossOrigin,loadType:ct.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},e.metadata.imageMetadata),parentResource:e};this.add(l,p,o)}}},r.getBaseUrl=function(e,t){var i=t.isDataUrl?"":r.dirname(t.url);return t.isDataUrl&&(i==="."&&(i=""),e.baseUrl&&i&&e.baseUrl.charAt(e.baseUrl.length-1)==="/"&&(i+="/")),i=i.replace(e.baseUrl,""),i&&i.charAt(i.length-1)!=="/"&&(i+="/"),i},r.dirname=function(e){var t=e.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return t===e?".":t===""?"/":t},r.extension=tt.Loader,r}();var In=function(r,e){return In=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},In(r,e)};function zp(r,e){In(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Yp=`varying vec2 vTextureCoord;
717
717
 
718
718
  uniform sampler2D uSampler;
719
719
  uniform float uAlpha;
@@ -722,7 +722,7 @@ void main(void)
722
722
  {
723
723
  gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
724
724
  }
725
- `;(function(r){Xp(e,r);function e(t){t===void 0&&(t=1);var i=r.call(this,Uc,Wp,{uAlpha:1})||this;return i.alpha=t,i}return Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e})(ae);var Rn=function(r,e){return Rn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Rn(r,e)};function Ga(r,e){Rn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var zp=`
725
+ `;(function(r){zp(e,r);function e(t){t===void 0&&(t=1);var i=r.call(this,Hc,Yp,{uAlpha:1})||this;return i.alpha=t,i}return Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e})(oe);var On=function(r,e){return On=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},On(r,e)};function ka(r,e){On(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Vp=`
726
726
  attribute vec2 aVertexPosition;
727
727
 
728
728
  uniform mat3 projectionMatrix;
@@ -752,10 +752,10 @@ void main(void)
752
752
 
753
753
  vec2 textureCoord = filterTextureCoord();
754
754
  %blur%
755
- }`;function jp(r,e){var t=Math.ceil(r/2),i=zp,n="",s;e?s="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":s="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var a=0;a<r;a++){var o=s.replace("%index%",a.toString());o=o.replace("%sampleIndex%",a-(t-1)+".0"),n+=o,n+=`
756
- `}return i=i.replace("%blur%",n),i=i.replace("%size%",r.toString()),i}var Yp={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Vp=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
757
- `);function qp(r){for(var e=Yp[r],t=e.length,i=Vp,n="",s="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;",a,o=0;o<r;o++){var h=s.replace("%index%",o.toString());a=o,o>=t&&(a=r-o-1),h=h.replace("%value%",e[a].toString()),n+=h,n+=`
758
- `}return i=i.replace("%blur%",n),i=i.replace("%size%",r.toString()),i}var ka=function(r){Ga(e,r);function e(t,i,n,s,a){i===void 0&&(i=8),n===void 0&&(n=4),s===void 0&&(s=F.FILTER_RESOLUTION),a===void 0&&(a=5);var o=this,h=jp(a,t),u=qp(a);return o=r.call(this,h,u)||this,o.horizontal=t,o.resolution=s,o._quality=0,o.quality=n,o.blur=i,o}return e.prototype.apply=function(t,i,n,s){if(n?this.horizontal?this.uniforms.strength=1/n.width*(n.width/i.width):this.uniforms.strength=1/n.height*(n.height/i.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/i.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/i.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,i,n,s);else{var a=t.getFilterTexture(),o=t.renderer,h=i,u=a;this.state.blend=!1,t.applyFilter(this,h,u,Ft.CLEAR);for(var l=1;l<this.passes-1;l++){t.bindAndClear(h,Ft.BLIT),this.uniforms.uSampler=u;var f=u;u=h,h=f,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,u,n,s),t.returnFilterTexture(a)}},Object.defineProperty(e.prototype,"blur",{get:function(){return this.strength},set:function(t){this.padding=1+Math.abs(t)*2,this.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=t,this.passes=t},enumerable:!1,configurable:!0}),e}(ae);(function(r){Ga(e,r);function e(t,i,n,s){t===void 0&&(t=8),i===void 0&&(i=4),n===void 0&&(n=F.FILTER_RESOLUTION),s===void 0&&(s=5);var a=r.call(this)||this;return a.blurXFilter=new ka(!0,t,i,n,s),a.blurYFilter=new ka(!1,t,i,n,s),a.resolution=n,a.quality=i,a.blur=t,a.repeatEdgePixels=!1,a}return e.prototype.apply=function(t,i,n,s){var a=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(a&&o){var h=t.getFilterTexture();this.blurXFilter.apply(t,i,h,Ft.CLEAR),this.blurYFilter.apply(t,h,n,s),t.returnFilterTexture(h)}else o?this.blurYFilter.apply(t,i,n,s):this.blurXFilter.apply(t,i,n,s)},e.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2},Object.defineProperty(e.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(t){this.blurXFilter.quality=this.blurYFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(t){this.blurYFilter.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(t){this._repeatEdgePixels=t,this.updatePadding()},enumerable:!1,configurable:!0}),e})(ae);var An=function(r,e){return An=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},An(r,e)};function $p(r,e){An(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Zp=`varying vec2 vTextureCoord;
755
+ }`;function qp(r,e){var t=Math.ceil(r/2),i=Vp,n="",s;e?s="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":s="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var a=0;a<r;a++){var o=s.replace("%index%",a.toString());o=o.replace("%sampleIndex%",a-(t-1)+".0"),n+=o,n+=`
756
+ `}return i=i.replace("%blur%",n),i=i.replace("%size%",r.toString()),i}var $p={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Zp=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
757
+ `);function Kp(r){for(var e=$p[r],t=e.length,i=Zp,n="",s="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;",a,o=0;o<r;o++){var h=s.replace("%index%",o.toString());a=o,o>=t&&(a=r-o-1),h=h.replace("%value%",e[a].toString()),n+=h,n+=`
758
+ `}return i=i.replace("%blur%",n),i=i.replace("%size%",r.toString()),i}var Ha=function(r){ka(e,r);function e(t,i,n,s,a){i===void 0&&(i=8),n===void 0&&(n=4),s===void 0&&(s=F.FILTER_RESOLUTION),a===void 0&&(a=5);var o=this,h=qp(a,t),u=Kp(a);return o=r.call(this,h,u)||this,o.horizontal=t,o.resolution=s,o._quality=0,o.quality=n,o.blur=i,o}return e.prototype.apply=function(t,i,n,s){if(n?this.horizontal?this.uniforms.strength=1/n.width*(n.width/i.width):this.uniforms.strength=1/n.height*(n.height/i.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/i.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/i.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,i,n,s);else{var a=t.getFilterTexture(),o=t.renderer,h=i,u=a;this.state.blend=!1,t.applyFilter(this,h,u,Bt.CLEAR);for(var l=1;l<this.passes-1;l++){t.bindAndClear(h,Bt.BLIT),this.uniforms.uSampler=u;var f=u;u=h,h=f,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,u,n,s),t.returnFilterTexture(a)}},Object.defineProperty(e.prototype,"blur",{get:function(){return this.strength},set:function(t){this.padding=1+Math.abs(t)*2,this.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=t,this.passes=t},enumerable:!1,configurable:!0}),e}(oe);(function(r){ka(e,r);function e(t,i,n,s){t===void 0&&(t=8),i===void 0&&(i=4),n===void 0&&(n=F.FILTER_RESOLUTION),s===void 0&&(s=5);var a=r.call(this)||this;return a.blurXFilter=new Ha(!0,t,i,n,s),a.blurYFilter=new Ha(!1,t,i,n,s),a.resolution=n,a.quality=i,a.blur=t,a.repeatEdgePixels=!1,a}return e.prototype.apply=function(t,i,n,s){var a=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(a&&o){var h=t.getFilterTexture();this.blurXFilter.apply(t,i,h,Bt.CLEAR),this.blurYFilter.apply(t,h,n,s),t.returnFilterTexture(h)}else o?this.blurYFilter.apply(t,i,n,s):this.blurXFilter.apply(t,i,n,s)},e.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2},Object.defineProperty(e.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(t){this.blurXFilter.quality=this.blurYFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(t){this.blurYFilter.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(t){this._repeatEdgePixels=t,this.updatePadding()},enumerable:!1,configurable:!0}),e})(oe);var Mn=function(r,e){return Mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Mn(r,e)};function Qp(r,e){Mn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Jp=`varying vec2 vTextureCoord;
759
759
  uniform sampler2D uSampler;
760
760
  uniform float m[20];
761
761
  uniform float uAlpha;
@@ -807,7 +807,7 @@ void main(void)
807
807
 
808
808
  gl_FragColor = vec4(rgb, result.a);
809
809
  }
810
- `,Ha=function(r){$p(e,r);function e(){var t=this,i={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return t=r.call(this,Qs,Zp,i)||this,t.alpha=1,t}return e.prototype._loadMatrix=function(t,i){i===void 0&&(i=!1);var n=t;i&&(this._multiply(n,this.uniforms.m,t),n=this._colorMatrix(n)),this.uniforms.m=n},e.prototype._multiply=function(t,i,n){return t[0]=i[0]*n[0]+i[1]*n[5]+i[2]*n[10]+i[3]*n[15],t[1]=i[0]*n[1]+i[1]*n[6]+i[2]*n[11]+i[3]*n[16],t[2]=i[0]*n[2]+i[1]*n[7]+i[2]*n[12]+i[3]*n[17],t[3]=i[0]*n[3]+i[1]*n[8]+i[2]*n[13]+i[3]*n[18],t[4]=i[0]*n[4]+i[1]*n[9]+i[2]*n[14]+i[3]*n[19]+i[4],t[5]=i[5]*n[0]+i[6]*n[5]+i[7]*n[10]+i[8]*n[15],t[6]=i[5]*n[1]+i[6]*n[6]+i[7]*n[11]+i[8]*n[16],t[7]=i[5]*n[2]+i[6]*n[7]+i[7]*n[12]+i[8]*n[17],t[8]=i[5]*n[3]+i[6]*n[8]+i[7]*n[13]+i[8]*n[18],t[9]=i[5]*n[4]+i[6]*n[9]+i[7]*n[14]+i[8]*n[19]+i[9],t[10]=i[10]*n[0]+i[11]*n[5]+i[12]*n[10]+i[13]*n[15],t[11]=i[10]*n[1]+i[11]*n[6]+i[12]*n[11]+i[13]*n[16],t[12]=i[10]*n[2]+i[11]*n[7]+i[12]*n[12]+i[13]*n[17],t[13]=i[10]*n[3]+i[11]*n[8]+i[12]*n[13]+i[13]*n[18],t[14]=i[10]*n[4]+i[11]*n[9]+i[12]*n[14]+i[13]*n[19]+i[14],t[15]=i[15]*n[0]+i[16]*n[5]+i[17]*n[10]+i[18]*n[15],t[16]=i[15]*n[1]+i[16]*n[6]+i[17]*n[11]+i[18]*n[16],t[17]=i[15]*n[2]+i[16]*n[7]+i[17]*n[12]+i[18]*n[17],t[18]=i[15]*n[3]+i[16]*n[8]+i[17]*n[13]+i[18]*n[18],t[19]=i[15]*n[4]+i[16]*n[9]+i[17]*n[14]+i[18]*n[19]+i[19],t},e.prototype._colorMatrix=function(t){var i=new Float32Array(t);return i[4]/=255,i[9]/=255,i[14]/=255,i[19]/=255,i},e.prototype.brightness=function(t,i){var n=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.tint=function(t,i){var n=t>>16&255,s=t>>8&255,a=t&255,o=[n/255,0,0,0,0,0,s/255,0,0,0,0,0,a/255,0,0,0,0,0,1,0];this._loadMatrix(o,i)},e.prototype.greyscale=function(t,i){var n=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.blackAndWhite=function(t){var i=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.hue=function(t,i){t=(t||0)/180*Math.PI;var n=Math.cos(t),s=Math.sin(t),a=Math.sqrt,o=1/3,h=a(o),u=n+(1-n)*o,l=o*(1-n)-h*s,f=o*(1-n)+h*s,c=o*(1-n)+h*s,d=n+o*(1-n),p=o*(1-n)-h*s,v=o*(1-n)-h*s,_=o*(1-n)+h*s,m=n+o*(1-n),y=[u,l,f,0,0,c,d,p,0,0,v,_,m,0,0,0,0,0,1,0];this._loadMatrix(y,i)},e.prototype.contrast=function(t,i){var n=(t||0)+1,s=-.5*(n-1),a=[n,0,0,0,s,0,n,0,0,s,0,0,n,0,s,0,0,0,1,0];this._loadMatrix(a,i)},e.prototype.saturate=function(t,i){t===void 0&&(t=0);var n=t*2/3+1,s=(n-1)*-.5,a=[n,s,s,0,0,s,n,s,0,0,s,s,n,0,0,0,0,0,1,0];this._loadMatrix(a,i)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(t){var i=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.sepia=function(t){var i=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.technicolor=function(t){var i=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.polaroid=function(t){var i=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.toBGR=function(t){var i=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.kodachrome=function(t){var i=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.browni=function(t){var i=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.vintage=function(t){var i=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.colorTone=function(t,i,n,s,a){t=t||.2,i=i||.15,n=n||16770432,s=s||3375104;var o=(n>>16&255)/255,h=(n>>8&255)/255,u=(n&255)/255,l=(s>>16&255)/255,f=(s>>8&255)/255,c=(s&255)/255,d=[.3,.59,.11,0,0,o,h,u,t,0,l,f,c,i,0,o-l,h-f,u-c,0,0];this._loadMatrix(d,a)},e.prototype.night=function(t,i){t=t||.1;var n=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.predator=function(t,i){var n=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.lsd=function(t){var i=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.reset=function(){var t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(ae);Ha.prototype.grayscale=Ha.prototype.greyscale;var In=function(r,e){return In=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},In(r,e)};function Kp(r,e){In(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Qp=`varying vec2 vFilterCoord;
810
+ `,Xa=function(r){Qp(e,r);function e(){var t=this,i={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return t=r.call(this,Js,Jp,i)||this,t.alpha=1,t}return e.prototype._loadMatrix=function(t,i){i===void 0&&(i=!1);var n=t;i&&(this._multiply(n,this.uniforms.m,t),n=this._colorMatrix(n)),this.uniforms.m=n},e.prototype._multiply=function(t,i,n){return t[0]=i[0]*n[0]+i[1]*n[5]+i[2]*n[10]+i[3]*n[15],t[1]=i[0]*n[1]+i[1]*n[6]+i[2]*n[11]+i[3]*n[16],t[2]=i[0]*n[2]+i[1]*n[7]+i[2]*n[12]+i[3]*n[17],t[3]=i[0]*n[3]+i[1]*n[8]+i[2]*n[13]+i[3]*n[18],t[4]=i[0]*n[4]+i[1]*n[9]+i[2]*n[14]+i[3]*n[19]+i[4],t[5]=i[5]*n[0]+i[6]*n[5]+i[7]*n[10]+i[8]*n[15],t[6]=i[5]*n[1]+i[6]*n[6]+i[7]*n[11]+i[8]*n[16],t[7]=i[5]*n[2]+i[6]*n[7]+i[7]*n[12]+i[8]*n[17],t[8]=i[5]*n[3]+i[6]*n[8]+i[7]*n[13]+i[8]*n[18],t[9]=i[5]*n[4]+i[6]*n[9]+i[7]*n[14]+i[8]*n[19]+i[9],t[10]=i[10]*n[0]+i[11]*n[5]+i[12]*n[10]+i[13]*n[15],t[11]=i[10]*n[1]+i[11]*n[6]+i[12]*n[11]+i[13]*n[16],t[12]=i[10]*n[2]+i[11]*n[7]+i[12]*n[12]+i[13]*n[17],t[13]=i[10]*n[3]+i[11]*n[8]+i[12]*n[13]+i[13]*n[18],t[14]=i[10]*n[4]+i[11]*n[9]+i[12]*n[14]+i[13]*n[19]+i[14],t[15]=i[15]*n[0]+i[16]*n[5]+i[17]*n[10]+i[18]*n[15],t[16]=i[15]*n[1]+i[16]*n[6]+i[17]*n[11]+i[18]*n[16],t[17]=i[15]*n[2]+i[16]*n[7]+i[17]*n[12]+i[18]*n[17],t[18]=i[15]*n[3]+i[16]*n[8]+i[17]*n[13]+i[18]*n[18],t[19]=i[15]*n[4]+i[16]*n[9]+i[17]*n[14]+i[18]*n[19]+i[19],t},e.prototype._colorMatrix=function(t){var i=new Float32Array(t);return i[4]/=255,i[9]/=255,i[14]/=255,i[19]/=255,i},e.prototype.brightness=function(t,i){var n=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.tint=function(t,i){var n=t>>16&255,s=t>>8&255,a=t&255,o=[n/255,0,0,0,0,0,s/255,0,0,0,0,0,a/255,0,0,0,0,0,1,0];this._loadMatrix(o,i)},e.prototype.greyscale=function(t,i){var n=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.blackAndWhite=function(t){var i=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.hue=function(t,i){t=(t||0)/180*Math.PI;var n=Math.cos(t),s=Math.sin(t),a=Math.sqrt,o=1/3,h=a(o),u=n+(1-n)*o,l=o*(1-n)-h*s,f=o*(1-n)+h*s,c=o*(1-n)+h*s,d=n+o*(1-n),p=o*(1-n)-h*s,v=o*(1-n)-h*s,_=o*(1-n)+h*s,m=n+o*(1-n),g=[u,l,f,0,0,c,d,p,0,0,v,_,m,0,0,0,0,0,1,0];this._loadMatrix(g,i)},e.prototype.contrast=function(t,i){var n=(t||0)+1,s=-.5*(n-1),a=[n,0,0,0,s,0,n,0,0,s,0,0,n,0,s,0,0,0,1,0];this._loadMatrix(a,i)},e.prototype.saturate=function(t,i){t===void 0&&(t=0);var n=t*2/3+1,s=(n-1)*-.5,a=[n,s,s,0,0,s,n,s,0,0,s,s,n,0,0,0,0,0,1,0];this._loadMatrix(a,i)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(t){var i=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.sepia=function(t){var i=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.technicolor=function(t){var i=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.polaroid=function(t){var i=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.toBGR=function(t){var i=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.kodachrome=function(t){var i=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.browni=function(t){var i=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.vintage=function(t){var i=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.colorTone=function(t,i,n,s,a){t=t||.2,i=i||.15,n=n||16770432,s=s||3375104;var o=(n>>16&255)/255,h=(n>>8&255)/255,u=(n&255)/255,l=(s>>16&255)/255,f=(s>>8&255)/255,c=(s&255)/255,d=[.3,.59,.11,0,0,o,h,u,t,0,l,f,c,i,0,o-l,h-f,u-c,0,0];this._loadMatrix(d,a)},e.prototype.night=function(t,i){t=t||.1;var n=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.predator=function(t,i){var n=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(n,i)},e.prototype.lsd=function(t){var i=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(i,t)},e.prototype.reset=function(){var t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(oe);Xa.prototype.grayscale=Xa.prototype.greyscale;var Dn=function(r,e){return Dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Dn(r,e)};function tv(r,e){Dn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ev=`varying vec2 vFilterCoord;
811
811
  varying vec2 vTextureCoord;
812
812
 
813
813
  uniform vec2 scale;
@@ -827,7 +827,7 @@ void main(void)
827
827
 
828
828
  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
829
829
  }
830
- `,Jp=`attribute vec2 aVertexPosition;
830
+ `,iv=`attribute vec2 aVertexPosition;
831
831
 
832
832
  uniform mat3 projectionMatrix;
833
833
  uniform mat3 filterMatrix;
@@ -856,7 +856,7 @@ void main(void)
856
856
  vTextureCoord = filterTextureCoord();
857
857
  vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
858
858
  }
859
- `;(function(r){Kp(e,r);function e(t,i){var n=this,s=new gt;return t.renderable=!1,n=r.call(this,Jp,Qp,{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this,n.maskSprite=t,n.maskMatrix=s,i==null&&(i=20),n.scale=new W(i,i),n}return e.prototype.apply=function(t,i,n,s){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var a=this.maskSprite.worldTransform,o=Math.sqrt(a.a*a.a+a.b*a.b),h=Math.sqrt(a.c*a.c+a.d*a.d);o!==0&&h!==0&&(this.uniforms.rotation[0]=a.a/o,this.uniforms.rotation[1]=a.b/o,this.uniforms.rotation[2]=a.c/h,this.uniforms.rotation[3]=a.d/h),t.applyFilter(this,i,n,s)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0}),e})(ae);var On=function(r,e){return On=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},On(r,e)};function tv(r,e){On(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ev=`
859
+ `;(function(r){tv(e,r);function e(t,i){var n=this,s=new gt;return t.renderable=!1,n=r.call(this,iv,ev,{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this,n.maskSprite=t,n.maskMatrix=s,i==null&&(i=20),n.scale=new X(i,i),n}return e.prototype.apply=function(t,i,n,s){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var a=this.maskSprite.worldTransform,o=Math.sqrt(a.a*a.a+a.b*a.b),h=Math.sqrt(a.c*a.c+a.d*a.d);o!==0&&h!==0&&(this.uniforms.rotation[0]=a.a/o,this.uniforms.rotation[1]=a.b/o,this.uniforms.rotation[2]=a.c/h,this.uniforms.rotation[3]=a.d/h),t.applyFilter(this,i,n,s)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0}),e})(oe);var Fn=function(r,e){return Fn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Fn(r,e)};function rv(r,e){Fn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var nv=`
860
860
  attribute vec2 aVertexPosition;
861
861
 
862
862
  uniform mat3 projectionMatrix;
@@ -898,7 +898,7 @@ void main(void) {
898
898
 
899
899
  texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
900
900
  }
901
- `,iv=`varying vec2 v_rgbNW;
901
+ `,sv=`varying vec2 v_rgbNW;
902
902
  varying vec2 v_rgbNE;
903
903
  varying vec2 v_rgbSW;
904
904
  varying vec2 v_rgbSE;
@@ -1019,7 +1019,7 @@ void main() {
1019
1019
 
1020
1020
  gl_FragColor = color;
1021
1021
  }
1022
- `;(function(r){tv(e,r);function e(){return r.call(this,ev,iv)||this}return e})(ae);var Mn=function(r,e){return Mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Mn(r,e)};function rv(r,e){Mn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var nv=`precision highp float;
1022
+ `;(function(r){rv(e,r);function e(){return r.call(this,nv,sv)||this}return e})(oe);var Nn=function(r,e){return Nn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Nn(r,e)};function av(r,e){Nn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ov=`precision highp float;
1023
1023
 
1024
1024
  varying vec2 vTextureCoord;
1025
1025
  varying vec4 vColor;
@@ -1053,5 +1053,6 @@ void main()
1053
1053
 
1054
1054
  gl_FragColor = color;
1055
1055
  }
1056
- `;(function(r){rv(e,r);function e(t,i){t===void 0&&(t=.5),i===void 0&&(i=Math.random());var n=r.call(this,Qs,nv,{uNoise:0,uSeed:0})||this;return n.noise=t,n.seed=i,n}return Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e})(ae);var Xa=new gt;pt.prototype._cacheAsBitmap=!1,pt.prototype._cacheData=null,pt.prototype._cacheAsBitmapResolution=null,pt.prototype._cacheAsBitmapMultisample=ct.NONE;var sv=function(){function r(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}return r}();Object.defineProperties(pt.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(r){if(this._cacheAsBitmap!==r){this._cacheAsBitmap=r;var e;r?(this._cacheData||(this._cacheData=new sv),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}}),pt.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},pt.prototype._initCachedDisplayObject=function(e){var t;if(!(this._cacheData&&this._cacheData.sprite)){var i=this.alpha;this.alpha=1,e.batch.flush();var n=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var s=this.filters[0].padding;n.pad(s)}n.ceil(F.RESOLUTION);var a=e.renderTexture.current,o=e.renderTexture.sourceFrame.clone(),h=e.renderTexture.destinationFrame.clone(),u=e.projection.transform,l=xe.create({width:n.width,height:n.height,resolution:this.cacheAsBitmapResolution||e.resolution,multisample:(t=this.cacheAsBitmapMultisample)!==null&&t!==void 0?t:e.multisample}),f="cacheAsBitmap_"+ge();this._cacheData.textureCacheId=f,Y.addToCache(l.baseTexture,f),k.addToCache(l,f);var c=this.transform.localTransform.copyTo(Xa).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,e.render(this,{renderTexture:l,clear:!0,transform:c,skipUpdateTransform:!1}),e.framebuffer.blit(),e.projection.transform=u,e.renderTexture.bind(a,o,h),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var d=new ui(l);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(n.x/n.width),d.anchor.y=-(n.y/n.height),d.alpha=i,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},pt.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},pt.prototype._initCachedDisplayObjectCanvas=function(e){if(!(this._cacheData&&this._cacheData.sprite)){var t=this.getLocalBounds(null,!0),i=this.alpha;this.alpha=1;var n=e.context,s=e._projTransform;t.ceil(F.RESOLUTION);var a=xe.create({width:t.width,height:t.height}),o="cacheAsBitmap_"+ge();this._cacheData.textureCacheId=o,Y.addToCache(a.baseTexture,o),k.addToCache(a,o);var h=Xa;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),e.context=n,e._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var u=new ui(a);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(t.x/t.width),u.anchor.y=-(t.y/t.height),u.alpha=i,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)}},pt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},pt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},pt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Y.removeFromCache(this._cacheData.textureCacheId),k.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},pt.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)};pt.prototype.name=null,St.prototype.getChildByName=function(e,t){for(var i=0,n=this.children.length;i<n;i++)if(this.children[i].name===e)return this.children[i];if(t)for(var i=0,n=this.children.length;i<n;i++){var s=this.children[i];if(s.getChildByName){var a=s.getChildByName(e,!0);if(a)return a}}return null};pt.prototype.getGlobalPosition=function(e,t){return e===void 0&&(e=new W),t===void 0&&(t=!1),this.parent?this.parent.toGlobal(this.position,e,t):(e.x=this.position.x,e.y=this.position.y),e};var av=function(){function r(){}return r.init=function(e){var t=this;Object.defineProperty(this,"resizeTo",{set:function(i){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=i,i&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){t._resizeTo&&(t.cancelResize(),t._resizeId=requestAnimationFrame(function(){return t.resize()}))},this.cancelResize=function(){t._resizeId&&(cancelAnimationFrame(t._resizeId),t._resizeId=null)},this.resize=function(){if(t._resizeTo){t.cancelResize();var i,n;if(t._resizeTo===globalThis.window)i=globalThis.innerWidth,n=globalThis.innerHeight;else{var s=t._resizeTo,a=s.clientWidth,o=s.clientHeight;i=a,n=o}t.renderer.resize(i,n)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null},r.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},r.extension=J.Application,r}(),Wa=function(){function r(e){var t=this;this.stage=new St,e=Object.assign({forceCanvas:!1},e),this.renderer=Nc(e),r._plugins.forEach(function(i){i.init.call(t,e)})}return r.registerPlugin=function(e){Bt("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),Jt.add({type:J.Application,ref:e})},r.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(r.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),r.prototype.destroy=function(e,t){var i=this,n=r._plugins.slice(0);n.reverse(),n.forEach(function(s){s.destroy.call(i)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null},r._plugins=[],r}();Jt.handleByList(J.Application,Wa._plugins),Jt.add(av);var Dn=function(r,e){return Dn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Dn(r,e)};function ke(r,e){Dn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ov=function(r){ke(e,r);function e(t,i,n,s){t===void 0&&(t=100),i===void 0&&(i=100),n===void 0&&(n=10),s===void 0&&(s=10);var a=r.call(this)||this;return a.segWidth=n,a.segHeight=s,a.width=t,a.height=i,a.build(),a}return e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,i=[],n=[],s=[],a=this.segWidth-1,o=this.segHeight-1,h=this.width/a,u=this.height/o,l=0;l<t;l++){var f=l%this.segWidth,c=l/this.segWidth|0;i.push(f*h,c*u),n.push(f/a,c/o)}for(var d=a*o,l=0;l<d;l++){var p=l%a,v=l/a|0,_=v*this.segWidth+p,m=v*this.segWidth+p+1,y=(v+1)*this.segWidth+p,g=(v+1)*this.segWidth+p+1;s.push(_,m,y,m,g,y)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint16Array(s),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(er),hv=function(r){ke(e,r);function e(t,i,n){t===void 0&&(t=200),n===void 0&&(n=0);var s=r.call(this,new Float32Array(i.length*4),new Float32Array(i.length*4),new Uint16Array((i.length-1)*6))||this;return s.points=i,s._width=t,s.textureScale=n,s.build(),s}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var i=this.getBuffer("aVertexPosition"),n=this.getBuffer("aTextureCoord"),s=this.getIndex();if(!(t.length<1)){i.data.length/4!==t.length&&(i.data=new Float32Array(t.length*4),n.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));var a=n.data,o=s.data;a[0]=0,a[1]=0,a[2]=0,a[3]=1;for(var h=0,u=t[0],l=this._width*this.textureScale,f=t.length,c=0;c<f;c++){var d=c*4;if(this.textureScale>0){var p=u.x-t[c].x,v=u.y-t[c].y,_=Math.sqrt(p*p+v*v);u=t[c],h+=_/l}else h=c/(f-1);a[d]=h,a[d+1]=0,a[d+2]=h,a[d+3]=1}for(var m=0,c=0;c<f-1;c++){var d=c*2;o[m++]=d,o[m++]=d+1,o[m++]=d+2,o[m++]=d+2,o[m++]=d+1,o[m++]=d+3}n.update(),s.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var i=t[0],n,s=0,a=0,o=this.buffers[0].data,h=t.length,u=0;u<h;u++){var l=t[u],f=u*4;u<t.length-1?n=t[u+1]:n=l,a=-(n.x-i.x),s=n.y-i.y;var c=Math.sqrt(s*s+a*a),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;s/=c,a/=c,s*=d,a*=d,o[f]=l.x+s,o[f+1]=l.y+a,o[f+2]=l.x-s,o[f+3]=l.y-a,i=l}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(er);(function(r){ke(e,r);function e(t,i,n){n===void 0&&(n=0);var s=this,a=new hv(t.height,i,n),o=new di(t);return n>0&&(t.baseTexture.wrapMode=zt.REPEAT),s=r.call(this,a,o)||this,s.autoUpdate=!0,s}return e.prototype._render=function(t){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),r.prototype._render.call(this,t)},e})(ci);var uv=function(r){ke(e,r);function e(t,i,n){var s=this,a=new ov(t.width,t.height,i,n),o=new di(k.WHITE);return s=r.call(this,a,o)||this,s.texture=t,s.autoResize=!0,s}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,i=this.shader.texture,n=i.width,s=i.height;this.autoResize&&(t.width!==n||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),r.prototype._render.call(this,t)},e.prototype.destroy=function(t){this.shader.texture.off("update",this.textureUpdated,this),r.prototype.destroy.call(this,t)},e}(ci);(function(r){ke(e,r);function e(t,i,n,s,a){t===void 0&&(t=k.EMPTY);var o=this,h=new er(i,n,s);h.getBuffer("aVertexPosition").static=!1;var u=new di(t);return o=r.call(this,h,u,null,a)||this,o.autoUpdate=!0,o}return Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),r.prototype._render.call(this,t)},e})(ci);var nr=10;(function(r){ke(e,r);function e(t,i,n,s,a){i===void 0&&(i=nr),n===void 0&&(n=nr),s===void 0&&(s=nr),a===void 0&&(a=nr);var o=r.call(this,k.WHITE,4,4)||this;return o._origWidth=t.orig.width,o._origHeight=t.orig.height,o._width=o._origWidth,o._height=o._origHeight,o._leftWidth=i,o._rightWidth=s,o._topHeight=n,o._bottomHeight=a,o.texture=t,o}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,i=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*i,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*i,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,i=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*i,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*i,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,i=this._width>t?1:this._width/t,n=this._topHeight+this._bottomHeight,s=this._height>n?1:this._height/n,a=Math.min(i,s);return a},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,i=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var n=1/this._origWidth,s=1/this._origHeight;i[0]=i[8]=i[16]=i[24]=0,i[1]=i[3]=i[5]=i[7]=0,i[6]=i[14]=i[22]=i[30]=1,i[25]=i[27]=i[29]=i[31]=1,i[2]=i[10]=i[18]=i[26]=n*this._leftWidth,i[4]=i[12]=i[20]=i[28]=1-n*this._rightWidth,i[9]=i[11]=i[13]=i[15]=s*this._topHeight,i[17]=i[19]=i[21]=i[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e})(uv);var Fn=function(r,e){return Fn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Fn(r,e)};function lv(r,e){Fn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){lv(e,r);function e(t,i){i===void 0&&(i=!0);var n=r.call(this,t[0]instanceof k?t[0]:t[0].texture)||this;return n._textures=null,n._durations=null,n._autoUpdate=i,n._isConnectedToTicker=!1,n.animationSpeed=1,n.loop=!0,n.updateAnchor=!1,n.onComplete=null,n.onFrameChange=null,n.onLoop=null,n._currentTime=0,n._playing=!1,n._previousFrame=null,n.textures=t,n}return e.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(bt.shared.add(this.update,this,te.HIGH),this._isConnectedToTicker=!0))},e.prototype.gotoAndStop=function(t){this.stop();var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture()},e.prototype.gotoAndPlay=function(t){var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture(),this.play()},e.prototype.update=function(t){if(this._playing){var i=this.animationSpeed*t,n=this.currentFrame;if(this._durations!==null){var s=this._currentTime%1*this._durations[this.currentFrame];for(s+=i/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];var a=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n?this.onLoop():this.animationSpeed<0&&this.currentFrame>n&&this.onLoop()),this.updateTexture())}},e.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},e.prototype.destroy=function(t){this.stop(),r.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},e.fromFrames=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},e.fromImages=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof k)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var i=0;i<t.length;i++)this._textures.push(t[i].texture),this._durations.push(t[i].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(bt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),e})(ui);Jt.add($c,ed,td,Vd,Tp,ia,Ap,Hp,gd,Wd,zd,Ep,df,ud);var za={exports:{}};(function(r){(function(){function e(v,_){document.addEventListener?v.addEventListener("scroll",_,!1):v.attachEvent("scroll",_)}function t(v){document.body?v():document.addEventListener?document.addEventListener("DOMContentLoaded",function _(){document.removeEventListener("DOMContentLoaded",_),v()}):document.attachEvent("onreadystatechange",function _(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",_),v())})}function i(v){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(v)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function n(v,_){v.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+_+";"}function s(v){var _=v.g.offsetWidth,m=_+100;return v.j.style.width=m+"px",v.i.scrollLeft=m,v.h.scrollLeft=v.h.scrollWidth+100,v.l!==_?(v.l=_,!0):!1}function a(v,_){function m(){var g=y;s(g)&&g.g.parentNode!==null&&_(g.l)}var y=v;e(v.h,m),e(v.i,m),s(v)}function o(v,_,m){_=_||{},m=m||window,this.family=v,this.style=_.style||"normal",this.weight=_.weight||"normal",this.stretch=_.stretch||"normal",this.context=m}var h=null,u=null,l=null,f=null;function c(v){return u===null&&(d(v)&&/Apple/.test(window.navigator.vendor)?(v=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),u=!!v&&603>parseInt(v[1],10)):u=!1),u}function d(v){return f===null&&(f=!!v.document.fonts),f}function p(v,_){var m=v.style,y=v.weight;if(l===null){var g=document.createElement("div");try{g.style.font="condensed 100px sans-serif"}catch{}l=g.style.font!==""}return[m,y,l?v.stretch:"","100px",_].join(" ")}o.prototype.load=function(v,_){var m=this,y=v||"BESbswy",g=0,b=_||3e3,x=new Date().getTime();return new Promise(function(T,w){if(d(m.context)&&!c(m.context)){var A=new Promise(function(S,D){function C(){new Date().getTime()-x>=b?D(Error(""+b+"ms timeout exceeded")):m.context.document.fonts.load(p(m,'"'+m.family+'"'),y).then(function(N){1<=N.length?S():setTimeout(C,25)},D)}C()}),E=new Promise(function(S,D){g=setTimeout(function(){D(Error(""+b+"ms timeout exceeded"))},b)});Promise.race([E,A]).then(function(){clearTimeout(g),T(m)},w)}else t(function(){function S(){var B;(B=M!=-1&&O!=-1||M!=-1&&G!=-1||O!=-1&&G!=-1)&&((B=M!=O&&M!=G&&O!=G)||(h===null&&(B=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!B&&(536>parseInt(B[1],10)||parseInt(B[1],10)===536&&11>=parseInt(B[2],10))),B=h&&(M==lt&&O==lt&&G==lt||M==j&&O==j&&G==j||M==I&&O==I&&G==I)),B=!B),B&&(P.parentNode!==null&&P.parentNode.removeChild(P),clearTimeout(g),T(m))}function D(){if(new Date().getTime()-x>=b)P.parentNode!==null&&P.parentNode.removeChild(P),w(Error(""+b+"ms timeout exceeded"));else{var B=m.context.document.hidden;(B===!0||B===void 0)&&(M=C.g.offsetWidth,O=N.g.offsetWidth,G=H.g.offsetWidth,S()),g=setTimeout(D,50)}}var C=new i(y),N=new i(y),H=new i(y),M=-1,O=-1,G=-1,lt=-1,j=-1,I=-1,P=document.createElement("div");P.dir="ltr",n(C,p(m,"sans-serif")),n(N,p(m,"serif")),n(H,p(m,"monospace")),P.appendChild(C.g),P.appendChild(N.g),P.appendChild(H.g),m.context.document.body.appendChild(P),lt=C.g.offsetWidth,j=N.g.offsetWidth,I=H.g.offsetWidth,D(),a(C,function(B){M=B,S()}),n(C,p(m,'"'+m.family+'",sans-serif')),a(N,function(B){O=B,S()}),n(N,p(m,'"'+m.family+'",serif')),a(H,function(B){G=B,S()}),n(H,p(m,'"'+m.family+'",monospace'))})})},r.exports=o})()})(za);const fv=za.exports,cv=["0123456789","abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ",`.,:;!?()[]{}<>|/\\@'"`].join(""),Nn=new Re({fontFamily:"InterVariable",fontSize:24,lineHeight:32});function dv(){const r=window.devicePixelRatio||2;return new Promise(e=>{new fv("InterVariable").load().then(()=>{const i={resolution:r,chars:cv};Ht.from("NodeTextDefault",{...Nn,fill:1120295},i),Ht.from("NodeTextInverse",{...Nn,fill:16777215},i),Ht.from("TimeMarkerLabel",{fontFamily:"InterVariable",fontSize:16,lineHeight:24,fill:9741240},i),e({nodeTextDefault:{fontName:"NodeTextDefault",fontSize:24},nodeTextInverse:{fontName:"NodeTextInverse",fontSize:24},nodeTextMetrics:Nn,timeMarkerLabel:{fontName:"TimeMarkerLabel",fontSize:12}})})})}let Bn=null;const ja=()=>(Bn||(Bn=dv()),Bn);function pv(r){const e=new Wa({backgroundAlpha:0,width:r.clientWidth,height:r.clientHeight,resolution:window.devicePixelRatio||2,autoDensity:!0,antialias:!0,resizeTo:r});return r.appendChild(e.view),e}async function vv(){const{Viewport:r}=await Promise.resolve().then(()=>Xv);return r}async function _v(r,e){const t=await vv(),i=r.clientWidth,n=r.clientHeight,s=new t({screenWidth:i,screenHeight:n,passiveWheel:!1,interaction:e.renderer.plugins.interaction,divWheel:r,ticker:e.ticker});return s.drag({wheel:!1,pressDrag:!0}).wheel({trackpadPinch:!0,wheelZoom:!1}).clampZoom({minWidth:i/2,maxWidth:i*20}).decelerate({friction:.9}),e.stage.addChild(s),s}const Ln={guideLineColor:13227490,labelPadding:4};class mv extends St{constructor(t,i){super();et(this,"labelText");et(this,"guideHeight");et(this,"guideLine");et(this,"label");this.labelText=t,this.guideHeight=i,this.guideLine=new Ce,this.drawGuideLine(),this.addChild(this.guideLine),this.drawLabel()}drawGuideLine(){this.guideLine.clear(),this.guideLine.beginFill(Ln.guideLineColor),this.guideLine.drawRect(0,0,1,this.guideHeight),this.guideLine.endFill()}async drawLabel(){var i;const t=await ja();(i=this.label)==null||i.destroy(),this.label=new Pn(this.labelText,t.timeMarkerLabel),this.label.position.set(Ln.labelPadding,Ln.labelPadding),this.addChild(this.label)}}const gv=80,yv=260,Un={xPadding:4e3},q={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Ya=[{ceiling:q.second*4,span:q.second},{ceiling:q.second*8,span:q.second*5},{ceiling:q.second*13,span:q.second*10},{ceiling:q.second*20,span:q.second*15},{ceiling:q.second*45,span:q.second*30},{ceiling:q.minute*4,span:q.minute},{ceiling:q.minute*8,span:q.minute*5},{ceiling:q.minute*13,span:q.minute*10},{ceiling:q.minute*28,span:q.minute*15},{ceiling:q.hour*1.24,span:q.minute*30},{ceiling:q.hour*3,span:q.hour},{ceiling:q.hour*8,span:q.hour*5},{ceiling:q.hour*13,span:q.hour*10},{ceiling:q.hour*22,span:q.hour*12},{ceiling:q.day*4,span:q.day},{ceiling:q.week*2,span:q.week},{ceiling:1/0,span:q.week*4}];class xv extends St{constructor({viewportRef:t,stageWidth:i,guideHeight:n,overallGraphWidth:s,xScale:a,dateScale:o,minimumStartDate:h,maximumEndDate:u}){super();et(this,"viewportRef");et(this,"stageWidth");et(this,"guideHeight");et(this,"overallGraphWidth");et(this,"xScale");et(this,"dateScale");et(this,"minimumStartDate");et(this,"maximumEndDate");et(this,"idealGuideCount",10);et(this,"currentTimeGap",120);et(this,"guides",new Map);this.viewportRef=t,this.stageWidth=i,this.guideHeight=n,this.overallGraphWidth=s,this.xScale=a,this.dateScale=o,this.minimumStartDate=h,this.maximumEndDate=u,this.updateIdealGuideCount(),this.updateCurrentTimeGap(),this.createGuides()}updateGuides(){var n;const t=this.currentTimeGap;this.updateCurrentTimeGap();const i=(n=Array.from(this.guides).pop())==null?void 0:n[1];this.guides.size===0||t!==this.currentTimeGap||i&&i.x+this.currentTimeGap<this.xScale(this.maximumEndDate)+Un.xPadding?(this.guides.size>0&&(this.removeChildren(),this.guides.clear()),this.createGuides()):this.updateGuidePositions()}updateIdealGuideCount(){this.idealGuideCount=Math.ceil(this.stageWidth/(yv-gv/2))}updateCurrentTimeGap(){var n;const t=Math.ceil((this.viewportRef.right-this.viewportRef.left)/this.idealGuideCount),i=this.dateScale(t)-this.minimumStartDate.getTime();this.currentTimeGap=((n=Ya.find(s=>s.ceiling>i))==null?void 0:n.span)??Ya[0].span}createGuides(){let t;const i=this.dateScale(this.overallGraphWidth+Un.xPadding);for(t=new Date(Math.ceil(this.dateScale(-Un.xPadding)/this.currentTimeGap)*this.currentTimeGap);t.getTime()<i;){const s=new mv(t.toLocaleTimeString(),this.guideHeight);s.position.set(this.getGuidePosition(t),0),this.guides.set(t,s),this.addChild(s),t=new Date(t.getTime()+this.currentTimeGap)}}getGuidePosition(t){return this.xScale(t)*this.viewportRef.scale._x+this.viewportRef.worldTransform.tx}updateGuidePositions(){this.guides.forEach((t,i)=>{t.position.set(this.getGuidePosition(i),0)})}destroy(){this.removeChildren(),this.guides.clear(),super.destroy.call(this)}}const pi={padding:16,borderRadius:8,labelGap:4},Va={completed:42557,running:43247,scheduled:6321549,pending:6321549,failed:15728657,cancelled:15728657,crashed:15728657,paused:16035840};class qa extends St{constructor(t,i,n){super();et(this,"nodeData");et(this,"xScale");et(this,"label");et(this,"box");et(this,"apxLabelWidth",0);et(this,"nodeWidth");et(this,"yPositionIndex",0);et(this,"isLabelInBox",!0);this.nodeData=t,this.xScale=i,this.yPositionIndex=n,this.nodeWidth=this.getNodeWidth(),this.drawLabel(),this.box=new Ce,this.drawBox(),this.addChild(this.box),this.updatePosition()}getNodeWidth(){return this.xScale(this.nodeData.end??new Date)-this.xScale(this.nodeData.start)}async drawLabel(){var i;const t=await ja();this.apxLabelWidth===0&&(this.apxLabelWidth=kt.measureText(this.nodeData.label,t.nodeTextMetrics).width),(i=this.label)==null||i.destroy(),this.apxLabelWidth>this.nodeWidth?(this.isLabelInBox=!1,this.label=new Pn(this.nodeData.label,t.nodeTextDefault)):(this.isLabelInBox=!0,this.label=new Pn(this.nodeData.label,t.nodeTextInverse)),this.updateLabelPosition(),this.addChild(this.label)}get boxColor(){return this.nodeData.state?Va[this.nodeData.state]:Va.pending}drawBox(){var t;this.box.beginFill(this.boxColor),this.box.drawRoundedRect(0,0,this.nodeWidth,((t=this.label)!=null&&t.height?this.label.height:32)+pi.padding*2,pi.borderRadius),this.box.endFill()}updatePosition(){this.position.set(this.xScale(this.nodeData.start),this.yPositionIndex*120)}updateLabelPosition(){var t;(t=this.label)==null||t.position.set(this.isLabelInBox?pi.padding:this.nodeWidth+pi.labelGap,pi.padding)}update(){const t=this.getNodeWidth();t!==this.nodeWidth&&(this.nodeWidth=t,this.box.clear(),this.drawBox(),this.isLabelInBox&&this.apxLabelWidth>this.nodeWidth+2||!this.isLabelInBox&&this.apxLabelWidth<this.nodeWidth-2?this.drawLabel():this.isLabelInBox||this.updateLabelPosition()),this.updatePosition()}}const ue={playheadBg:5145342,playheadWidth:2,playheadGlowPadding:8};class bv extends St{constructor({playheadHeight:t,viewportRef:i,xScale:n}){super();et(this,"playheadHeight");et(this,"viewportRef");et(this,"xScale");et(this,"playhead",new Ce);this.playheadHeight=t,this.viewportRef=i,this.xScale=n,this.drawPlayhead()}drawPlayhead(){this.playhead.beginFill(ue.playheadBg,.1),this.playhead.drawRect(0,0,ue.playheadWidth+ue.playheadGlowPadding*2,this.playheadHeight),this.playhead.endFill(),this.playhead.beginFill(ue.playheadBg),this.playhead.drawRect(ue.playheadGlowPadding,0,ue.playheadWidth,this.playheadHeight),this.playhead.endFill(),this.addChild(this.playhead)}updatePosition(){this.position.x=this.xScale(new Date)*this.viewportRef.scale._x+this.viewportRef.worldTransform.tx-ue.playheadGlowPadding-ue.playheadWidth/2}}function Tv(r){let e,t;return r.forEach(i=>{(e===void 0||e>i.start||isNaN(i.start.getDate()))&&(e=i.start),i.end!==null&&(t===void 0||t<i.end||isNaN(i.end.getDate()))&&(t=i.end)}),{min:e??new Date(NaN),max:t??new Date(NaN)}}const wv={class:"flow-run-timeline"},Ev={class:"flow-run-timeline__zoom-controls"},Sv=it.defineComponent({__name:"FlowRunTimeline",props:{graphData:null,isRunning:{type:Boolean}},setup(r){const e=r,t=it.ref(),i={defaultViewportPadding:40},n={timelineGuides:0,viewport:10,playhead:20};let s=it.ref(!0),a,o,h=new go,u=!1,l,f=it.ref(),c,d,p,v=new St,_=new Map;it.onMounted(async()=>{if(!t.value){console.error("Stage reference not found in initPixiApp");return}y(),a=pv(t.value),a.stage.sortableChildren=!0,o=await _v(t.value,a),o.zIndex=n.viewport,x(),w(),b(),T(),s.value=!1}),it.onBeforeUnmount(()=>{m()});function m(){d.destroy(),p==null||p.destroy(),v.removeChildren(),_.clear(),v.destroy(),a.destroy(!0)}function y(){var M;const C=Array.from(e.graphData).filter(O=>O.end).flatMap(({start:O,end:G})=>({start:O,end:G}));e.isRunning===!0&&C.push({start:new Date,end:new Date});const{min:N,max:H}=Tv(C);l=N,f.value=H,c=(M=t.value)!=null&&M.clientWidth?t.value.clientWidth*2:2e3}const g=it.computed(()=>{if(!f.value)return 0;const C=1e3*60,N=f.value.getTime()-l.getTime();return N<C?C:N});function b(){e.isRunning&&(p=new bv({playheadHeight:a.screen.height,viewportRef:o,xScale:A}),p.zIndex=n.playhead,a.stage.addChild(p),a.ticker.add(()=>{e.isRunning?(f.value=new Date,p==null||p.updatePosition()):p!=null&&p.destroyed||p==null||p.destroy()}))}function x(){var C;d=new xv({viewportRef:o,stageWidth:((C=t.value)==null?void 0:C.clientWidth)??1e3,guideHeight:a.screen.height,overallGraphWidth:c,xScale:A,dateScale:E,minimumStartDate:l,maximumEndDate:f.value??new Date}),d.zIndex=n.timelineGuides,a.stage.addChild(d),a.ticker.add(()=>{d.updateGuides()})}function T(){h.addAll(o.children),o.on("frame-end",()=>{(o.dirty||u)&&(h.cull(a.renderer.screen),o.dirty=!1,u=!1)})}function w(){e.graphData.forEach((C,N)=>{const H=new qa(C,A,N);_.set(C.id,{node:H,end:C.end,state:C.state}),v.addChild(H)}),o.addChild(v),o.ensureVisible(v.x-i.defaultViewportPadding,v.y-i.defaultViewportPadding,v.width+i.defaultViewportPadding*2,v.height+i.defaultViewportPadding*2,!0),o.moveCenter(v.x+v.width/2,v.y+v.height/2),e.isRunning&&a.ticker.add(()=>{e.isRunning&&_.forEach(C=>C.node.update())})}it.watchEffect(()=>{s.value||e.graphData.forEach(C=>{if(_.has(C.id)){const N=_.get(C.id);(N.end!==C.end||N.state!==C.state)&&N.node.update()}else{const N=new qa(C,A,_.size-1);v.addChild(N),u=!0}})});function A(C){return Math.ceil((C.getTime()-l.getTime())*(c/g.value))}function E(C){return Math.ceil(l.getTime()+C*(g.value/c))}function S(){o.zoom(400,!0)}function D(){o.zoom(-400,!0)}return(C,N)=>{const H=it.resolveComponent("p-button");return it.openBlock(),it.createElementBlock("div",wv,[it.createElementVNode("div",Ev,[it.createVNode(H,{icon:"MinusIcon",inset:"",rounded:"","aria-label":"Zoom out",onClick:S}),it.createVNode(H,{icon:"PlusIcon",inset:"",rounded:"","aria-label":"Zoom in",onClick:D})]),it.createElementVNode("div",{ref_key:"stage",ref:t,class:"flow-run-timeline__canvas-container"},null,512)])}}}),jv="";class It{constructor(e){this.parent=e,this.paused=!1}destroy(){}down(e){return!1}move(e){return!1}up(e){return!1}wheel(e){return!1}update(e){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var Pv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cv(r,e,t){return t={path:e,exports:{},require:function(i,n){return Rv(i,n??t.path)}},r(t,t.exports),t.exports}function Rv(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var $a=Cv(function(r,e){(function(){var t,i;i=function(n){return r.exports=n},t={linear:function(n,s,a,o){return a*n/o+s},easeInQuad:function(n,s,a,o){return a*(n/=o)*n+s},easeOutQuad:function(n,s,a,o){return-a*(n/=o)*(n-2)+s},easeInOutQuad:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n+s:-a/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,a,o){return a*(n/=o)*n*n+s},easeOutCubic:function(n,s,a,o){return a*((n=n/o-1)*n*n+1)+s},easeInOutCubic:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n*n+s:a/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,a,o){return a*(n/=o)*n*n*n+s},easeOutQuart:function(n,s,a,o){return-a*((n=n/o-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n*n*n+s:-a/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,a,o){return a*(n/=o)*n*n*n*n+s},easeOutQuint:function(n,s,a,o){return a*((n=n/o-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n*n*n*n+s:a/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,a,o){return-a*Math.cos(n/o*(Math.PI/2))+a+s},easeOutSine:function(n,s,a,o){return a*Math.sin(n/o*(Math.PI/2))+s},easeInOutSine:function(n,s,a,o){return-a/2*(Math.cos(Math.PI*n/o)-1)+s},easeInExpo:function(n,s,a,o){return n===0?s:a*Math.pow(2,10*(n/o-1))+s},easeOutExpo:function(n,s,a,o){return n===o?s+a:a*(-Math.pow(2,-10*n/o)+1)+s},easeInOutExpo:function(n,s,a,o){return(n/=o/2)<1?a/2*Math.pow(2,10*(n-1))+s:a/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,a,o){return-a*(Math.sqrt(1-(n/=o)*n)-1)+s},easeOutCirc:function(n,s,a,o){return a*Math.sqrt(1-(n=n/o-1)*n)+s},easeInOutCirc:function(n,s,a,o){return(n/=o/2)<1?-a/2*(Math.sqrt(1-n*n)-1)+s:a/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,a,o){var h,u,l;return l=1.70158,u=0,h=a,n===0||(n/=o),u||(u=o*.3),h<Math.abs(a)?(h=a,l=u/4):l=u/(2*Math.PI)*Math.asin(a/h),-(h*Math.pow(2,10*(n-=1))*Math.sin((n*o-l)*(2*Math.PI)/u))+s},easeOutElastic:function(n,s,a,o){var h,u,l;return l=1.70158,u=0,h=a,n===0||(n/=o),u||(u=o*.3),h<Math.abs(a)?(h=a,l=u/4):l=u/(2*Math.PI)*Math.asin(a/h),h*Math.pow(2,-10*n)*Math.sin((n*o-l)*(2*Math.PI)/u)+a+s},easeInOutElastic:function(n,s,a,o){var h,u,l;return l=1.70158,u=0,h=a,n===0||(n/=o/2),u||(u=o*(.3*1.5)),h<Math.abs(a)?(h=a,l=u/4):l=u/(2*Math.PI)*Math.asin(a/h),n<1?-.5*(h*Math.pow(2,10*(n-=1))*Math.sin((n*o-l)*(2*Math.PI)/u))+s:h*Math.pow(2,-10*(n-=1))*Math.sin((n*o-l)*(2*Math.PI)/u)*.5+a+s},easeInBack:function(n,s,a,o,h){return h===void 0&&(h=1.70158),a*(n/=o)*n*((h+1)*n-h)+s},easeOutBack:function(n,s,a,o,h){return h===void 0&&(h=1.70158),a*((n=n/o-1)*n*((h+1)*n+h)+1)+s},easeInOutBack:function(n,s,a,o,h){return h===void 0&&(h=1.70158),(n/=o/2)<1?a/2*(n*n*(((h*=1.525)+1)*n-h))+s:a/2*((n-=2)*n*(((h*=1.525)+1)*n+h)+2)+s},easeInBounce:function(n,s,a,o){var h;return h=t.easeOutBounce(o-n,0,a,o),a-h+s},easeOutBounce:function(n,s,a,o){return(n/=o)<1/2.75?a*(7.5625*n*n)+s:n<2/2.75?a*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?a*(7.5625*(n-=2.25/2.75)*n+.9375)+s:a*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,a,o){var h;return n<o/2?(h=t.easeInBounce(n*2,0,a,o),h*.5+s):(h=t.easeOutBounce(n*2-o,0,a,o),h*.5+a*.5+s)}},i(t)}).call(Pv)});function sr(r,e){if(r){if(typeof r=="function")return r;if(typeof r=="string")return $a[r]}else return $a[e]}const Av={removeOnInterrupt:!1,ease:"linear",time:1e3};class qt extends It{__init(){this.startWidth=null}__init2(){this.startHeight=null}__init3(){this.deltaWidth=null}__init4(){this.deltaHeight=null}__init5(){this.width=null}__init6(){this.height=null}__init7(){this.time=0}constructor(e,t={}){super(e),qt.prototype.__init.call(this),qt.prototype.__init2.call(this),qt.prototype.__init3.call(this),qt.prototype.__init4.call(this),qt.prototype.__init5.call(this),qt.prototype.__init6.call(this),qt.prototype.__init7.call(this),this.options=Object.assign({},Av,t),this.options.ease=sr(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(e){if(this.paused)return;this.time+=e;const t=new W(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,n=this.parent.height;this.complete(),(i!==this.parent.width||n!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:t,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const n=this.startWidth,s=this.deltaWidth;this.parent.fitWidth(n+s*i,this.keepCenter,this.height===null)}if(this.height!==null){const n=this.startHeight,s=this.deltaHeight;this.parent.fitHeight(n+s*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const n=this.startX,s=this.startY,a=this.deltaX,o=this.deltaY,h=new W(this.parent.x,this.parent.y);this.parent.moveCenter(n+a*i,s+o*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:t,type:"animate"})}}}function ar(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...a)=>t.call(e,...a)),e=void 0)}return t}const Iv={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class Za extends It{constructor(e,t={}){super(e),this.options=Object.assign({},Iv,t),this.ease=sr(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(e){if(!this.paused){if(this.bounce(),this.toX){const t=this.toX;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),t.time>=this.options.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.options.time)}if(this.toY){const t=this.toY;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),t.time>=this.options.time?(this.parent.y=t.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(t.time,t.start,t.delta,this.options.time)}}}calcUnderflowX(){let e;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}calcUnderflowY(){let e;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}oob(){const e=this.options.bounceBox;if(e){const t=typeof e.x>"u"?0:e.x,i=typeof e.y>"u"?0:e.y,n=typeof e.width>"u"?this.parent.worldWidth:e.width,s=typeof e.height>"u"?this.parent.worldHeight:e.height;return{left:this.parent.left<t,right:this.parent.right>n,top:this.parent.top<i,bottom:this.parent.bottom>s,topLeft:new W(t*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new W(n*this.parent.scale.x-this.parent.screenWidth,s*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new W(0,0),bottomRight:new W(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){if(this.paused)return;let e,t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.x&&t.percentChangeX===ar([t,"access",s=>s.options,"optionalAccess",s=>s.friction])||t.y&&t.percentChangeY===ar([t,"access",s=>s.options,"optionalAccess",s=>s.friction]))&&(e=this.oob(),(e.left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.options.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.options.friction));const i=this.parent.plugins.get("drag",!0)||{},n=this.parent.plugins.get("pinch",!0)||{};if(t=t||{},!ar([i,"optionalAccess",s=>s.active])&&!ar([n,"optionalAccess",s=>s.active])&&(!this.toX||!this.toY)&&(!t.x||!t.y)){e=e||this.oob();const s=e.topLeft,a=e.bottomRight;if(!this.toX&&!t.x){let o=null;e.left&&this.left?o=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-s.x:e.right&&this.right&&(o=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x),o!==null&&this.parent.x!==o&&(this.toX={time:0,start:this.parent.x,delta:o-this.parent.x,end:o},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!t.y){let o=null;e.top&&this.top?o=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-s.y:e.bottom&&this.bottom&&(o=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y),o!==null&&this.parent.y!==o&&(this.toY={time:0,start:this.parent.y,delta:o-this.parent.y,end:o},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const Ov={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class Ka extends It{constructor(e,t={}){super(e),this.options=Object.assign({},Ov,t),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="none"?this.noUnderflow=!0:e==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=e.indexOf("left")!==-1?-1:e.indexOf("right")!==-1?1:0,this.underflowY=e.indexOf("top")!==-1?-1:e.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const e={x:this.parent.x,y:this.parent.y},t=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,t.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,t.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,t.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,t.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const Mv={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class Qa extends It{constructor(e,t={}){super(e),this.options=Object.assign({},Mv,t),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&e<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&e>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&t<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&t>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const e={x:null,y:null},t={x:null,y:null};if(typeof this.options.minScale=="number")e.x=this.options.minScale,e.y=this.options.minScale;else if(this.options.minScale!==null){const s=this.options.minScale;e.x=typeof s.x>"u"?null:s.x,e.y=typeof s.y>"u"?null:s.y}if(typeof this.options.maxScale=="number")t.x=this.options.maxScale,t.y=this.options.maxScale;else if(this.options.maxScale!==null){const s=this.options.maxScale;t.x=typeof s.x>"u"?null:s.x,t.y=typeof s.y>"u"?null:s.y}let i=this.parent.scale.x,n=this.parent.scale.y;e.x!==null&&i<e.x&&(i=e.x),t.x!==null&&i>t.x&&(i=t.x),e.y!==null&&n<e.y&&(n=e.y),t.y!==null&&n>t.y&&(n=t.y),(i!==this.parent.scale.x||n!==this.parent.scale.y)&&(this.parent.scale.set(i,n),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const Dv={friction:.98,bounce:.8,minSpeed:.01},le=16;class Ja extends It{constructor(e,t={}){super(e),this.options=Object.assign({},Dv,t),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.moved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const e=this.parent.input.count();return(e===1||e>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}moved(e){if(this.saved.length){const t=this.saved[this.saved.length-1];e.type==="clamp-x"?t.x===e.original.x&&(t.x=this.parent.x):e.type==="clamp-y"&&t.y===e.original.y&&(t.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const e=performance.now();for(const t of this.saved)if(t.time>=e-100){const i=e-t.time;this.x=(this.parent.x-t.x)/i,this.y=(this.parent.y-t.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(e){e=e||{},typeof e.x<"u"&&(this.x=e.x,this.percentChangeX=this.options.friction),typeof e.y<"u"&&(this.y=e.y,this.percentChangeY=this.options.friction)}update(e){if(this.paused)return;const t=this.x||this.y,i=this.timeSinceRelease,n=this.timeSinceRelease+e;if(this.x){const s=this.percentChangeX,a=Math.log(s);this.parent.x+=this.x*le/a*(Math.pow(s,n/le)-Math.pow(s,i/le)),this.x*=Math.pow(this.percentChangeX,e/le)}if(this.y){const s=this.percentChangeY,a=Math.log(s);this.parent.y+=this.y*le/a*(Math.pow(s,n/le)-Math.pow(s,i/le)),this.y*=Math.pow(this.percentChangeY,e/le)}this.timeSinceRelease+=e,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),t&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const Fv={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class or extends It{__init(){this.windowEventHandlers=new Array}constructor(e,t={}){super(e),or.prototype.__init.call(this),this.options=Object.assign({},Fv,t),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){const t=n=>{e.includes(n.code)&&(this.keyIsPressed=!0)},i=n=>{e.includes(n.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",t)}addWindowEventHandler(e,t){window.addEventListener(e,t),this.windowEventHandlers.push({event:e,handler:t})}destroy(){this.windowEventHandlers.forEach(({event:e,handler:t})=>{window.removeEventListener(e,t)})}mouseButtons(e){!e||e==="all"?this.mouse=[!0,!0,!0]:this.mouse=[e.indexOf("left")!==-1,e.indexOf("middle")!==-1,e.indexOf("right")!==-1]}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="center"?(this.underflowX=0,this.underflowY=0):(e.includes("left")?this.underflowX=-1:e.includes("right")?this.underflowX=1:this.underflowX=0,e.includes("top")?this.underflowY=-1:e.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(e){const t=e.data.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!t||this.mouse[e.data.button]))}checkKeyPress(e){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&e.data.pointerType==="touch"}down(e){return this.paused||!this.options.pressDrag?!1:this.checkButtons(e)&&this.checkKeyPress(e)?(this.last={x:e.data.global.x,y:e.data.global.y},this.current=e.data.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(e){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===e.data.pointerId){const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.count();if(n===1||n>1&&!this.parent.plugins.get("pinch",!0)){const s=t-this.last.x,a=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(s)||this.yDirection&&this.parent.input.checkThreshold(a)){const o={x:t,y:i};return this.xDirection&&(this.parent.x+=(o.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(o.y-this.last.y)*this.options.factor),this.last=o,this.moved||this.parent.emit("drag-start",{event:e,screen:new W(this.last.x,this.last.y),world:this.parent.toWorld(new W(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(e){if(this.paused)return!1;const t=this.parent.input.touches;if(t.length===1){const i=t[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new W(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:e,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(e){if(this.paused)return!1;if(this.options.wheel){const t=this.parent.plugins.get("wheel",!0);if(!t||!t.options.wheelZoom&&!e.ctrlKey){const i=e.deltaMode?this.options.lineHeight:1,n=[e.deltaX,e.deltaY],[s,a]=this.options.wheelSwapAxes?n.reverse():n;return this.xDirection&&(this.parent.x+=s*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=a*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||e.preventDefault(),this.parent.options.stopPropagation&&e.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const e=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,e.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,e.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}}const Nv={speed:0,acceleration:null,radius:null};class to extends It{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},Nv,i),this.velocity={x:0,y:0}}update(e){if(this.paused)return;const t=this.parent.center;let i=this.target.x,n=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-t.y,2)+Math.pow(this.target.x-t.x,2))>this.options.radius){const h=Math.atan2(this.target.y-t.y,this.target.x-t.x);i=this.target.x-Math.cos(h)*this.options.radius,n=this.target.y-Math.sin(h)*this.options.radius}else return;const s=i-t.x,a=n-t.y;if(s||a)if(this.options.speed)if(this.options.acceleration){const o=Math.atan2(n-t.y,i-t.x),h=Math.sqrt(Math.pow(s,2)+Math.pow(a,2));if(h){const u=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>u?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*e,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*e,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const l=Math.cos(o)*this.velocity.x,f=Math.sin(o)*this.velocity.y,c=Math.abs(l)>Math.abs(s)?i:t.x+l,d=Math.abs(f)>Math.abs(a)?n:t.y+f;this.parent.moveCenter(c,d),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const o=Math.atan2(n-t.y,i-t.x),h=Math.cos(o)*this.options.speed,u=Math.sin(o)*this.options.speed,l=Math.abs(h)>Math.abs(s)?i:t.x+h,f=Math.abs(u)>Math.abs(a)?n:t.y+u;this.parent.moveCenter(l,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const Bv={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class eo extends It{constructor(e,t={}){super(e),this.options=Object.assign({},Bv,t),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const e=this.options.distance;e!==null?(this.left=e,this.top=e,this.right=this.parent.screenWidth-e,this.bottom=this.parent.screenHeight-e):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(e){if(this.paused||e.data.pointerType!=="mouse"&&e.data.identifier!==1||!this.options.allowButtons&&e.data.buttons!==0)return!1;const t=e.data.global.x,i=e.data.global.y;if(this.radiusSquared){const n=this.parent.toScreen(this.parent.center);if(Math.pow(n.x-t,2)+Math.pow(n.y-i,2)>=this.radiusSquared){const a=Math.atan2(n.y-i,n.x-t);this.options.linear?(this.horizontal=Math.round(Math.cos(a))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(a))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(a)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(a)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&t<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&t>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const e=this.parent.plugins.get("decelerate",!0);this.horizontal&&e&&!this.options.noDecelerate&&e.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const e=this.parent.plugins.get("decelerate",!0);this.vertical&&e&&!this.options.noDecelerate&&e.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const e=this.parent.center;this.horizontal&&(e.x+=this.horizontal*this.options.speed),this.vertical&&(e.y+=this.vertical*this.options.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const Lv={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class He extends It{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),this.options=Object.assign({},Lv,t)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(e){if(this.paused||!this.active)return!1;const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.touches;if(n.length>=2){const s=n[0],a=n[1],o=s.last&&a.last?Math.sqrt(Math.pow(a.last.x-s.last.x,2)+Math.pow(a.last.y-s.last.y,2)):null;if(s.id===e.data.pointerId?s.last={x:t,y:i,data:e.data}:a.id===e.data.pointerId&&(a.last={x:t,y:i,data:e.data}),o){let h;const u={x:s.last.x+(a.last.x-s.last.x)/2,y:s.last.y+(a.last.y-s.last.y)/2};this.options.center||(h=this.parent.toLocal(u));let l=Math.sqrt(Math.pow(a.last.x-s.last.x,2)+Math.pow(a.last.y-s.last.y,2));l=l===0?l=1e-10:l;const f=(1-o/l)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=f),this.isAxisY()&&(this.parent.scale.y+=f),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:u});const c=this.parent.plugins.get("clamp-zoom",!0);if(c&&c.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const d=this.parent.toGlobal(h);this.parent.x+=(u.x-d.x)*this.options.factor,this.parent.y+=(u.y-d.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(u.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(u.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=u,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const Uv={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class io extends It{constructor(e,t,i,n={}){super(e),this.options=Object.assign({},Uv,n),this.ease=sr(n.ease,"easeInOutSine"),this.x=t,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const e=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-e.x,this.deltaY=this.y-e.y,this.startX=e.x,this.startY=e.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const e=this.parent.plugins.get("decelerate",!0);e&&(e.x||e.y)&&(e.percentChangeX=e.percentChangeY=this.options.friction)}return!1}update(e){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const t=this.snapping;t.time+=e;let i,n,s;const a=this.startX,o=this.startY,h=this.deltaX,u=this.deltaY;if(t.time>this.options.time)i=!0,n=a+h,s=o+u;else{const l=this.ease(t.time,0,1,this.options.time);n=a+h*l,s=o+u*l}this.options.topLeft?this.parent.moveCorner(n,s):this.parent.moveCenter(n,s),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const t=this.options.topLeft?this.parent.corner:this.parent.center;(t.x!==this.x||t.y!==this.y)&&this.snapStart()}}}const Gv={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class ro extends It{constructor(e,t={}){super(e),this.options=Object.assign({},Gv,t),this.ease=sr(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=e.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=e.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(e.container.scale.x=this.xScale,e.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):t.forceStart&&this.createSnapping()}createSnapping(){const e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,n=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:e,startY:t,deltaX:i-e,deltaY:n-t},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(e){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let t;if(!this.options.center&&!this.options.noMove&&(t=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=e,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const s=this.snapping,a=this.ease(s.time,s.startX,s.deltaX,this.options.time),o=this.ease(s.time,s.startY,s.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/a,this.parent.scale.y=this.parent.screenHeight/o}const n=this.parent.plugins.get("clamp-zoom",!0);n&&n.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(t))}}resume(){this.snapping=null,super.resume()}}const kv={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class no extends It{constructor(e,t={}){super(e),this.options=Object.assign({},kv,t),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){window.addEventListener("keydown",t=>{e.includes(t.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",t=>{e.includes(t.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const e=this.smoothingCenter,t=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x+=t.x),this.isAxisY()&&(this.parent.scale.y+=t.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const n=this.parent.plugins.get("clamp-zoom",!0);if(n&&n.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const s=this.parent.toGlobal(i);this.parent.x+=e.x-s.x,this.parent.y+=e.y-s.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(e){if(this.paused)return;const t=this.parent.input.getPointerPosition(e),i=-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/200,n=Math.pow(2,(1+this.options.percent)*i);let s;this.options.center||(s=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=n),this.isAxisY()&&(this.parent.scale.y*=n),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const a=this.parent.plugins.get("clamp-zoom",!0);if(a&&a.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const o=this.parent.toGlobal(s);this.parent.x+=t.x-o.x,this.parent.y+=t.y-o.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}wheel(e){if(this.paused||!this.checkKeyPress())return!1;if(e.ctrlKey&&this.options.trackpadPinch)this.pinch(e);else if(this.options.wheelZoom){const t=this.parent.input.getPointerPosition(e),n=(this.options.reverse?-1:1)*-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*n);if(this.options.smooth){const a={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+a.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+a.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=t}else{let a;this.options.center||(a=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const h=this.parent.toGlobal(a);this.parent.x+=t.x-h.x,this.parent.y+=t.y-h.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}return!this.parent.options.passiveWheel}}class so{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new z(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.on("pointerout",this.up,this),this.wheelFunction=e=>this.handleWheel(e),this.viewport.options.divWheel.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.divWheel.removeEventListener("wheel",this.wheelFunction)}down(e){if(this.viewport.pause||!this.viewport.worldVisible)return;if(e.data.pointerType==="mouse"?this.isMouseDown=!0:this.get(e.data.pointerId)||this.touches.push({id:e.data.pointerId,last:null}),this.count()===1){this.last=e.data.global.clone();const i=this.viewport.plugins.get("decelerate",!0),n=this.viewport.plugins.get("bounce",!0);(!i||!i.isActive())&&(!n||!n.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(e)&&this.viewport.options.stopPropagation&&e.stopPropagation()}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(e){return Math.abs(e)>=this.viewport.threshold}move(e){if(this.viewport.pause||!this.viewport.worldVisible)return;const t=this.viewport.plugins.move(e);if(this.clickedAvailable&&this.last){const i=e.data.global.x-this.last.x,n=e.data.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(n))&&(this.clickedAvailable=!1)}t&&this.viewport.options.stopPropagation&&e.stopPropagation()}up(e){if(this.viewport.pause||!this.viewport.worldVisible)return;e.data.pointerType==="mouse"&&(this.isMouseDown=!1),e.data.pointerType!=="mouse"&&this.remove(e.data.pointerId);const t=this.viewport.plugins.up(e);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:e,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this}),this.clickedAvailable=!1),t&&this.viewport.options.stopPropagation&&e.stopPropagation()}getPointerPosition(e){const t=new W;if(this.viewport.options.interaction)this.viewport.options.interaction.mapPositionToPoint(t,e.clientX,e.clientY);else if(this.viewport.options.useDivWheelForInputManager&&this.viewport.options.divWheel){const i=this.viewport.options.divWheel.getBoundingClientRect();t.x=e.clientX-i.left,t.y=e.clientY-i.top}else t.x=e.clientX,t.y=e.clientY;return t}handleWheel(e){if(this.viewport.pause||!this.viewport.worldVisible||this.viewport.options.interaction&&this.viewport.options.interaction.interactionDOMElement!==e.target)return;const t=this.viewport.toLocal(this.getPointerPosition(e));this.viewport.left<=t.x&&t.x<=this.viewport.right&&this.viewport.top<=t.y&&t.y<=this.viewport.bottom&&this.viewport.plugins.wheel(e)&&!this.viewport.options.passiveWheel&&e.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(e){for(const t of this.touches)if(t.id===e)return t;return null}remove(e){for(let t=0;t<this.touches.length;t++)if(this.touches[t].id===e){this.touches.splice(t,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}function hr(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...a)=>t.call(e,...a)),e=void 0)}return t}const vi=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class ao{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=vi.length){const n=this.plugins[e];n&&n.destroy(),this.plugins[e]=t;const s=vi.indexOf(e);s!==-1&&vi.splice(s,1),vi.splice(i,0,e),this.sort()}get(e,t){return t&&hr([this,"access",i=>i.plugins,"access",i=>i[e],"optionalAccess",i=>i.paused])?null:this.plugins[e]}update(e){for(const t of this.list)t.update(e)}resize(){for(const e of this.list)e.resize()}reset(){for(const e of this.list)e.reset()}removeAll(){this.list.forEach(e=>{e.destroy()}),this.plugins={},this.sort()}remove(e){this.plugins[e]&&(hr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.destroy,"call",t=>t()]),delete this.plugins[e],this.viewport.emit(`${e}-remove`),this.sort())}pause(e){hr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.pause,"call",t=>t()])}resume(e){hr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.resume,"call",t=>t()])}sort(){this.list=[];for(const e of vi)this.plugins[e]&&this.list.push(this.plugins[e])}down(e){let t=!1;for(const i of this.list)i.down(e)&&(t=!0);return t}move(e){let t=!1;for(const i of this.viewport.plugins.list)i.move(e)&&(t=!0);return t}up(e){let t=!1;for(const i of this.list)i.up(e)&&(t=!0);return t}wheel(e){let t=!1;for(const i of this.list)i.wheel(e)&&(t=!0);return t}}const Hv={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,interaction:null,disableOnContextMenu:!1,ticker:bt.shared};class Gn extends St{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Gn.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},Hv,e),this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.divWheel=this.options.divWheel||document.body,this.options.disableOnContextMenu&&this.options.divWheel.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new so(this),this.plugins=new ao(this)}destroy(e){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.divWheel.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(e)}update(e){this.pause||(this.plugins.update(e),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new z(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(e=window.innerWidth,t=window.innerHeight,i,n){this.screenWidth=e,this.screenHeight=t,typeof i<"u"&&(this._worldWidth=i),typeof n<"u"&&(this._worldHeight=n),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(e){this._worldWidth=e,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(e){this._worldHeight=e,this.plugins.resize()}getVisibleBounds(){return new z(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,t){return arguments.length===2?this.toLocal(new W(e,t)):this.toLocal(e)}toScreen(e,t){return arguments.length===2?this.toGlobal(new W(e,t)):this.toGlobal(e)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new W(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(e){this.moveCenter(e)}moveCenter(...e){let t,i;typeof e[0]=="number"?(t=e[0],i=e[1]):(t=e[0].x,i=e[0].y);const n=(this.worldScreenWidth/2-t)*this.scale.x,s=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==n||this.y!==s)&&(this.position.set(n,s),this.plugins.reset(),this.dirty=!0),this}get corner(){return new W(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(e){this.moveCorner(e)}moveCorner(...e){let t,i;return e.length===1?(t=-e[0].x*this.scale.x,i=-e[0].y*this.scale.y):(t=-e[0]*this.scale.x,i=-e[1]*this.scale.y),(t!==this.x||i!==this.y)&&(this.position.set(t,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(e){return this.screenWidth/e}findFitHeight(e){return this.screenHeight/e}findFit(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.min(i,n)}findCover(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.max(i,n)}fitWidth(e=this.worldWidth,t,i=!0,n){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,i&&(this.scale.y=this.scale.x);const a=this.plugins.get("clamp-zoom",!0);return!n&&a&&a.clamp(),t&&s&&this.moveCenter(s),this}fitHeight(e=this.worldHeight,t,i=!0,n){let s;t&&(s=this.center),this.scale.y=this.screenHeight/e,i&&(this.scale.x=this.scale.y);const a=this.plugins.get("clamp-zoom",!0);return!n&&a&&a.clamp(),t&&s&&this.moveCenter(s),this}fitWorld(e){let t;e&&(t=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),e&&t&&this.moveCenter(t),this}fit(e,t=this.worldWidth,i=this.worldHeight){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&n&&this.moveCenter(n),this}setZoom(e,t){let i;t&&(i=this.center),this.scale.set(e);const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&i&&this.moveCenter(i),this}zoomPercent(e,t){return this.setZoom(this.scale.x+this.scale.x*e,t)}zoom(e,t){return this.fitWidth(e+this.worldScreenWidth,t),this}get scaled(){return this.scale.x}set scaled(e){this.setZoom(e,!0)}snapZoom(e){return this.plugins.add("snap-zoom",new ro(this,e)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new W(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(e){this.x=-e*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(e){this.x=-e*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(e){this.y=-e*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(e){this.y=-e*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(e){this._dirty=e}get forceHitArea(){return this._forceHitArea}set forceHitArea(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=null,this.hitArea=new z(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new or(this,e)),this}clamp(e){return this.plugins.add("clamp",new Ka(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new Ja(this,e)),this}bounce(e){return this.plugins.add("bounce",new Za(this,e)),this}pinch(e){return this.plugins.add("pinch",new He(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new io(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new to(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new no(this,e)),this}animate(e){return this.plugins.add("animate",new qt(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new Qa(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new eo(this,e)),this}get pause(){return!!this._pause}set pause(e){this._pause=e,this.lastViewport=null,this.moving=!1,this.zooming=!1,e&&this.input.pause()}ensureVisible(e,t,i,n,s){s&&(i>this.worldScreenWidth||n>this.worldScreenHeight)&&(this.fit(!0,i,n),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let a=!1;e<this.left?(this.left=e,a=!0):e+i>this.right&&(this.right=e+i,a=!0),t<this.top?(this.top=t,a=!0):t+n>this.bottom&&(this.bottom=t+n,a=!0),a&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}const Xv=Object.freeze(Object.defineProperty({__proto__:null,Animate:qt,Bounce:Za,Clamp:Ka,ClampZoom:Qa,Decelerate:Ja,Drag:or,Follow:to,InputManager:so,MouseEdges:eo,Pinch:He,Plugin:It,PluginManager:ao,Snap:io,SnapZoom:ro,Viewport:Gn,Wheel:no},Symbol.toStringTag,{value:"Module"}));Rt.FlowRunTimeline=Sv,Object.defineProperty(Rt,Symbol.toStringTag,{value:"Module"})});
1056
+ `;(function(r){av(e,r);function e(t,i){t===void 0&&(t=.5),i===void 0&&(i=Math.random());var n=r.call(this,Js,ov,{uNoise:0,uSeed:0})||this;return n.noise=t,n.seed=i,n}return Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e})(oe);var Wa=new gt;pt.prototype._cacheAsBitmap=!1,pt.prototype._cacheData=null,pt.prototype._cacheAsBitmapResolution=null,pt.prototype._cacheAsBitmapMultisample=ft.NONE;var hv=function(){function r(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}return r}();Object.defineProperties(pt.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(r){if(this._cacheAsBitmap!==r){this._cacheAsBitmap=r;var e;r?(this._cacheData||(this._cacheData=new hv),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}}),pt.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},pt.prototype._initCachedDisplayObject=function(e){var t;if(!(this._cacheData&&this._cacheData.sprite)){var i=this.alpha;this.alpha=1,e.batch.flush();var n=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var s=this.filters[0].padding;n.pad(s)}n.ceil(F.RESOLUTION);var a=e.renderTexture.current,o=e.renderTexture.sourceFrame.clone(),h=e.renderTexture.destinationFrame.clone(),u=e.projection.transform,l=Te.create({width:n.width,height:n.height,resolution:this.cacheAsBitmapResolution||e.resolution,multisample:(t=this.cacheAsBitmapMultisample)!==null&&t!==void 0?t:e.multisample}),f="cacheAsBitmap_"+xe();this._cacheData.textureCacheId=f,V.addToCache(l.baseTexture,f),k.addToCache(l,f);var c=this.transform.localTransform.copyTo(Wa).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,e.render(this,{renderTexture:l,clear:!0,transform:c,skipUpdateTransform:!1}),e.framebuffer.blit(),e.projection.transform=u,e.renderTexture.bind(a,o,h),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var d=new fi(l);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(n.x/n.width),d.anchor.y=-(n.y/n.height),d.alpha=i,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},pt.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},pt.prototype._initCachedDisplayObjectCanvas=function(e){if(!(this._cacheData&&this._cacheData.sprite)){var t=this.getLocalBounds(null,!0),i=this.alpha;this.alpha=1;var n=e.context,s=e._projTransform;t.ceil(F.RESOLUTION);var a=Te.create({width:t.width,height:t.height}),o="cacheAsBitmap_"+xe();this._cacheData.textureCacheId=o,V.addToCache(a.baseTexture,o),k.addToCache(a,o);var h=Wa;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),e.context=n,e._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;var u=new fi(a);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(t.x/t.width),u.anchor.y=-(t.y/t.height),u.alpha=i,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)}},pt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},pt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},pt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,V.removeFromCache(this._cacheData.textureCacheId),k.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},pt.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)};pt.prototype.name=null,Pt.prototype.getChildByName=function(e,t){for(var i=0,n=this.children.length;i<n;i++)if(this.children[i].name===e)return this.children[i];if(t)for(var i=0,n=this.children.length;i<n;i++){var s=this.children[i];if(s.getChildByName){var a=s.getChildByName(e,!0);if(a)return a}}return null};pt.prototype.getGlobalPosition=function(e,t){return e===void 0&&(e=new X),t===void 0&&(t=!1),this.parent?this.parent.toGlobal(this.position,e,t):(e.x=this.position.x,e.y=this.position.y),e};var uv=function(){function r(){}return r.init=function(e){var t=this;Object.defineProperty(this,"resizeTo",{set:function(i){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=i,i&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){t._resizeTo&&(t.cancelResize(),t._resizeId=requestAnimationFrame(function(){return t.resize()}))},this.cancelResize=function(){t._resizeId&&(cancelAnimationFrame(t._resizeId),t._resizeId=null)},this.resize=function(){if(t._resizeTo){t.cancelResize();var i,n;if(t._resizeTo===globalThis.window)i=globalThis.innerWidth,n=globalThis.innerHeight;else{var s=t._resizeTo,a=s.clientWidth,o=s.clientHeight;i=a,n=o}t.renderer.resize(i,n)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null},r.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},r.extension=tt.Application,r}(),ja=function(){function r(e){var t=this;this.stage=new Pt,e=Object.assign({forceCanvas:!1},e),this.renderer=Uc(e),r._plugins.forEach(function(i){i.init.call(t,e)})}return r.registerPlugin=function(e){Ut("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),ee.add({type:tt.Application,ref:e})},r.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(r.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),r.prototype.destroy=function(e,t){var i=this,n=r._plugins.slice(0);n.reverse(),n.forEach(function(s){s.destroy.call(i)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null},r._plugins=[],r}();ee.handleByList(tt.Application,ja._plugins),ee.add(uv);var Bn=function(r,e){return Bn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Bn(r,e)};function Xe(r,e){Bn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var lv=function(r){Xe(e,r);function e(t,i,n,s){t===void 0&&(t=100),i===void 0&&(i=100),n===void 0&&(n=10),s===void 0&&(s=10);var a=r.call(this)||this;return a.segWidth=n,a.segHeight=s,a.width=t,a.height=i,a.build(),a}return e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,i=[],n=[],s=[],a=this.segWidth-1,o=this.segHeight-1,h=this.width/a,u=this.height/o,l=0;l<t;l++){var f=l%this.segWidth,c=l/this.segWidth|0;i.push(f*h,c*u),n.push(f/a,c/o)}for(var d=a*o,l=0;l<d;l++){var p=l%a,v=l/a|0,_=v*this.segWidth+p,m=v*this.segWidth+p+1,g=(v+1)*this.segWidth+p,y=(v+1)*this.segWidth+p+1;s.push(_,m,g,m,y,g)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint16Array(s),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(rr),fv=function(r){Xe(e,r);function e(t,i,n){t===void 0&&(t=200),n===void 0&&(n=0);var s=r.call(this,new Float32Array(i.length*4),new Float32Array(i.length*4),new Uint16Array((i.length-1)*6))||this;return s.points=i,s._width=t,s.textureScale=n,s.build(),s}return Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var i=this.getBuffer("aVertexPosition"),n=this.getBuffer("aTextureCoord"),s=this.getIndex();if(!(t.length<1)){i.data.length/4!==t.length&&(i.data=new Float32Array(t.length*4),n.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));var a=n.data,o=s.data;a[0]=0,a[1]=0,a[2]=0,a[3]=1;for(var h=0,u=t[0],l=this._width*this.textureScale,f=t.length,c=0;c<f;c++){var d=c*4;if(this.textureScale>0){var p=u.x-t[c].x,v=u.y-t[c].y,_=Math.sqrt(p*p+v*v);u=t[c],h+=_/l}else h=c/(f-1);a[d]=h,a[d+1]=0,a[d+2]=h,a[d+3]=1}for(var m=0,c=0;c<f-1;c++){var d=c*2;o[m++]=d,o[m++]=d+1,o[m++]=d+2,o[m++]=d+2,o[m++]=d+1,o[m++]=d+3}n.update(),s.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var i=t[0],n,s=0,a=0,o=this.buffers[0].data,h=t.length,u=0;u<h;u++){var l=t[u],f=u*4;u<t.length-1?n=t[u+1]:n=l,a=-(n.x-i.x),s=n.y-i.y;var c=Math.sqrt(s*s+a*a),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;s/=c,a/=c,s*=d,a*=d,o[f]=l.x+s,o[f+1]=l.y+a,o[f+2]=l.x-s,o[f+3]=l.y-a,i=l}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(rr);(function(r){Xe(e,r);function e(t,i,n){n===void 0&&(n=0);var s=this,a=new fv(t.height,i,n),o=new vi(t);return n>0&&(t.baseTexture.wrapMode=zt.REPEAT),s=r.call(this,a,o)||this,s.autoUpdate=!0,s}return e.prototype._render=function(t){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),r.prototype._render.call(this,t)},e})(pi);var cv=function(r){Xe(e,r);function e(t,i,n){var s=this,a=new lv(t.width,t.height,i,n),o=new vi(k.WHITE);return s=r.call(this,a,o)||this,s.texture=t,s.autoResize=!0,s}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,i=this.shader.texture,n=i.width,s=i.height;this.autoResize&&(t.width!==n||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),r.prototype._render.call(this,t)},e.prototype.destroy=function(t){this.shader.texture.off("update",this.textureUpdated,this),r.prototype.destroy.call(this,t)},e}(pi);(function(r){Xe(e,r);function e(t,i,n,s,a){t===void 0&&(t=k.EMPTY);var o=this,h=new rr(i,n,s);h.getBuffer("aVertexPosition").static=!1;var u=new vi(t);return o=r.call(this,h,u,null,a)||this,o.autoUpdate=!0,o}return Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),r.prototype._render.call(this,t)},e})(pi);var ar=10;(function(r){Xe(e,r);function e(t,i,n,s,a){i===void 0&&(i=ar),n===void 0&&(n=ar),s===void 0&&(s=ar),a===void 0&&(a=ar);var o=r.call(this,k.WHITE,4,4)||this;return o._origWidth=t.orig.width,o._origHeight=t.orig.height,o._width=o._origWidth,o._height=o._origHeight,o._leftWidth=i,o._rightWidth=s,o._topHeight=n,o._bottomHeight=a,o.texture=t,o}return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,i=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*i,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*i,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,i=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*i,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*i,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,i=this._width>t?1:this._width/t,n=this._topHeight+this._bottomHeight,s=this._height>n?1:this._height/n,a=Math.min(i,s);return a},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,i=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var n=1/this._origWidth,s=1/this._origHeight;i[0]=i[8]=i[16]=i[24]=0,i[1]=i[3]=i[5]=i[7]=0,i[6]=i[14]=i[22]=i[30]=1,i[25]=i[27]=i[29]=i[31]=1,i[2]=i[10]=i[18]=i[26]=n*this._leftWidth,i[4]=i[12]=i[20]=i[28]=1-n*this._rightWidth,i[9]=i[11]=i[13]=i[15]=s*this._topHeight,i[17]=i[19]=i[21]=i[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e})(cv);var Ln=function(r,e){return Ln=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Ln(r,e)};function dv(r,e){Ln(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){dv(e,r);function e(t,i){i===void 0&&(i=!0);var n=r.call(this,t[0]instanceof k?t[0]:t[0].texture)||this;return n._textures=null,n._durations=null,n._autoUpdate=i,n._isConnectedToTicker=!1,n.animationSpeed=1,n.loop=!0,n.updateAnchor=!1,n.onComplete=null,n.onFrameChange=null,n.onLoop=null,n._currentTime=0,n._playing=!1,n._previousFrame=null,n.textures=t,n}return e.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Tt.shared.add(this.update,this,$t.HIGH),this._isConnectedToTicker=!0))},e.prototype.gotoAndStop=function(t){this.stop();var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture()},e.prototype.gotoAndPlay=function(t){var i=this.currentFrame;this._currentTime=t,i!==this.currentFrame&&this.updateTexture(),this.play()},e.prototype.update=function(t){if(this._playing){var i=this.animationSpeed*t,n=this.currentFrame;if(this._durations!==null){var s=this._currentTime%1*this._durations[this.currentFrame];for(s+=i/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];var a=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n?this.onLoop():this.animationSpeed<0&&this.currentFrame>n&&this.onLoop()),this.updateTexture())}},e.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},e.prototype.destroy=function(t){this.stop(),r.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},e.fromFrames=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},e.fromImages=function(t){for(var i=[],n=0;n<t.length;++n)i.push(k.from(t[n]));return new e(i)},Object.defineProperty(e.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},set:function(t){if(t[0]instanceof k)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(var i=0;i<t.length;i++)this._textures.push(t[i].texture),this._durations.push(t[i].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){var t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Tt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),e})(fi);ee.add(Qc,nd,rd,Zd,Sp,ra,Mp,jp,bd,Yd,Vd,Rp,_f,cd);var za={exports:{}};(function(r){(function(){function e(v,_){document.addEventListener?v.addEventListener("scroll",_,!1):v.attachEvent("scroll",_)}function t(v){document.body?v():document.addEventListener?document.addEventListener("DOMContentLoaded",function _(){document.removeEventListener("DOMContentLoaded",_),v()}):document.attachEvent("onreadystatechange",function _(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",_),v())})}function i(v){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(v)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function n(v,_){v.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+_+";"}function s(v){var _=v.g.offsetWidth,m=_+100;return v.j.style.width=m+"px",v.i.scrollLeft=m,v.h.scrollLeft=v.h.scrollWidth+100,v.l!==_?(v.l=_,!0):!1}function a(v,_){function m(){var y=g;s(y)&&y.g.parentNode!==null&&_(y.l)}var g=v;e(v.h,m),e(v.i,m),s(v)}function o(v,_,m){_=_||{},m=m||window,this.family=v,this.style=_.style||"normal",this.weight=_.weight||"normal",this.stretch=_.stretch||"normal",this.context=m}var h=null,u=null,l=null,f=null;function c(v){return u===null&&(d(v)&&/Apple/.test(window.navigator.vendor)?(v=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),u=!!v&&603>parseInt(v[1],10)):u=!1),u}function d(v){return f===null&&(f=!!v.document.fonts),f}function p(v,_){var m=v.style,g=v.weight;if(l===null){var y=document.createElement("div");try{y.style.font="condensed 100px sans-serif"}catch{}l=y.style.font!==""}return[m,g,l?v.stretch:"","100px",_].join(" ")}o.prototype.load=function(v,_){var m=this,g=v||"BESbswy",y=0,b=_||3e3,x=new Date().getTime();return new Promise(function(T,w){if(d(m.context)&&!c(m.context)){var A=new Promise(function(E,D){function C(){new Date().getTime()-x>=b?D(Error(""+b+"ms timeout exceeded")):m.context.document.fonts.load(p(m,'"'+m.family+'"'),g).then(function(N){1<=N.length?E():setTimeout(C,25)},D)}C()}),S=new Promise(function(E,D){y=setTimeout(function(){D(Error(""+b+"ms timeout exceeded"))},b)});Promise.race([S,A]).then(function(){clearTimeout(y),T(m)},w)}else t(function(){function E(){var B;(B=M!=-1&&O!=-1||M!=-1&&U!=-1||O!=-1&&U!=-1)&&((B=M!=O&&M!=U&&O!=U)||(h===null&&(B=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!B&&(536>parseInt(B[1],10)||parseInt(B[1],10)===536&&11>=parseInt(B[2],10))),B=h&&(M==rt&&O==rt&&U==rt||M==z&&O==z&&U==z||M==I&&O==I&&U==I)),B=!B),B&&(P.parentNode!==null&&P.parentNode.removeChild(P),clearTimeout(y),T(m))}function D(){if(new Date().getTime()-x>=b)P.parentNode!==null&&P.parentNode.removeChild(P),w(Error(""+b+"ms timeout exceeded"));else{var B=m.context.document.hidden;(B===!0||B===void 0)&&(M=C.g.offsetWidth,O=N.g.offsetWidth,U=W.g.offsetWidth,E()),y=setTimeout(D,50)}}var C=new i(g),N=new i(g),W=new i(g),M=-1,O=-1,U=-1,rt=-1,z=-1,I=-1,P=document.createElement("div");P.dir="ltr",n(C,p(m,"sans-serif")),n(N,p(m,"serif")),n(W,p(m,"monospace")),P.appendChild(C.g),P.appendChild(N.g),P.appendChild(W.g),m.context.document.body.appendChild(P),rt=C.g.offsetWidth,z=N.g.offsetWidth,I=W.g.offsetWidth,D(),a(C,function(B){M=B,E()}),n(C,p(m,'"'+m.family+'",sans-serif')),a(N,function(B){O=B,E()}),n(N,p(m,'"'+m.family+'",serif')),a(W,function(B){U=B,E()}),n(W,p(m,'"'+m.family+'",monospace'))})})},r.exports=o})()})(za);const pv=za.exports,_i=new le({fontFamily:"InterVariable",fontSize:14,lineHeight:20}),vv=new le({fontFamily:"InterVariable",fontSize:12,lineHeight:16});function _v(){const r=window.devicePixelRatio||2;return new Promise(e=>{new pv("InterVariable").load().then(()=>{const i={resolution:r,chars:Mt.ASCII};Mt.from("NodeTextDefault",{..._i,fill:1120295},i),Mt.from("NodeTextInverse",{..._i,fill:16777215},i),Mt.from("TimeMarkerLabel",{...vv,fill:9741240},i),e({nodeTextDefault:{fontName:"NodeTextDefault",fontSize:14},nodeTextInverse:{fontName:"NodeTextInverse",fontSize:14},timeMarkerLabel:{fontName:"TimeMarkerLabel",fontSize:12}})})})}let Un=null;const Ya=()=>(Un||(Un=_v()),Un);function mv(r){gh();const e=new ja({backgroundAlpha:0,width:r.clientWidth,height:r.clientHeight,resolution:window.devicePixelRatio||2,autoDensity:!0,antialias:!0,resizeTo:r});return r.appendChild(e.view),e}async function gv(){const{Viewport:r}=await Promise.resolve().then(()=>jv);return r}async function yv(r,e){const t=await gv(),{width:i,height:n}=e.screen,s=new t({screenWidth:i,screenHeight:n,passiveWheel:!1,interaction:e.renderer.plugins.interaction,divWheel:r,ticker:e.ticker});return s.drag({wheel:!1,pressDrag:!0}).wheel({trackpadPinch:!0,wheelZoom:!0}).pinch().clampZoom({minWidth:i/2,maxWidth:i*40}).decelerate({friction:.9}),e.stage.addChild(s),e.ticker.add(()=>{(s.screenWidth!==e.screen.width||s.screenHeight!==e.screen.height)&&s.resize(e.screen.width,e.screen.height)},null,$t.LOW),s}const Gn={guideLineColor:13227490,labelPadding:4};class xv extends Pt{constructor(t,i){super();K(this,"labelText");K(this,"guideHeight");K(this,"guideLine");K(this,"label");this.labelText=t,this.guideHeight=i,this.guideLine=new Ae,this.drawGuideLine(),this.addChild(this.guideLine),this.drawLabel()}drawGuideLine(){this.guideLine.clear(),this.guideLine.beginFill(Gn.guideLineColor),this.guideLine.drawRect(0,0,1,this.guideHeight),this.guideLine.endFill()}async drawLabel(){var t;if(this.labelText){const i=await Ya();(t=this.label)==null||t.destroy(),this.label=new An(this.labelText,i.timeMarkerLabel),this.label.position.set(Gn.labelPadding,Gn.labelPadding),this.addChild(this.label)}}updateHeight(t){this.guideHeight=t,this.drawGuideLine()}}function bv(r,e){let t,i;r.forEach(s=>{(t===void 0||t>s.start||isNaN(s.start.getDate()))&&(t=s.start),s.end!==null&&(i===void 0||i<s.end||isNaN(s.end.getDate()))&&(i=s.end)}),t=t??new Date,i=i??new Date(t.getTime()+(e??0));const n=i.getTime()-t.getTime();return{min:t,max:i,span:e&&n<e?e:n}}function Tv(r){return new Date(r.getFullYear(),r.getMonth(),r.getDate())}function wv(r){return new Date(r.getFullYear(),r.getMonth(),r.getDate(),Math.floor(r.getHours()/2)*2)}const Y={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},xt={seconds:"seconds",minutes:"minutes",date:"date"},Va=[{ceiling:Y.second*4,span:Y.second,labelFormat:xt.seconds},{ceiling:Y.second*8,span:Y.second*5,labelFormat:xt.seconds},{ceiling:Y.second*13,span:Y.second*10,labelFormat:xt.seconds},{ceiling:Y.second*20,span:Y.second*15,labelFormat:xt.seconds},{ceiling:Y.second*45,span:Y.second*30,labelFormat:xt.seconds},{ceiling:Y.minute*4,span:Y.minute,labelFormat:xt.minutes},{ceiling:Y.minute*8,span:Y.minute*5,labelFormat:xt.minutes},{ceiling:Y.minute*13,span:Y.minute*10,labelFormat:xt.minutes},{ceiling:Y.minute*28,span:Y.minute*15,labelFormat:xt.minutes},{ceiling:Y.hour*1.24,span:Y.minute*30,labelFormat:xt.minutes},{ceiling:Y.hour*3,span:Y.hour,labelFormat:xt.minutes},{ceiling:Y.hour*8,span:Y.hour*2,labelFormat:xt.minutes},{ceiling:Y.hour*13,span:Y.hour*6,labelFormat:xt.minutes},{ceiling:Y.hour*22,span:Y.hour*12,labelFormat:xt.minutes},{ceiling:Y.day*4,span:Y.day,labelFormat:xt.date},{ceiling:Y.week*2,span:Y.week,labelFormat:xt.date},{ceiling:1/0,span:Y.week*4,labelFormat:xt.date}],Ev=260,kn={xPadding:4e3};class Sv extends Pt{constructor({viewportRef:t,appRef:i,xScale:n,dateScale:s,minimumStartDate:a,maximumEndDate:o,isRunning:h,formatTimeBySeconds:u,formatTimeByMinutes:l,formatDate:f}){super();K(this,"viewportRef");K(this,"appRef");K(this,"xScale");K(this,"dateScale");K(this,"minimumStartDate");K(this,"maximumEndDate");K(this,"isRunning");K(this,"formatTimeBySeconds");K(this,"formatTimeByMinutes");K(this,"formatDate");K(this,"idealGuideCount",10);K(this,"currentTimeGap",120);K(this,"labelFormatter",t=>t.toLocaleTimeString());K(this,"guides",new Map);this.viewportRef=t,this.appRef=i,this.xScale=n,this.dateScale=s,this.minimumStartDate=a,this.maximumEndDate=o,this.isRunning=h,this.formatTimeBySeconds=u,this.formatTimeByMinutes=l,this.formatDate=f,this.updateIdealGuideCount(),this.updateCurrentTimeGap(),this.createGuides()}updateGuides(){const t=this.currentTimeGap;this.updateCurrentTimeGap(),this.isRedrawRequired(t)?(this.guides.size>0&&(this.removeChildren(),this.guides.clear()),this.createGuides()):this.updateGuidePositions()}updateIdealGuideCount(){this.idealGuideCount=Math.ceil(this.appRef.screen.width/Ev)}updateCurrentTimeGap(){const t=Math.ceil((this.viewportRef.right-this.viewportRef.left)/this.idealGuideCount),i=this.dateScale(t)-this.minimumStartDate.getTime(),n=Va.find(s=>s.ceiling>i)??Va[0];this.currentTimeGap=n.span,this.setLabelFormatter(n.labelFormat)}createGuides(){let t;const i=this.dateScale(this.xScale(this.maximumEndDate.value??new Date)+kn.xPadding);let n=new Date(Math.ceil(this.dateScale(-kn.xPadding)/this.currentTimeGap)*this.currentTimeGap);for(this.currentTimeGap>Y.hour*6?n=Tv(n):this.currentTimeGap>Y.hour&&(n=wv(n)),t=n;t.getTime()<i;){const s=new xv(this.labelFormatter(t),this.appRef.screen.height);s.position.set(this.getGuidePosition(t),0),this.guides.set(t,s),this.addChild(s),t=new Date(t.getTime()+this.currentTimeGap)}}getGuidePosition(t){return this.xScale(t)*this.viewportRef.scale._x+this.viewportRef.worldTransform.tx}updateGuidePositions(){this.guides.forEach((t,i)=>{this.getGuidePosition(i)!==t.position.x&&t.position.set(this.getGuidePosition(i),0),t.height!==this.appRef.screen.height&&t.updateHeight(this.appRef.screen.height)})}setLabelFormatter(t){switch(t){case xt.minutes:this.labelFormatter=this.formatByMinutesWithDates;break;case xt.date:this.labelFormatter=this.formatDate;break;default:this.labelFormatter=this.formatTimeBySeconds}}formatByMinutesWithDates(t){return t.getHours()===0&&t.getMinutes()===0?`${this.formatDate(t)}
1057
+ ${this.formatTimeByMinutes(t)}`:this.formatTimeByMinutes(t)}isRedrawRequired(t){return t!==this.currentTimeGap||this.noGuidesExist()||this.isGuideLengthOutdated()}noGuidesExist(){return this.guides.size===0}isGuideLengthOutdated(){var n;if(!this.isRunning)return!1;const t=(n=Array.from(this.guides).pop())==null?void 0:n[1];if(!t||!this.maximumEndDate.value)return!1;const i=this.getGuidePosition(this.maximumEndDate.value)+kn.xPadding*this.viewportRef.scale._x-this.xScale(new Date(this.minimumStartDate.getTime()+this.currentTimeGap))*this.viewportRef.scale._x;return t.x<i}destroy(){this.removeChildren(),this.guides.clear(),super.destroy.call(this)}}const qa=12,Ie={padding:qa,borderRadius:8,labelGap:4,yPositionOffset:_i.lineHeight+qa*2+16},$a={completed:42557,running:43247,scheduled:6321549,pending:6321549,failed:15728657,cancelled:15728657,crashed:15728657,paused:16035840};class Za extends Pt{constructor(t,i,n){super();K(this,"nodeData");K(this,"xScale");K(this,"label");K(this,"box");K(this,"apxLabelWidth",0);K(this,"nodeWidth");K(this,"yPositionIndex",0);K(this,"isLabelInBox",!0);this.nodeData=t,this.xScale=i,this.yPositionIndex=n,this.nodeWidth=this.getNodeWidth(),this.box=new Ae,this.drawBox(),this.addChild(this.box),this.drawLabel(),this.updatePosition()}getNodeWidth(){return this.xScale(this.nodeData.end??new Date)-this.xScale(this.nodeData.start)}get boxColor(){return this.nodeData.state?$a[this.nodeData.state]:$a.pending}drawBox(){this.box.beginFill(this.boxColor),this.box.drawRoundedRect(0,0,this.nodeWidth,_i.lineHeight+Ie.padding*2,Ie.borderRadius),this.box.endFill()}async drawLabel(){var i;const t=await Ya();this.apxLabelWidth===0&&(this.apxLabelWidth=Xt.measureText(this.nodeData.label,_i).width),(i=this.label)==null||i.destroy(),this.apxLabelWidth+Ie.padding*2>this.nodeWidth?(this.isLabelInBox=!1,this.label=new An(this.nodeData.label,t.nodeTextDefault)):(this.isLabelInBox=!0,this.label=new An(this.nodeData.label,t.nodeTextInverse)),this.updateLabelPosition(),this.addChild(this.label)}updatePosition(){this.position.set(this.xScale(this.nodeData.start),this.yPositionIndex*Ie.yPositionOffset)}updateLabelPosition(){var t;(t=this.label)==null||t.position.set(this.isLabelInBox?Ie.padding:this.nodeWidth+Ie.labelGap,Ie.padding)}update(t){t&&(this.nodeData=t);const i=this.getNodeWidth();i!==this.nodeWidth&&(this.nodeWidth=i,this.box.clear(),this.drawBox(),this.isLabelInBox&&this.apxLabelWidth>this.nodeWidth+2||!this.isLabelInBox&&this.apxLabelWidth<this.nodeWidth-2?this.drawLabel():this.isLabelInBox||this.updateLabelPosition()),this.updatePosition()}}const fe={playheadBg:5145342,playheadWidth:2,playheadGlowPadding:8};class Pv extends Pt{constructor({viewportRef:t,appRef:i,xScale:n}){super();K(this,"viewportRef");K(this,"appRef");K(this,"xScale");K(this,"playhead",new Ae);this.viewportRef=t,this.appRef=i,this.xScale=n,this.drawPlayhead()}drawPlayhead(){this.playhead.beginFill(fe.playheadBg,.1),this.playhead.drawRect(0,0,fe.playheadWidth+fe.playheadGlowPadding*2,this.appRef.screen.height),this.playhead.endFill(),this.playhead.beginFill(fe.playheadBg),this.playhead.drawRect(fe.playheadGlowPadding,0,fe.playheadWidth,this.appRef.screen.height),this.playhead.endFill(),this.addChild(this.playhead)}updatePosition(){this.position.x=this.xScale(new Date)*this.viewportRef.scale._x+this.viewportRef.worldTransform.tx-fe.playheadGlowPadding-fe.playheadWidth/2,this.playhead.height!==this.appRef.screen.height&&(this.playhead.height=this.appRef.screen.height)}}const Rv=dt.defineComponent({__name:"FlowRunTimeline",props:{graphData:null,isRunning:{type:Boolean},formatTimeBySeconds:null,formatTimeByMinutes:null,formatDate:null},setup(r){const e=r,t=dt.ref(),i={defaultViewportPadding:40},n={timelineGuides:0,viewport:10,playhead:20};let s=dt.ref(!0),a,o,h=new xo,u=!1,l,f=dt.ref(),c,d,p,v,_=null,m=new Pt,g=new Map;dt.onMounted(async()=>{if(!t.value){console.error("Stage reference not found in initPixiApp");return}b(),a=mv(t.value),a.stage.sortableChildren=!0,o=await yv(t.value,a),o.zIndex=n.viewport,w(),S(),x(),A(),s.value=!1}),dt.onBeforeUnmount(()=>{y()});function y(){p.destroy(),v==null||v.destroy(),m.removeChildren(),g.clear(),m.destroy(),a.destroy(!0)}function b(){const N=Array.from(e.graphData).filter(U=>U.end).flatMap(({start:U,end:rt})=>({start:U,end:rt}));e.isRunning===!0&&N.push({start:new Date,end:new Date});const{min:W,max:M,span:O}=bv(N,6e4);l=W,f.value=M,c=O,d=t.value.clientWidth*2}function x(){e.isRunning&&(v=new Pv({viewportRef:o,appRef:a,xScale:E}),v.zIndex=n.playhead,a.stage.addChild(v),T())}function T(){_||(_=a.ticker.add(()=>{if(e.isRunning&&v){const C=v.position.x>0&&v.position.x<a.screen.width;if(f.value=new Date,v.updatePosition(),!o.moving&&C&&v.position.x>a.screen.width-i.defaultViewportPadding){const N=D(o.left);o.zoomPercent(-.1,!0),o.left=E(new Date(N))}}else v!=null&&v.destroyed||v==null||v.destroy()}))}function w(){p=new Sv({viewportRef:o,appRef:a,xScale:E,dateScale:D,minimumStartDate:l,maximumEndDate:f,isRunning:e.isRunning??!1,formatTimeBySeconds:e.formatTimeBySeconds,formatTimeByMinutes:e.formatTimeByMinutes,formatDate:e.formatDate}),p.zIndex=n.timelineGuides,a.stage.addChild(p),a.ticker.add(()=>{p.updateGuides()})}function A(){h.addAll(o.children),o.on("frame-end",()=>{(o.dirty||u)&&(h.cull(a.renderer.screen),o.dirty=!1,u=!1)})}function S(){e.graphData.forEach((C,N)=>{const W=new Za(C,E,N);g.set(C.id,{node:W,end:C.end,state:C.state}),m.addChild(W)}),o.addChild(m),o.ensureVisible(m.x-i.defaultViewportPadding,m.y-i.defaultViewportPadding,m.width+i.defaultViewportPadding*2,m.height+i.defaultViewportPadding*2,!0),o.moveCenter(m.x+m.width/2,m.y+m.height/2),e.isRunning&&a.ticker.add(()=>{e.isRunning&&g.forEach(C=>C.node.update())})}dt.watchEffect(()=>{s.value||(e.graphData.forEach(C=>{if(g.has(C.id)){const N=g.get(C.id);(N.end!==C.end||N.state!==C.state)&&N.node.update(C)}else{const N=new Za(C,E,g.size);g.set(C.id,{node:N,end:C.end,state:C.state}),m.addChild(N),u=!0}}),e.isRunning&&(!v||v.destroyed)&&x())});function E(C){return Math.ceil((C.getTime()-l.getTime())*(d/c))}function D(C){return Math.ceil(l.getTime()+C*(c/d))}return(C,N)=>(dt.openBlock(),dt.createElementBlock("div",{ref_key:"stage",ref:t,class:"flow-run-timeline"},null,512))}}),Vv="";class Ot{constructor(e){this.parent=e,this.paused=!1}destroy(){}down(e){return!1}move(e){return!1}up(e){return!1}wheel(e){return!1}update(e){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var Cv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Av(r,e,t){return t={path:e,exports:{},require:function(i,n){return Iv(i,n??t.path)}},r(t,t.exports),t.exports}function Iv(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Ka=Av(function(r,e){(function(){var t,i;i=function(n){return r.exports=n},t={linear:function(n,s,a,o){return a*n/o+s},easeInQuad:function(n,s,a,o){return a*(n/=o)*n+s},easeOutQuad:function(n,s,a,o){return-a*(n/=o)*(n-2)+s},easeInOutQuad:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n+s:-a/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,a,o){return a*(n/=o)*n*n+s},easeOutCubic:function(n,s,a,o){return a*((n=n/o-1)*n*n+1)+s},easeInOutCubic:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n*n+s:a/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,a,o){return a*(n/=o)*n*n*n+s},easeOutQuart:function(n,s,a,o){return-a*((n=n/o-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n*n*n+s:-a/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,a,o){return a*(n/=o)*n*n*n*n+s},easeOutQuint:function(n,s,a,o){return a*((n=n/o-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,a,o){return(n/=o/2)<1?a/2*n*n*n*n*n+s:a/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,a,o){return-a*Math.cos(n/o*(Math.PI/2))+a+s},easeOutSine:function(n,s,a,o){return a*Math.sin(n/o*(Math.PI/2))+s},easeInOutSine:function(n,s,a,o){return-a/2*(Math.cos(Math.PI*n/o)-1)+s},easeInExpo:function(n,s,a,o){return n===0?s:a*Math.pow(2,10*(n/o-1))+s},easeOutExpo:function(n,s,a,o){return n===o?s+a:a*(-Math.pow(2,-10*n/o)+1)+s},easeInOutExpo:function(n,s,a,o){return(n/=o/2)<1?a/2*Math.pow(2,10*(n-1))+s:a/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,a,o){return-a*(Math.sqrt(1-(n/=o)*n)-1)+s},easeOutCirc:function(n,s,a,o){return a*Math.sqrt(1-(n=n/o-1)*n)+s},easeInOutCirc:function(n,s,a,o){return(n/=o/2)<1?-a/2*(Math.sqrt(1-n*n)-1)+s:a/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,a,o){var h,u,l;return l=1.70158,u=0,h=a,n===0||(n/=o),u||(u=o*.3),h<Math.abs(a)?(h=a,l=u/4):l=u/(2*Math.PI)*Math.asin(a/h),-(h*Math.pow(2,10*(n-=1))*Math.sin((n*o-l)*(2*Math.PI)/u))+s},easeOutElastic:function(n,s,a,o){var h,u,l;return l=1.70158,u=0,h=a,n===0||(n/=o),u||(u=o*.3),h<Math.abs(a)?(h=a,l=u/4):l=u/(2*Math.PI)*Math.asin(a/h),h*Math.pow(2,-10*n)*Math.sin((n*o-l)*(2*Math.PI)/u)+a+s},easeInOutElastic:function(n,s,a,o){var h,u,l;return l=1.70158,u=0,h=a,n===0||(n/=o/2),u||(u=o*(.3*1.5)),h<Math.abs(a)?(h=a,l=u/4):l=u/(2*Math.PI)*Math.asin(a/h),n<1?-.5*(h*Math.pow(2,10*(n-=1))*Math.sin((n*o-l)*(2*Math.PI)/u))+s:h*Math.pow(2,-10*(n-=1))*Math.sin((n*o-l)*(2*Math.PI)/u)*.5+a+s},easeInBack:function(n,s,a,o,h){return h===void 0&&(h=1.70158),a*(n/=o)*n*((h+1)*n-h)+s},easeOutBack:function(n,s,a,o,h){return h===void 0&&(h=1.70158),a*((n=n/o-1)*n*((h+1)*n+h)+1)+s},easeInOutBack:function(n,s,a,o,h){return h===void 0&&(h=1.70158),(n/=o/2)<1?a/2*(n*n*(((h*=1.525)+1)*n-h))+s:a/2*((n-=2)*n*(((h*=1.525)+1)*n+h)+2)+s},easeInBounce:function(n,s,a,o){var h;return h=t.easeOutBounce(o-n,0,a,o),a-h+s},easeOutBounce:function(n,s,a,o){return(n/=o)<1/2.75?a*(7.5625*n*n)+s:n<2/2.75?a*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?a*(7.5625*(n-=2.25/2.75)*n+.9375)+s:a*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,a,o){var h;return n<o/2?(h=t.easeInBounce(n*2,0,a,o),h*.5+s):(h=t.easeOutBounce(n*2-o,0,a,o),h*.5+a*.5+s)}},i(t)}).call(Cv)});function or(r,e){if(r){if(typeof r=="function")return r;if(typeof r=="string")return Ka[r]}else return Ka[e]}const Ov={removeOnInterrupt:!1,ease:"linear",time:1e3};class Zt extends Ot{__init(){this.startWidth=null}__init2(){this.startHeight=null}__init3(){this.deltaWidth=null}__init4(){this.deltaHeight=null}__init5(){this.width=null}__init6(){this.height=null}__init7(){this.time=0}constructor(e,t={}){super(e),Zt.prototype.__init.call(this),Zt.prototype.__init2.call(this),Zt.prototype.__init3.call(this),Zt.prototype.__init4.call(this),Zt.prototype.__init5.call(this),Zt.prototype.__init6.call(this),Zt.prototype.__init7.call(this),this.options=Object.assign({},Ov,t),this.options.ease=or(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(e){if(this.paused)return;this.time+=e;const t=new X(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,n=this.parent.height;this.complete(),(i!==this.parent.width||n!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:t,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const n=this.startWidth,s=this.deltaWidth;this.parent.fitWidth(n+s*i,this.keepCenter,this.height===null)}if(this.height!==null){const n=this.startHeight,s=this.deltaHeight;this.parent.fitHeight(n+s*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const n=this.startX,s=this.startY,a=this.deltaX,o=this.deltaY,h=new X(this.parent.x,this.parent.y);this.parent.moveCenter(n+a*i,s+o*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:t,type:"animate"})}}}function hr(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...a)=>t.call(e,...a)),e=void 0)}return t}const Mv={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class Qa extends Ot{constructor(e,t={}){super(e),this.options=Object.assign({},Mv,t),this.ease=or(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(e){if(!this.paused){if(this.bounce(),this.toX){const t=this.toX;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),t.time>=this.options.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.options.time)}if(this.toY){const t=this.toY;t.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),t.time>=this.options.time?(this.parent.y=t.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(t.time,t.start,t.delta,this.options.time)}}}calcUnderflowX(){let e;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}calcUnderflowY(){let e;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}oob(){const e=this.options.bounceBox;if(e){const t=typeof e.x>"u"?0:e.x,i=typeof e.y>"u"?0:e.y,n=typeof e.width>"u"?this.parent.worldWidth:e.width,s=typeof e.height>"u"?this.parent.worldHeight:e.height;return{left:this.parent.left<t,right:this.parent.right>n,top:this.parent.top<i,bottom:this.parent.bottom>s,topLeft:new X(t*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new X(n*this.parent.scale.x-this.parent.screenWidth,s*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new X(0,0),bottomRight:new X(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){if(this.paused)return;let e,t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.x&&t.percentChangeX===hr([t,"access",s=>s.options,"optionalAccess",s=>s.friction])||t.y&&t.percentChangeY===hr([t,"access",s=>s.options,"optionalAccess",s=>s.friction]))&&(e=this.oob(),(e.left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.options.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.options.friction));const i=this.parent.plugins.get("drag",!0)||{},n=this.parent.plugins.get("pinch",!0)||{};if(t=t||{},!hr([i,"optionalAccess",s=>s.active])&&!hr([n,"optionalAccess",s=>s.active])&&(!this.toX||!this.toY)&&(!t.x||!t.y)){e=e||this.oob();const s=e.topLeft,a=e.bottomRight;if(!this.toX&&!t.x){let o=null;e.left&&this.left?o=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-s.x:e.right&&this.right&&(o=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x),o!==null&&this.parent.x!==o&&(this.toX={time:0,start:this.parent.x,delta:o-this.parent.x,end:o},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!t.y){let o=null;e.top&&this.top?o=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-s.y:e.bottom&&this.bottom&&(o=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y),o!==null&&this.parent.y!==o&&(this.toY={time:0,start:this.parent.y,delta:o-this.parent.y,end:o},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const Dv={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class Ja extends Ot{constructor(e,t={}){super(e),this.options=Object.assign({},Dv,t),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="none"?this.noUnderflow=!0:e==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=e.indexOf("left")!==-1?-1:e.indexOf("right")!==-1?1:0,this.underflowY=e.indexOf("top")!==-1?-1:e.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const e={x:this.parent.x,y:this.parent.y},t=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,t.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,t.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,t.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,t.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:e,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const Fv={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class to extends Ot{constructor(e,t={}){super(e),this.options=Object.assign({},Fv,t),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&e<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&e>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&t<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&t>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const e={x:null,y:null},t={x:null,y:null};if(typeof this.options.minScale=="number")e.x=this.options.minScale,e.y=this.options.minScale;else if(this.options.minScale!==null){const s=this.options.minScale;e.x=typeof s.x>"u"?null:s.x,e.y=typeof s.y>"u"?null:s.y}if(typeof this.options.maxScale=="number")t.x=this.options.maxScale,t.y=this.options.maxScale;else if(this.options.maxScale!==null){const s=this.options.maxScale;t.x=typeof s.x>"u"?null:s.x,t.y=typeof s.y>"u"?null:s.y}let i=this.parent.scale.x,n=this.parent.scale.y;e.x!==null&&i<e.x&&(i=e.x),t.x!==null&&i>t.x&&(i=t.x),e.y!==null&&n<e.y&&(n=e.y),t.y!==null&&n>t.y&&(n=t.y),(i!==this.parent.scale.x||n!==this.parent.scale.y)&&(this.parent.scale.set(i,n),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const Nv={friction:.98,bounce:.8,minSpeed:.01},ce=16;class eo extends Ot{constructor(e,t={}){super(e),this.options=Object.assign({},Nv,t),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.moved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const e=this.parent.input.count();return(e===1||e>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}moved(e){if(this.saved.length){const t=this.saved[this.saved.length-1];e.type==="clamp-x"?t.x===e.original.x&&(t.x=this.parent.x):e.type==="clamp-y"&&t.y===e.original.y&&(t.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const e=performance.now();for(const t of this.saved)if(t.time>=e-100){const i=e-t.time;this.x=(this.parent.x-t.x)/i,this.y=(this.parent.y-t.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(e){e=e||{},typeof e.x<"u"&&(this.x=e.x,this.percentChangeX=this.options.friction),typeof e.y<"u"&&(this.y=e.y,this.percentChangeY=this.options.friction)}update(e){if(this.paused)return;const t=this.x||this.y,i=this.timeSinceRelease,n=this.timeSinceRelease+e;if(this.x){const s=this.percentChangeX,a=Math.log(s);this.parent.x+=this.x*ce/a*(Math.pow(s,n/ce)-Math.pow(s,i/ce)),this.x*=Math.pow(this.percentChangeX,e/ce)}if(this.y){const s=this.percentChangeY,a=Math.log(s);this.parent.y+=this.y*ce/a*(Math.pow(s,n/ce)-Math.pow(s,i/ce)),this.y*=Math.pow(this.percentChangeY,e/ce)}this.timeSinceRelease+=e,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),t&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const Bv={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class ur extends Ot{__init(){this.windowEventHandlers=new Array}constructor(e,t={}){super(e),ur.prototype.__init.call(this),this.options=Object.assign({},Bv,t),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){const t=n=>{e.includes(n.code)&&(this.keyIsPressed=!0)},i=n=>{e.includes(n.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",t)}addWindowEventHandler(e,t){window.addEventListener(e,t),this.windowEventHandlers.push({event:e,handler:t})}destroy(){this.windowEventHandlers.forEach(({event:e,handler:t})=>{window.removeEventListener(e,t)})}mouseButtons(e){!e||e==="all"?this.mouse=[!0,!0,!0]:this.mouse=[e.indexOf("left")!==-1,e.indexOf("middle")!==-1,e.indexOf("right")!==-1]}parseUnderflow(){const e=this.options.underflow.toLowerCase();e==="center"?(this.underflowX=0,this.underflowY=0):(e.includes("left")?this.underflowX=-1:e.includes("right")?this.underflowX=1:this.underflowX=0,e.includes("top")?this.underflowY=-1:e.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(e){const t=e.data.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!t||this.mouse[e.data.button]))}checkKeyPress(e){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&e.data.pointerType==="touch"}down(e){return this.paused||!this.options.pressDrag?!1:this.checkButtons(e)&&this.checkKeyPress(e)?(this.last={x:e.data.global.x,y:e.data.global.y},this.current=e.data.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(e){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===e.data.pointerId){const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.count();if(n===1||n>1&&!this.parent.plugins.get("pinch",!0)){const s=t-this.last.x,a=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(s)||this.yDirection&&this.parent.input.checkThreshold(a)){const o={x:t,y:i};return this.xDirection&&(this.parent.x+=(o.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(o.y-this.last.y)*this.options.factor),this.last=o,this.moved||this.parent.emit("drag-start",{event:e,screen:new X(this.last.x,this.last.y),world:this.parent.toWorld(new X(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(e){if(this.paused)return!1;const t=this.parent.input.touches;if(t.length===1){const i=t[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new X(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:e,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(e){if(this.paused)return!1;if(this.options.wheel){const t=this.parent.plugins.get("wheel",!0);if(!t||!t.options.wheelZoom&&!e.ctrlKey){const i=e.deltaMode?this.options.lineHeight:1,n=[e.deltaX,e.deltaY],[s,a]=this.options.wheelSwapAxes?n.reverse():n;return this.xDirection&&(this.parent.x+=s*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=a*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||e.preventDefault(),this.parent.options.stopPropagation&&e.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const e=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,e.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,e.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}}const Lv={speed:0,acceleration:null,radius:null};class io extends Ot{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},Lv,i),this.velocity={x:0,y:0}}update(e){if(this.paused)return;const t=this.parent.center;let i=this.target.x,n=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-t.y,2)+Math.pow(this.target.x-t.x,2))>this.options.radius){const h=Math.atan2(this.target.y-t.y,this.target.x-t.x);i=this.target.x-Math.cos(h)*this.options.radius,n=this.target.y-Math.sin(h)*this.options.radius}else return;const s=i-t.x,a=n-t.y;if(s||a)if(this.options.speed)if(this.options.acceleration){const o=Math.atan2(n-t.y,i-t.x),h=Math.sqrt(Math.pow(s,2)+Math.pow(a,2));if(h){const u=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>u?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*e,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*e,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const l=Math.cos(o)*this.velocity.x,f=Math.sin(o)*this.velocity.y,c=Math.abs(l)>Math.abs(s)?i:t.x+l,d=Math.abs(f)>Math.abs(a)?n:t.y+f;this.parent.moveCenter(c,d),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const o=Math.atan2(n-t.y,i-t.x),h=Math.cos(o)*this.options.speed,u=Math.sin(o)*this.options.speed,l=Math.abs(h)>Math.abs(s)?i:t.x+h,f=Math.abs(u)>Math.abs(a)?n:t.y+u;this.parent.moveCenter(l,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const Uv={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class ro extends Ot{constructor(e,t={}){super(e),this.options=Object.assign({},Uv,t),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const e=this.options.distance;e!==null?(this.left=e,this.top=e,this.right=this.parent.screenWidth-e,this.bottom=this.parent.screenHeight-e):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(e){if(this.paused||e.data.pointerType!=="mouse"&&e.data.identifier!==1||!this.options.allowButtons&&e.data.buttons!==0)return!1;const t=e.data.global.x,i=e.data.global.y;if(this.radiusSquared){const n=this.parent.toScreen(this.parent.center);if(Math.pow(n.x-t,2)+Math.pow(n.y-i,2)>=this.radiusSquared){const a=Math.atan2(n.y-i,n.x-t);this.options.linear?(this.horizontal=Math.round(Math.cos(a))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(a))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(a)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(a)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&t<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&t>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const e=this.parent.plugins.get("decelerate",!0);this.horizontal&&e&&!this.options.noDecelerate&&e.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const e=this.parent.plugins.get("decelerate",!0);this.vertical&&e&&!this.options.noDecelerate&&e.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const e=this.parent.center;this.horizontal&&(e.x+=this.horizontal*this.options.speed),this.vertical&&(e.y+=this.vertical*this.options.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const Gv={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class We extends Ot{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),We.prototype.__init.call(this),We.prototype.__init2.call(this),We.prototype.__init3.call(this),this.options=Object.assign({},Gv,t)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(e){if(this.paused||!this.active)return!1;const t=e.data.global.x,i=e.data.global.y,n=this.parent.input.touches;if(n.length>=2){const s=n[0],a=n[1],o=s.last&&a.last?Math.sqrt(Math.pow(a.last.x-s.last.x,2)+Math.pow(a.last.y-s.last.y,2)):null;if(s.id===e.data.pointerId?s.last={x:t,y:i,data:e.data}:a.id===e.data.pointerId&&(a.last={x:t,y:i,data:e.data}),o){let h;const u={x:s.last.x+(a.last.x-s.last.x)/2,y:s.last.y+(a.last.y-s.last.y)/2};this.options.center||(h=this.parent.toLocal(u));let l=Math.sqrt(Math.pow(a.last.x-s.last.x,2)+Math.pow(a.last.y-s.last.y,2));l=l===0?l=1e-10:l;const f=(1-o/l)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=f),this.isAxisY()&&(this.parent.scale.y+=f),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:u});const c=this.parent.plugins.get("clamp-zoom",!0);if(c&&c.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const d=this.parent.toGlobal(h);this.parent.x+=(u.x-d.x)*this.options.factor,this.parent.y+=(u.y-d.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(u.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(u.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=u,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const kv={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class no extends Ot{constructor(e,t,i,n={}){super(e),this.options=Object.assign({},kv,n),this.ease=or(n.ease,"easeInOutSine"),this.x=t,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const e=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-e.x,this.deltaY=this.y-e.y,this.startX=e.x,this.startY=e.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const e=this.parent.plugins.get("decelerate",!0);e&&(e.x||e.y)&&(e.percentChangeX=e.percentChangeY=this.options.friction)}return!1}update(e){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const t=this.snapping;t.time+=e;let i,n,s;const a=this.startX,o=this.startY,h=this.deltaX,u=this.deltaY;if(t.time>this.options.time)i=!0,n=a+h,s=o+u;else{const l=this.ease(t.time,0,1,this.options.time);n=a+h*l,s=o+u*l}this.options.topLeft?this.parent.moveCorner(n,s):this.parent.moveCenter(n,s),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const t=this.options.topLeft?this.parent.corner:this.parent.center;(t.x!==this.x||t.y!==this.y)&&this.snapStart()}}}const Hv={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class so extends Ot{constructor(e,t={}){super(e),this.options=Object.assign({},Hv,t),this.ease=or(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=e.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=e.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(e.container.scale.x=this.xScale,e.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):t.forceStart&&this.createSnapping()}createSnapping(){const e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,n=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:e,startY:t,deltaX:i-e,deltaY:n-t},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(e){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let t;if(!this.options.center&&!this.options.noMove&&(t=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=e,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const s=this.snapping,a=this.ease(s.time,s.startX,s.deltaX,this.options.time),o=this.ease(s.time,s.startY,s.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/a,this.parent.scale.y=this.parent.screenHeight/o}const n=this.parent.plugins.get("clamp-zoom",!0);n&&n.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(t))}}resume(){this.snapping=null,super.resume()}}const Xv={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class ao extends Ot{constructor(e,t={}){super(e),this.options=Object.assign({},Xv,t),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(e){window.addEventListener("keydown",t=>{e.includes(t.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",t=>{e.includes(t.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const e=this.smoothingCenter,t=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x+=t.x),this.isAxisY()&&(this.parent.scale.y+=t.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const n=this.parent.plugins.get("clamp-zoom",!0);if(n&&n.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const s=this.parent.toGlobal(i);this.parent.x+=e.x-s.x,this.parent.y+=e.y-s.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(e){if(this.paused)return;const t=this.parent.input.getPointerPosition(e),i=-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/200,n=Math.pow(2,(1+this.options.percent)*i);let s;this.options.center||(s=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=n),this.isAxisY()&&(this.parent.scale.y*=n),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const a=this.parent.plugins.get("clamp-zoom",!0);if(a&&a.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const o=this.parent.toGlobal(s);this.parent.x+=t.x-o.x,this.parent.y+=t.y-o.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}wheel(e){if(this.paused||!this.checkKeyPress())return!1;if(e.ctrlKey&&this.options.trackpadPinch)this.pinch(e);else if(this.options.wheelZoom){const t=this.parent.input.getPointerPosition(e),n=(this.options.reverse?-1:1)*-e.deltaY*(e.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*n);if(this.options.smooth){const a={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+a.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+a.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=t}else{let a;this.options.center||(a=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const h=this.parent.toGlobal(a);this.parent.x+=t.x-h.x,this.parent.y+=t.y-h.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel",{wheel:{dx:e.deltaX,dy:e.deltaY,dz:e.deltaZ},event:e,viewport:this.parent})}return!this.parent.options.passiveWheel}}class oo{constructor(e){this.viewport=e,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new j(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.on("pointerout",this.up,this),this.wheelFunction=e=>this.handleWheel(e),this.viewport.options.divWheel.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.divWheel.removeEventListener("wheel",this.wheelFunction)}down(e){if(this.viewport.pause||!this.viewport.worldVisible)return;if(e.data.pointerType==="mouse"?this.isMouseDown=!0:this.get(e.data.pointerId)||this.touches.push({id:e.data.pointerId,last:null}),this.count()===1){this.last=e.data.global.clone();const i=this.viewport.plugins.get("decelerate",!0),n=this.viewport.plugins.get("bounce",!0);(!i||!i.isActive())&&(!n||!n.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(e)&&this.viewport.options.stopPropagation&&e.stopPropagation()}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(e){return Math.abs(e)>=this.viewport.threshold}move(e){if(this.viewport.pause||!this.viewport.worldVisible)return;const t=this.viewport.plugins.move(e);if(this.clickedAvailable&&this.last){const i=e.data.global.x-this.last.x,n=e.data.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(n))&&(this.clickedAvailable=!1)}t&&this.viewport.options.stopPropagation&&e.stopPropagation()}up(e){if(this.viewport.pause||!this.viewport.worldVisible)return;e.data.pointerType==="mouse"&&(this.isMouseDown=!1),e.data.pointerType!=="mouse"&&this.remove(e.data.pointerId);const t=this.viewport.plugins.up(e);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:e,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this}),this.clickedAvailable=!1),t&&this.viewport.options.stopPropagation&&e.stopPropagation()}getPointerPosition(e){const t=new X;if(this.viewport.options.interaction)this.viewport.options.interaction.mapPositionToPoint(t,e.clientX,e.clientY);else if(this.viewport.options.useDivWheelForInputManager&&this.viewport.options.divWheel){const i=this.viewport.options.divWheel.getBoundingClientRect();t.x=e.clientX-i.left,t.y=e.clientY-i.top}else t.x=e.clientX,t.y=e.clientY;return t}handleWheel(e){if(this.viewport.pause||!this.viewport.worldVisible||this.viewport.options.interaction&&this.viewport.options.interaction.interactionDOMElement!==e.target)return;const t=this.viewport.toLocal(this.getPointerPosition(e));this.viewport.left<=t.x&&t.x<=this.viewport.right&&this.viewport.top<=t.y&&t.y<=this.viewport.bottom&&this.viewport.plugins.wheel(e)&&!this.viewport.options.passiveWheel&&e.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(e){for(const t of this.touches)if(t.id===e)return t;return null}remove(e){for(let t=0;t<this.touches.length;t++)if(this.touches[t].id===e){this.touches.splice(t,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}function lr(r){let e,t=r[0],i=1;for(;i<r.length;){const n=r[i],s=r[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&t==null)return;n==="access"||n==="optionalAccess"?(e=t,t=s(t)):(n==="call"||n==="optionalCall")&&(t=s((...a)=>t.call(e,...a)),e=void 0)}return t}const mi=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class ho{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=mi.length){const n=this.plugins[e];n&&n.destroy(),this.plugins[e]=t;const s=mi.indexOf(e);s!==-1&&mi.splice(s,1),mi.splice(i,0,e),this.sort()}get(e,t){return t&&lr([this,"access",i=>i.plugins,"access",i=>i[e],"optionalAccess",i=>i.paused])?null:this.plugins[e]}update(e){for(const t of this.list)t.update(e)}resize(){for(const e of this.list)e.resize()}reset(){for(const e of this.list)e.reset()}removeAll(){this.list.forEach(e=>{e.destroy()}),this.plugins={},this.sort()}remove(e){this.plugins[e]&&(lr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.destroy,"call",t=>t()]),delete this.plugins[e],this.viewport.emit(`${e}-remove`),this.sort())}pause(e){lr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.pause,"call",t=>t()])}resume(e){lr([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.resume,"call",t=>t()])}sort(){this.list=[];for(const e of mi)this.plugins[e]&&this.list.push(this.plugins[e])}down(e){let t=!1;for(const i of this.list)i.down(e)&&(t=!0);return t}move(e){let t=!1;for(const i of this.viewport.plugins.list)i.move(e)&&(t=!0);return t}up(e){let t=!1;for(const i of this.list)i.up(e)&&(t=!0);return t}wheel(e){let t=!1;for(const i of this.list)i.wheel(e)&&(t=!0);return t}}const Wv={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,interaction:null,disableOnContextMenu:!1,ticker:Tt.shared};class Hn extends Pt{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Hn.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},Wv,e),this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.divWheel=this.options.divWheel||document.body,this.options.disableOnContextMenu&&this.options.divWheel.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new oo(this),this.plugins=new ho(this)}destroy(e){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.divWheel.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(e)}update(e){this.pause||(this.plugins.update(e),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new j(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(e=window.innerWidth,t=window.innerHeight,i,n){this.screenWidth=e,this.screenHeight=t,typeof i<"u"&&(this._worldWidth=i),typeof n<"u"&&(this._worldHeight=n),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(e){this._worldWidth=e,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(e){this._worldHeight=e,this.plugins.resize()}getVisibleBounds(){return new j(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(e,t){return arguments.length===2?this.toLocal(new X(e,t)):this.toLocal(e)}toScreen(e,t){return arguments.length===2?this.toGlobal(new X(e,t)):this.toGlobal(e)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new X(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(e){this.moveCenter(e)}moveCenter(...e){let t,i;typeof e[0]=="number"?(t=e[0],i=e[1]):(t=e[0].x,i=e[0].y);const n=(this.worldScreenWidth/2-t)*this.scale.x,s=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==n||this.y!==s)&&(this.position.set(n,s),this.plugins.reset(),this.dirty=!0),this}get corner(){return new X(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(e){this.moveCorner(e)}moveCorner(...e){let t,i;return e.length===1?(t=-e[0].x*this.scale.x,i=-e[0].y*this.scale.y):(t=-e[0]*this.scale.x,i=-e[1]*this.scale.y),(t!==this.x||i!==this.y)&&(this.position.set(t,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(e){return this.screenWidth/e}findFitHeight(e){return this.screenHeight/e}findFit(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.min(i,n)}findCover(e,t){const i=this.screenWidth/e,n=this.screenHeight/t;return Math.max(i,n)}fitWidth(e=this.worldWidth,t,i=!0,n){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,i&&(this.scale.y=this.scale.x);const a=this.plugins.get("clamp-zoom",!0);return!n&&a&&a.clamp(),t&&s&&this.moveCenter(s),this}fitHeight(e=this.worldHeight,t,i=!0,n){let s;t&&(s=this.center),this.scale.y=this.screenHeight/e,i&&(this.scale.x=this.scale.y);const a=this.plugins.get("clamp-zoom",!0);return!n&&a&&a.clamp(),t&&s&&this.moveCenter(s),this}fitWorld(e){let t;e&&(t=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),e&&t&&this.moveCenter(t),this}fit(e,t=this.worldWidth,i=this.worldHeight){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&n&&this.moveCenter(n),this}setZoom(e,t){let i;t&&(i=this.center),this.scale.set(e);const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&i&&this.moveCenter(i),this}zoomPercent(e,t){return this.setZoom(this.scale.x+this.scale.x*e,t)}zoom(e,t){return this.fitWidth(e+this.worldScreenWidth,t),this}get scaled(){return this.scale.x}set scaled(e){this.setZoom(e,!0)}snapZoom(e){return this.plugins.add("snap-zoom",new so(this,e)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new X(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(e){this.x=-e*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(e){this.x=-e*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(e){this.y=-e*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(e){this.y=-e*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(e){this._dirty=e}get forceHitArea(){return this._forceHitArea}set forceHitArea(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=null,this.hitArea=new j(0,0,this.worldWidth,this.worldHeight))}drag(e){return this.plugins.add("drag",new ur(this,e)),this}clamp(e){return this.plugins.add("clamp",new Ja(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new eo(this,e)),this}bounce(e){return this.plugins.add("bounce",new Qa(this,e)),this}pinch(e){return this.plugins.add("pinch",new We(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new no(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new io(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new ao(this,e)),this}animate(e){return this.plugins.add("animate",new Zt(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new to(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new ro(this,e)),this}get pause(){return!!this._pause}set pause(e){this._pause=e,this.lastViewport=null,this.moving=!1,this.zooming=!1,e&&this.input.pause()}ensureVisible(e,t,i,n,s){s&&(i>this.worldScreenWidth||n>this.worldScreenHeight)&&(this.fit(!0,i,n),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let a=!1;e<this.left?(this.left=e,a=!0):e+i>this.right&&(this.right=e+i,a=!0),t<this.top?(this.top=t,a=!0):t+n>this.bottom&&(this.bottom=t+n,a=!0),a&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}const jv=Object.freeze(Object.defineProperty({__proto__:null,Animate:Zt,Bounce:Qa,Clamp:Ja,ClampZoom:to,Decelerate:eo,Drag:ur,Follow:io,InputManager:oo,MouseEdges:ro,Pinch:We,Plugin:Ot,PluginManager:ho,Snap:no,SnapZoom:so,Viewport:Hn,Wheel:ao},Symbol.toStringTag,{value:"Module"}));At.FlowRunTimeline=Rv,Object.defineProperty(At,Symbol.toStringTag,{value:"Module"})});
1057
1058
  //# sourceMappingURL=graphs.umd.js.map