@prefecthq/graphs 0.1.1

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.
Files changed (48) hide show
  1. package/README.md +22 -0
  2. package/dist/graphs.mjs +15118 -0
  3. package/dist/graphs.mjs.map +1 -0
  4. package/dist/graphs.umd.js +1057 -0
  5. package/dist/graphs.umd.js.map +1 -0
  6. package/dist/style.css +1 -0
  7. package/dist/types/demo/App.vue.d.ts +44 -0
  8. package/dist/types/demo/components/ComponentPage.vue.d.ts +97 -0
  9. package/dist/types/demo/components/ContextSidebar.vue.d.ts +44 -0
  10. package/dist/types/demo/components/HashLink.vue.d.ts +65 -0
  11. package/dist/types/demo/components/PContextAccordionItem.vue.d.ts +75 -0
  12. package/dist/types/demo/components/ResizableSection.vue.d.ts +48 -0
  13. package/dist/types/demo/components/contextAccordionChildItem.d.ts +5 -0
  14. package/dist/types/demo/components/router.d.ts +3 -0
  15. package/dist/types/demo/main.d.ts +2 -0
  16. package/dist/types/demo/router/index.d.ts +3 -0
  17. package/dist/types/demo/router/menu.d.ts +4 -0
  18. package/dist/types/demo/router/routeRecords.d.ts +5 -0
  19. package/dist/types/demo/router/routeRecordsFlat.d.ts +4 -0
  20. package/dist/types/demo/sections/Data.vue.d.ts +44 -0
  21. package/dist/types/demo/sections/Home.vue.d.ts +44 -0
  22. package/dist/types/demo/sections/components/FlowRunTimelineDemo.vue.d.ts +44 -0
  23. package/dist/types/demo/sections/components/HelloWorld.vue.d.ts +44 -0
  24. package/dist/types/demo/sections/components/TimescaleTable.vue.d.ts +81 -0
  25. package/dist/types/demo/sections/components/index.d.ts +2 -0
  26. package/dist/types/demo/sections/index.d.ts +2 -0
  27. package/dist/types/demo/utilities/randomColor.d.ts +5 -0
  28. package/dist/types/demo/utilities/randomDate.d.ts +7 -0
  29. package/dist/types/demo/utilities/randomStarName.d.ts +4 -0
  30. package/dist/types/demo/utilities/starnames/index.d.ts +3 -0
  31. package/dist/types/demo/utilities/starnames/names.d.ts +2 -0
  32. package/dist/types/demo/utilities/starnames/prefixes.d.ts +2 -0
  33. package/dist/types/demo/utilities/starnames/suffixes.d.ts +2 -0
  34. package/dist/types/demo/utilities/timescaleData.d.ts +20 -0
  35. package/dist/types/src/FlowRunTimeline.vue.d.ts +66 -0
  36. package/dist/types/src/index.d.ts +1 -0
  37. package/dist/types/src/models/FlowRunTimeline.d.ts +15 -0
  38. package/dist/types/src/models/index.d.ts +1 -0
  39. package/dist/types/src/pixiFunctions/index.d.ts +4 -0
  40. package/dist/types/src/pixiFunctions/initBitmapFonts.d.ts +2 -0
  41. package/dist/types/src/pixiFunctions/initPixiApp.d.ts +2 -0
  42. package/dist/types/src/pixiFunctions/initViewport.d.ts +3 -0
  43. package/dist/types/src/pixiFunctions/timelineGuides.d.ts +17 -0
  44. package/dist/types/src/utilities/index.d.ts +2 -0
  45. package/dist/types/src/utilities/math.d.ts +13 -0
  46. package/dist/types/src/utilities/time.d.ts +16 -0
  47. package/dist/types/vite.config.d.ts +2 -0
  48. package/package.json +70 -0
@@ -0,0 +1,1057 @@
1
+ (function(he,St){typeof exports=="object"&&typeof module<"u"?St(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],St):(he=typeof globalThis<"u"?globalThis:he||self,St(he["prefect-graphs"]={},he.Vue))})(this,function(he,St){"use strict";var pi=Math.PI*2,Qo=180/Math.PI,Jo=Math.PI/180,gt;(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"})(gt||(gt={}));var j=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}(),vi=[new j,new j,new j,new j],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=gt.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,o=this.bottom>e.bottom?e.bottom:this.bottom;return o>s}var a=this.left,h=this.right,u=this.top,l=this.bottom;if(h<=a||l<=u)return!1;var f=vi[0].set(e.left,e.top),c=vi[1].set(e.left,e.bottom),d=vi[2].set(e.right,e.top),p=vi[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)<=a||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=_*a+m*u,g=_*h+m*u,b=_*a+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),E=v*(d.x-f.x),O=T*a+E*u,P=T*h+E*u,S=T*a+E*l,D=T*h+E*l;return!(Math.max(O,P,S,D)<=T*f.x+E*f.y||Math.min(O,P,S,D)>=T*p.x+E*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}(),ta=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=gt.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}(),ea=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=gt.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}(),_i=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=[],o=0,a=n.length;o<a;o++)s.push(n[o].x,n[o].y);n=s}this.points=n,this.type=gt.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,o=n-1;s<n;o=s++){var a=this.points[s*2],h=this.points[s*2+1],u=this.points[o*2],l=this.points[o*2+1],f=h>t!=l>t&&e<(u-a)*((t-h)/(l-h))+a;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}(),ia=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=gt.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),o=i*i;if(n*n+s*s<=o||(n=e-(this.x+this.width-i),n*n+s*s<=o)||(s=t-(this.y+this.height-i),n*n+s*s<=o)||(n=e-(this.x+i),n*n+s*s<=o))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}(),Ce=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}(),_t=function(){function r(e,t,i,n,s,o){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),o===void 0&&(o=0),this.array=null,this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=o}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,o){return this.a=e,this.b=t,this.c=i,this.d=n,this.tx=s,this.ty=o,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 j;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 j;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,o=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=o*t-this.ty*i,this.ty=o*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,o,a,h,u){return this.a=Math.cos(a+u)*s,this.b=Math.sin(a+u)*s,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,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,o=e.pivot,a=-Math.atan2(-n,s),h=Math.atan2(i,t),u=Math.abs(a+h);return u<1e-5||Math.abs(pi-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,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+(o.x*t+o.y*n),e.position.y=this.ty+(o.x*i+o.y*s),e},r.prototype.invert=function(){var e=this.a,t=this.b,i=this.c,n=this.d,s=this.tx,o=e*n-t*i;return this.a=n/o,this.b=-t/o,this.c=-i/o,this.d=e/o,this.tx=(i*this.ty-n*s)/o,this.ty=-(e*this.ty-t*s)/o,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}(),ue=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],le=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],fe=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ce=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],hr=[],Bn=[],mi=Math.sign;function ra(){for(var r=0;r<16;r++){var e=[];hr.push(e);for(var t=0;t<16;t++)for(var i=mi(ue[r]*ue[t]+fe[r]*le[t]),n=mi(le[r]*ue[t]+ce[r]*le[t]),s=mi(ue[r]*fe[t]+fe[r]*ce[t]),o=mi(le[r]*fe[t]+ce[r]*ce[t]),a=0;a<16;a++)if(ue[a]===i&&le[a]===n&&fe[a]===s&&ce[a]===o){e.push(a);break}}for(var r=0;r<16;r++){var h=new _t;h.set(ue[r],le[r],fe[r],ce[r],0,0),Bn.push(h)}}ra();var at={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 ue[r]},uY:function(r){return le[r]},vX:function(r){return fe[r]},vY:function(r){return ce[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return hr[r][e]},sub:function(r,e){return hr[r][at.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?at.S:at.N:Math.abs(e)*2<=Math.abs(r)?r>0?at.E:at.W:e>0?r>0?at.SE:at.SW:r>0?at.NE:at.NW},matrixAppendRotationInv:function(r,e,t,i){t===void 0&&(t=0),i===void 0&&(i=0);var n=Bn[at.inv(e)];n.tx=t,n.ty=i,r.append(n)}},Ln=function(){function r(){this.worldTransform=new _t,this.localTransform=new _t,this.position=new Ce(this.onChange,this,0,0),this.scale=new Ce(this.onChange,this,1,1),this.pivot=new Ce(this.onChange,this,0,0),this.skew=new Ce(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 de=new z;class na{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,de),this._recursive?this.cullRecursive(e,i,t):(t&&i._bounds.getRectangle(e),i[this._toggle]=de.right>e.left&&de.left<e.right&&de.bottom>e.top&&de.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(de):t.getBounds(!0,de);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 o=t.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(e,o[a])}}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 sa(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 oa(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 o(h,u){if(u&&(typeof u=="object"||typeof u=="function")){var l=u.then;if(typeof l=="function"){l.call(u,function(f){o(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 a=0;a<n.length;a++)o(a,n[a])})}var aa=setTimeout;function Un(r){return Boolean(r&&typeof r.length<"u")}function ha(){}function ua(r,e){return function(){r.apply(e,arguments)}}function ut(r){if(!(this instanceof ut))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=[],kn(r,this)}function Gn(r,e){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(e);return}r._handled=!0,ut._immediateFn(function(){var t=r._state===1?e.onFulfilled:e.onRejected;if(t===null){(r._state===1?ur:He)(e.promise,r._value);return}var i;try{i=t(r._value)}catch(n){He(e.promise,n);return}ur(e.promise,i)})}function ur(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 ut){r._state=3,r._value=e,lr(r);return}else if(typeof t=="function"){kn(ua(t,e),r);return}}r._state=1,r._value=e,lr(r)}catch(i){He(r,i)}}function He(r,e){r._state=2,r._value=e,lr(r)}function lr(r){r._state===2&&r._deferreds.length===0&&ut._immediateFn(function(){r._handled||ut._unhandledRejectionFn(r._value)});for(var e=0,t=r._deferreds.length;e<t;e++)Gn(r,r._deferreds[e]);r._deferreds=null}function la(r,e,t){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function kn(r,e){var t=!1;try{r(function(i){t||(t=!0,ur(e,i))},function(i){t||(t=!0,He(e,i))})}catch(i){if(t)return;t=!0,He(e,i)}}ut.prototype.catch=function(r){return this.then(null,r)},ut.prototype.then=function(r,e){var t=new this.constructor(ha);return Gn(this,new la(r,e,t)),t},ut.prototype.finally=sa,ut.all=function(r){return new ut(function(e,t){if(!Un(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(a,h){try{if(h&&(typeof h=="object"||typeof h=="function")){var u=h.then;if(typeof u=="function"){u.call(h,function(l){s(a,l)},t);return}}i[a]=h,--n===0&&e(i)}catch(l){t(l)}}for(var o=0;o<i.length;o++)s(o,i[o])})},ut.allSettled=oa,ut.resolve=function(r){return r&&typeof r=="object"&&r.constructor===ut?r:new ut(function(e){e(r)})},ut.reject=function(r){return new ut(function(e,t){t(r)})},ut.race=function(r){return new ut(function(e,t){if(!Un(r))return t(new TypeError("Promise.race accepts an array"));for(var i=0,n=r.length;i<n;i++)ut.resolve(r[i]).then(e,t)})},ut._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){aa(r,0)},ut._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var Hn=Object.getOwnPropertySymbols,fa=Object.prototype.hasOwnProperty,ca=Object.prototype.propertyIsEnumerable;function da(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function pa(){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 va=pa()?Object.assign:function(r,e){for(var t,i=da(r),n,s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var o in t)fa.call(t,o)&&(i[o]=t[o]);if(Hn){n=Hn(t);for(var a=0;a<n.length;a++)ca.call(t,n[a])&&(i[n[a]]=t[n[a]])}}return i};typeof globalThis>"u"&&(typeof self<"u"?self.globalThis=self:typeof global<"u"&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=ut),Object.assign||(Object.assign=va);var _a=16;if(Date.now&&Date.prototype.getTime||(Date.now=function(){return new Date().getTime()}),!(globalThis.performance&&globalThis.performance.now)){var ma=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-ma}}for(var cr=Date.now(),Xn=["ms","moz","webkit","o"],dr=0;dr<Xn.length&&!globalThis.requestAnimationFrame;++dr){var pr=Xn[dr];globalThis.requestAnimationFrame=globalThis[pr+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[pr+"CancelAnimationFrame"]||globalThis[pr+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(r){if(typeof r!="function")throw new TypeError(r+"is not a function");var e=Date.now(),t=_a+cr-e;return t<0&&(t=0),cr=e,globalThis.self.setTimeout(function(){cr=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 Vt;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(Vt||(Vt={}));var Xe;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Xe||(Xe={}));var gi;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(gi||(gi={}));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 Rt;(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"})(Rt||(Rt={}));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 pe;(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"})(pe||(pe={}));var U;(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"})(U||(U={}));var yi;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(yi||(yi={}));var Gt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Gt||(Gt={}));var kt;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(kt||(kt={}));var It;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(It||(It={}));var Ot;(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"})(Ot||(Ot={}));var Mt;(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"})(Mt||(Mt={}));var xi;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(xi||(xi={}));var Ct;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(Ct||(Ct={}));var vt;(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"})(vt||(vt={}));var Wn;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(Wn||(Wn={}));var lt;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(lt||(lt={}));var Ht;(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"})(Ht||(Ht={}));var ga={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)}},vr=/iPhone/i,jn=/iPod/i,zn=/iPad/i,Yn=/\biOS-universal(?:.+)Mac\b/i,_r=/\bAndroid(?:.+)Mobile\b/i,Vn=/Android/i,Ae=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,bi=/Silk/i,qt=/Windows Phone/i,qn=/\bWindows(?:.+)ARM\b/i,$n=/BlackBerry/i,Zn=/BB10/i,Kn=/Opera Mini/i,Qn=/\b(CriOS|Chrome)(?:.+)Mobile/i,Jn=/Mobile(?:.+)Firefox\b/i,ts=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function ya(r){return function(e){return e.test(r)}}function xa(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=ya(t),s={apple:{phone:n(vr)&&!n(qt),ipod:n(jn),tablet:!n(vr)&&(n(zn)||ts(e))&&!n(qt),universal:n(Yn),device:(n(vr)||n(jn)||n(zn)||n(Yn)||ts(e))&&!n(qt)},amazon:{phone:n(Ae),tablet:!n(Ae)&&n(bi),device:n(Ae)||n(bi)},android:{phone:!n(qt)&&n(Ae)||!n(qt)&&n(_r),tablet:!n(qt)&&!n(Ae)&&!n(_r)&&(n(bi)||n(Vn)),device:!n(qt)&&(n(Ae)||n(bi)||n(_r)||n(Vn))||n(/\bokhttp\b/i)},windows:{phone:n(qt),tablet:n(qn),device:n(qt)||n(qn)},other:{blackberry:n($n),blackberry10:n(Zn),opera:n(Kn),firefox:n(Jn),chrome:n(Qn),device:n($n)||n(Zn)||n(Kn)||n(Jn)||n(Qn)},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 Xt=xa(globalThis.navigator);function ba(){return!Xt.apple.device}function Ta(r){var e=!0;if(Xt.tablet||Xt.phone){if(Xt.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var i=parseInt(t[1],10);i<11&&(e=!1)}}if(Xt.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:ga,MIPMAP_TEXTURES:It.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:lt.NONE,SPRITE_MAX_TEXTURES:Ta(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:xi.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:kt.CLAMP,SCALE_MODE:Gt.LINEAR,PRECISION_VERTEX:Ct.HIGH,PRECISION_FRAGMENT:Xt.apple.device?Ct.HIGH:Ct.MEDIUM,CAN_UPLOAD_SAME_BUFFER:ba(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},es={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 o(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function a(){this._events=new i,this._eventsCount=0}a.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},a.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},a.prototype.listenerCount=function(u){var l=t?t+u:u,f=this._events[l];return f?f.fn?1:f.length:0},a.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},a.prototype.on=function(u,l,f){return s(this,u,l,f,!1)},a.prototype.once=function(u,l,f){return s(this,u,l,f,!0)},a.prototype.removeListener=function(u,l,f,c){var d=t?t+u:u;if(!this._events[d])return this;if(!l)return o(this,d),this;var p=this._events[d];if(p.fn)p.fn===l&&(!c||p.once)&&(!f||p.context===f)&&o(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]:_:o(this,d)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=t?t+u:u,this._events[l]&&o(this,l)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(es);const We=es.exports;var Ti={exports:{}};Ti.exports=Ei,Ti.exports.default=Ei;function Ei(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,s=is(r,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;var a,h,u,l,f,c,d;if(i&&(s=Ca(r,e,s,t)),r.length>80*t){a=u=r[0],h=l=r[1];for(var p=t;p<n;p+=t)f=r[p],c=r[p+1],f<a&&(a=f),c<h&&(h=c),f>u&&(u=f),c>l&&(l=c);d=Math.max(u-a,l-h),d=d!==0?32767/d:0}return je(s,o,t,a,h,d,0),o}function is(r,e,t,i,n){var s,o;if(n===yr(r,e,t,i)>0)for(s=e;s<t;s+=i)o=ss(s,r[s],r[s+1],o);else for(s=t-i;s>=e;s-=i)o=ss(s,r[s],r[s+1],o);return o&&wi(o,o.next)&&(Ye(o),o=o.next),o}function ve(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(wi(t,t.next)||ht(t.prev,t,t.next)===0)){if(Ye(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function je(r,e,t,i,n,s,o){if(r){!o&&s&&Ma(r,i,n,s);for(var a=r,h,u;r.prev!==r.next;){if(h=r.prev,u=r.next,s?wa(r,i,n,s):Ea(r)){e.push(h.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),Ye(r),r=u.next,a=u.next;continue}if(r=u,r===a){o?o===1?(r=Sa(ve(r),e,t),je(r,e,t,i,n,s,2)):o===2&&Pa(r,e,t,i,n,s):je(ve(r),e,t,i,n,s,1);break}}}}function Ea(r){var e=r.prev,t=r,i=r.next;if(ht(e,t,i)>=0)return!1;for(var n=e.x,s=t.x,o=i.x,a=e.y,h=t.y,u=i.y,l=n<s?n<o?n:o:s<o?s:o,f=a<h?a<u?a:u:h<u?h:u,c=n>s?n>o?n:o:s>o?s:o,d=a>h?a>u?a:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=l&&p.x<=c&&p.y>=f&&p.y<=d&&Re(n,a,s,h,o,u,p.x,p.y)&&ht(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function wa(r,e,t,i){var n=r.prev,s=r,o=r.next;if(ht(n,s,o)>=0)return!1;for(var a=n.x,h=s.x,u=o.x,l=n.y,f=s.y,c=o.y,d=a<h?a<u?a:u:h<u?h:u,p=l<f?l<c?l:c:f<c?f:c,v=a>h?a>u?a:u:h>u?h:u,_=l>f?l>c?l:c:f>c?f:c,m=mr(d,p,e,t,i),y=mr(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!==o&&Re(a,l,h,f,u,c,g.x,g.y)&&ht(g.prev,g,g.next)>=0||(g=g.prevZ,b.x>=d&&b.x<=v&&b.y>=p&&b.y<=_&&b!==n&&b!==o&&Re(a,l,h,f,u,c,b.x,b.y)&&ht(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!==o&&Re(a,l,h,f,u,c,g.x,g.y)&&ht(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!==o&&Re(a,l,h,f,u,c,b.x,b.y)&&ht(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Sa(r,e,t){var i=r;do{var n=i.prev,s=i.next.next;!wi(n,s)&&rs(n,i,i.next,s)&&ze(n,s)&&ze(s,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Ye(i),Ye(i.next),i=r=s),i=i.next}while(i!==r);return ve(i)}function Pa(r,e,t,i,n,s){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Na(o,a)){var h=ns(o,a);o=ve(o,o.next),h=ve(h,h.next),je(o,e,t,i,n,s,0),je(h,e,t,i,n,s,0);return}a=a.next}o=o.next}while(o!==r)}function Ca(r,e,t,i){var n=[],s,o,a,h,u;for(s=0,o=e.length;s<o;s++)a=e[s]*i,h=s<o-1?e[s+1]*i:r.length,u=is(r,a,h,i,!1),u===u.next&&(u.steiner=!0),n.push(Fa(u));for(n.sort(Aa),s=0;s<n.length;s++)t=Ra(n[s],t);return t}function Aa(r,e){return r.x-e.x}function Ra(r,e){var t=Ia(r,e);if(!t)return e;var i=ns(t,r);return ve(i,i.next),ve(t,t.next)}function Ia(r,e){var t=e,i=r.x,n=r.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var a=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>s&&(s=a,o=t.x<t.next.x?t:t.next,a===i))return o}t=t.next}while(t!==e);if(!o)return null;var h=o,u=o.x,l=o.y,f=1/0,c;t=o;do i>=t.x&&t.x>=u&&i!==t.x&&Re(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),ze(t,r)&&(c<f||c===f&&(t.x>o.x||t.x===o.x&&Oa(o,t)))&&(o=t,f=c)),t=t.next;while(t!==h);return o}function Oa(r,e){return ht(r.prev,r,e.prev)<0&&ht(e.next,r,r.next)<0}function Ma(r,e,t,i){var n=r;do n.z===0&&(n.z=mr(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,Da(n)}function Da(r){var e,t,i,n,s,o,a,h,u=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<u&&(a++,i=i.nextZ,!!i);e++);for(h=u;a>0||h>0&&i;)a!==0&&(h===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,a--):(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(o>1);return r}function mr(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 Fa(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 Re(r,e,t,i,n,s,o,a){return(n-o)*(e-a)>=(r-o)*(s-a)&&(r-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(n-o)*(i-a)}function Na(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Ba(r,e)&&(ze(r,e)&&ze(e,r)&&La(r,e)&&(ht(r.prev,r,e.prev)||ht(r,e.prev,e))||wi(r,e)&&ht(r.prev,r,r.next)>0&&ht(e.prev,e,e.next)>0)}function ht(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function wi(r,e){return r.x===e.x&&r.y===e.y}function rs(r,e,t,i){var n=Pi(ht(r,e,t)),s=Pi(ht(r,e,i)),o=Pi(ht(t,i,r)),a=Pi(ht(t,i,e));return!!(n!==s&&o!==a||n===0&&Si(r,t,e)||s===0&&Si(r,i,e)||o===0&&Si(t,r,i)||a===0&&Si(t,e,i))}function Si(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 Pi(r){return r>0?1:r<0?-1:0}function Ba(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&&rs(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function ze(r,e){return ht(r.prev,r,r.next)<0?ht(r,e,r.next)>=0&&ht(r,r.prev,e)>=0:ht(r,e,r.prev)<0||ht(r,r.next,e)<0}function La(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 ns(r,e){var t=new gr(r.i,r.x,r.y),i=new gr(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 ss(r,e,t,i){var n=new gr(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 Ye(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 gr(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,o=Math.abs(yr(r,0,s,t));if(n)for(var a=0,h=e.length;a<h;a++){var u=e[a]*t,l=a<h-1?e[a+1]*t:r.length;o-=Math.abs(yr(r,u,l,t))}var f=0;for(a=0;a<i.length;a+=3){var c=i[a]*t,d=i[a+1]*t,p=i[a+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 o===0&&f===0?0:Math.abs((f-o)/o)};function yr(r,e,t,i){for(var n=0,s=e,o=t-i;s<t;s+=i)n+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=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 o=0;o<e;o++)t.vertices.push(r[n][s][o]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t};var xr={exports:{}};(function(r,e){(function(t){var i=e&&!e.nodeType&&e,n=r&&!r.nodeType&&r,s=typeof fr=="object"&&fr;(s.global===s||s.window===s||s.self===s)&&(t=s);var o,a=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,E;function O(C){throw RangeError(g[C])}function P(C,w){for(var B=C.length,V=[];B--;)V[B]=w(C[B]);return V}function S(C,w){var B=C.split("@"),V="";B.length>1&&(V=B[0]+"@",C=B[1]),C=C.replace(y,".");var K=C.split("."),dt=P(K,w).join(".");return V+dt}function D(C){for(var w=[],B=0,V=C.length,K,dt;B<V;)K=C.charCodeAt(B++),K>=55296&&K<=56319&&B<V?(dt=C.charCodeAt(B++),(dt&64512)==56320?w.push(((K&1023)<<10)+(dt&1023)+65536):(w.push(K),B--)):w.push(K);return w}function L(C){return P(C,function(w){var B="";return w>65535&&(w-=65536,B+=T(w>>>10&1023|55296),w=56320|w&1023),B+=T(w),B}).join("")}function k(C){return C-48<10?C-22:C-65<26?C-65:C-97<26?C-97:h}function Y(C,w){return C+22+75*(C<26)-((w!=0)<<5)}function M(C,w,B){var V=0;for(C=B?x(C/c):C>>1,C+=x(C/w);C>b*l>>1;V+=h)C=x(C/b);return x(V+(b+1)*C/(C+f))}function I(C){var w=[],B=C.length,V,K=0,dt=p,nt=d,st,xt,Tt,pt,et,rt,ot,$,wt;for(st=C.lastIndexOf(v),st<0&&(st=0),xt=0;xt<st;++xt)C.charCodeAt(xt)>=128&&O("not-basic"),w.push(C.charCodeAt(xt));for(Tt=st>0?st+1:0;Tt<B;){for(pt=K,et=1,rt=h;Tt>=B&&O("invalid-input"),ot=k(C.charCodeAt(Tt++)),(ot>=h||ot>x((a-K)/et))&&O("overflow"),K+=ot*et,$=rt<=nt?u:rt>=nt+l?l:rt-nt,!(ot<$);rt+=h)wt=h-$,et>x(a/wt)&&O("overflow"),et*=wt;V=w.length+1,nt=M(K-pt,V,pt==0),x(K/V)>a-dt&&O("overflow"),dt+=x(K/V),K%=V,w.splice(K++,0,dt)}return L(w)}function H(C){var w,B,V,K,dt,nt,st,xt,Tt,pt,et,rt=[],ot,$,wt,Pt;for(C=D(C),ot=C.length,w=p,B=0,dt=d,nt=0;nt<ot;++nt)et=C[nt],et<128&&rt.push(T(et));for(V=K=rt.length,K&&rt.push(v);V<ot;){for(st=a,nt=0;nt<ot;++nt)et=C[nt],et>=w&&et<st&&(st=et);for($=V+1,st-w>x((a-B)/$)&&O("overflow"),B+=(st-w)*$,w=st,nt=0;nt<ot;++nt)if(et=C[nt],et<w&&++B>a&&O("overflow"),et==w){for(xt=B,Tt=h;pt=Tt<=dt?u:Tt>=dt+l?l:Tt-dt,!(xt<pt);Tt+=h)Pt=xt-pt,wt=h-pt,rt.push(T(Y(pt+Pt%wt,0))),xt=x(Pt/wt);rt.push(T(Y(xt,0))),dt=M(B,$,V==K),B=0,++V}++B,++w}return rt.join("")}function A(C){return S(C,function(w){return _.test(w)?I(w.slice(4).toLowerCase()):w})}function N(C){return S(C,function(w){return m.test(w)?"xn--"+H(w):w})}if(o={version:"1.3.2",ucs2:{decode:D,encode:L},decode:I,encode:H,toASCII:N,toUnicode:A},i&&n)if(r.exports==i)n.exports=o;else for(E in o)o.hasOwnProperty(E)&&(i[E]=o[E]);else t.punycode=o})(fr)})(xr,xr.exports);var Ua={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}},Ve={};function Ga(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var ka=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 o=1e3;i&&typeof i.maxKeys=="number"&&(o=i.maxKeys);var a=r.length;o>0&&a>o&&(a=o);for(var h=0;h<a;++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),Ga(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""}},Ha=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(o){return s+encodeURIComponent(qe(o))}).join(e):s+encodeURIComponent(qe(r[n]))}).join(e):i?encodeURIComponent(qe(i))+t+encodeURIComponent(qe(r)):""};Ve.decode=Ve.parse=ka,Ve.encode=Ve.stringify=Ha;var Xa=xr.exports,Wt=Ua,Wa=Ci,ja=eh,za=th;function Dt(){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 Ya=/^([a-z0-9.+-]+:)/i,Va=/:[0-9]*$/,qa=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,$a=["<",">",'"',"`"," ","\r",`
2
+ `," "],Za=["{","}","|","\\","^","`"].concat($a),br=["'"].concat(Za),os=["%","/","?",";","#"].concat(br),as=["/","?","#"],Ka=255,hs=/^[+a-z0-9A-Z_-]{0,63}$/,Qa=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ja={javascript:!0,"javascript:":!0},Tr={javascript:!0,"javascript:":!0},Ie={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Er=Ve;function Ci(r,e,t){if(r&&Wt.isObject(r)&&r instanceof Dt)return r;var i=new Dt;return i.parse(r,e,t),i}Dt.prototype.parse=function(r,e,t){if(!Wt.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),o=/\\/g;s[0]=s[0].replace(o,"/"),r=s.join(n);var a=r;if(a=a.trim(),!t&&r.split("#").length===1){var h=qa.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],e?this.query=Er.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=Ya.exec(a);if(u){u=u[0];var l=u.toLowerCase();this.protocol=l,a=a.substr(u.length)}if(t||u||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=a.substr(0,2)==="//";f&&!(u&&Tr[u])&&(a=a.substr(2),this.slashes=!0)}if(!Tr[u]&&(f||u&&!Ie[u])){for(var c=-1,d=0;d<as.length;d++){var p=a.indexOf(as[d]);p!==-1&&(c===-1||p<c)&&(c=p)}var v,_;c===-1?_=a.lastIndexOf("@"):_=a.lastIndexOf("@",c),_!==-1&&(v=a.slice(0,_),a=a.slice(_+1),this.auth=decodeURIComponent(v)),c=-1;for(var d=0;d<os.length;d++){var p=a.indexOf(os[d]);p!==-1&&(c===-1||p<c)&&(c=p)}c===-1&&(c=a.length),this.host=a.slice(0,c),a=a.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(hs)){for(var x="",T=0,E=b.length;T<E;T++)b.charCodeAt(T)>127?x+="x":x+=b[T];if(!x.match(hs)){var O=y.slice(0,d),P=y.slice(d+1),S=b.match(Qa);S&&(O.push(S[1]),P.unshift(S[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=O.join(".");break}}}this.hostname.length>Ka?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=Xa.toASCII(this.hostname));var D=this.port?":"+this.port:"",L=this.hostname||"";this.host=L+D,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!Ja[l])for(var d=0,g=br.length;d<g;d++){var k=br[d];if(a.indexOf(k)!==-1){var Y=encodeURIComponent(k);Y===k&&(Y=escape(k)),a=a.split(k).join(Y)}}var M=a.indexOf("#");M!==-1&&(this.hash=a.substr(M),a=a.slice(0,M));var I=a.indexOf("?");if(I!==-1?(this.search=a.substr(I),this.query=a.substr(I+1),e&&(this.query=Er.parse(this.query)),a=a.slice(0,I)):e&&(this.search="",this.query={}),a&&(this.pathname=a),Ie[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var D=this.pathname||"",H=this.search||"";this.path=D+H}return this.href=this.format(),this};function th(r){return Wt.isString(r)&&(r=Ci(r)),r instanceof Dt?r.format():Dt.prototype.format.call(r)}Dt.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&&Wt.isObject(this.query)&&Object.keys(this.query).length&&(s=Er.stringify(this.query));var o=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Ie[e])&&n!==!1?(n="//"+(n||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):n||(n=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),t=t.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),e+n+t+o+i};function eh(r,e){return Ci(r,!1,!0).resolve(e)}Dt.prototype.resolve=function(r){return this.resolveObject(Ci(r,!1,!0)).format()},Dt.prototype.resolveObject=function(r){if(Wt.isString(r)){var e=new Dt;e.parse(r,!1,!0),r=e}for(var t=new Dt,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 o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(t[h]=r[h])}return Ie[t.protocol]&&t.hostname&&!t.pathname&&(t.path=t.pathname="/"),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!Ie[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&&!Tr[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&&!Ie[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(!Wt.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,(!Wt.isNull(t.pathname)||!Wt.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],E=(t.host||r.host||y.length>1)&&(T==="."||T==="..")||T==="",O=0,P=y.length;P>=0;P--)T=y[P],T==="."?y.splice(P,1):T===".."?(y.splice(P,1),O++):O&&(y.splice(P,1),O--);if(!_&&!m)for(;O--;O)y.unshift("..");_&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),E&&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),(!Wt.isNull(t.pathname)||!Wt.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},Dt.prototype.parseHost=function(){var r=this.host,e=Va.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 Oe={parse:Wa,format:za,resolve:ja};F.RETINA_PREFIX=/@([0-9\.]+)x/,F.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var us=!1,ls="6.5.8";function ih(r){var e;if(!us){if(F.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[`
3
+ %c %c %c PixiJS `+ls+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥
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 "+ls+" - "+r+" - http://www.pixijs.com/");us=!0}}var wr;function rh(){return typeof wr>"u"&&(wr=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}}()),wr}var nh="#f0f8ff",sh="#faebd7",oh="#00ffff",ah="#7fffd4",hh="#f0ffff",uh="#f5f5dc",lh="#ffe4c4",fh="#000000",ch="#ffebcd",dh="#0000ff",ph="#8a2be2",vh="#a52a2a",_h="#deb887",mh="#5f9ea0",gh="#7fff00",yh="#d2691e",xh="#ff7f50",bh="#6495ed",Th="#fff8dc",Eh="#dc143c",wh="#00ffff",Sh="#00008b",Ph="#008b8b",Ch="#b8860b",Ah="#a9a9a9",Rh="#006400",Ih="#a9a9a9",Oh="#bdb76b",Mh="#8b008b",Dh="#556b2f",Fh="#ff8c00",Nh="#9932cc",Bh="#8b0000",Lh="#e9967a",Uh="#8fbc8f",Gh="#483d8b",kh="#2f4f4f",Hh="#2f4f4f",Xh="#00ced1",Wh="#9400d3",jh="#ff1493",zh="#00bfff",Yh="#696969",Vh="#696969",qh="#1e90ff",$h="#b22222",Zh="#fffaf0",Kh="#228b22",Qh="#ff00ff",Jh="#dcdcdc",tu="#f8f8ff",eu="#daa520",iu="#ffd700",ru="#808080",nu="#008000",su="#adff2f",ou="#808080",au="#f0fff0",hu="#ff69b4",uu="#cd5c5c",lu="#4b0082",fu="#fffff0",cu="#f0e68c",du="#fff0f5",pu="#e6e6fa",vu="#7cfc00",_u="#fffacd",mu="#add8e6",gu="#f08080",yu="#e0ffff",xu="#fafad2",bu="#d3d3d3",Tu="#90ee90",Eu="#d3d3d3",wu="#ffb6c1",Su="#ffa07a",Pu="#20b2aa",Cu="#87cefa",Au="#778899",Ru="#778899",Iu="#b0c4de",Ou="#ffffe0",Mu="#00ff00",Du="#32cd32",Fu="#faf0e6",Nu="#ff00ff",Bu="#800000",Lu="#66cdaa",Uu="#0000cd",Gu="#ba55d3",ku="#9370db",Hu="#3cb371",Xu="#7b68ee",Wu="#00fa9a",ju="#48d1cc",zu="#c71585",Yu="#191970",Vu="#f5fffa",qu="#ffe4e1",$u="#ffe4b5",Zu="#ffdead",Ku="#000080",Qu="#fdf5e6",Ju="#808000",tl="#6b8e23",el="#ffa500",il="#ff4500",rl="#da70d6",nl="#eee8aa",sl="#98fb98",ol="#afeeee",al="#db7093",hl="#ffefd5",ul="#ffdab9",ll="#cd853f",fl="#ffc0cb",cl="#dda0dd",dl="#b0e0e6",pl="#800080",vl="#663399",_l="#ff0000",ml="#bc8f8f",gl="#4169e1",yl="#8b4513",xl="#fa8072",bl="#f4a460",Tl="#2e8b57",El="#fff5ee",wl="#a0522d",Sl="#c0c0c0",Pl="#87ceeb",Cl="#6a5acd",Al="#708090",Rl="#708090",Il="#fffafa",Ol="#00ff7f",Ml="#4682b4",Dl="#d2b48c",Fl="#008080",Nl="#d8bfd8",Bl="#ff6347",Ll="#40e0d0",Ul="#ee82ee",Gl="#f5deb3",kl="#ffffff",Hl="#f5f5f5",Xl="#ffff00",Wl="#9acd32",jl={aliceblue:nh,antiquewhite:sh,aqua:oh,aquamarine:ah,azure:hh,beige:uh,bisque:lh,black:fh,blanchedalmond:ch,blue:dh,blueviolet:ph,brown:vh,burlywood:_h,cadetblue:mh,chartreuse:gh,chocolate:yh,coral:xh,cornflowerblue:bh,cornsilk:Th,crimson:Eh,cyan:wh,darkblue:Sh,darkcyan:Ph,darkgoldenrod:Ch,darkgray:Ah,darkgreen:Rh,darkgrey:Ih,darkkhaki:Oh,darkmagenta:Mh,darkolivegreen:Dh,darkorange:Fh,darkorchid:Nh,darkred:Bh,darksalmon:Lh,darkseagreen:Uh,darkslateblue:Gh,darkslategray:kh,darkslategrey:Hh,darkturquoise:Xh,darkviolet:Wh,deeppink:jh,deepskyblue:zh,dimgray:Yh,dimgrey:Vh,dodgerblue:qh,firebrick:$h,floralwhite:Zh,forestgreen:Kh,fuchsia:Qh,gainsboro:Jh,ghostwhite:tu,goldenrod:eu,gold:iu,gray:ru,green:nu,greenyellow:su,grey:ou,honeydew:au,hotpink:hu,indianred:uu,indigo:lu,ivory:fu,khaki:cu,lavenderblush:du,lavender:pu,lawngreen:vu,lemonchiffon:_u,lightblue:mu,lightcoral:gu,lightcyan:yu,lightgoldenrodyellow:xu,lightgray:bu,lightgreen:Tu,lightgrey:Eu,lightpink:wu,lightsalmon:Su,lightseagreen:Pu,lightskyblue:Cu,lightslategray:Au,lightslategrey:Ru,lightsteelblue:Iu,lightyellow:Ou,lime:Mu,limegreen:Du,linen:Fu,magenta:Nu,maroon:Bu,mediumaquamarine:Lu,mediumblue:Uu,mediumorchid:Gu,mediumpurple:ku,mediumseagreen:Hu,mediumslateblue:Xu,mediumspringgreen:Wu,mediumturquoise:ju,mediumvioletred:zu,midnightblue:Yu,mintcream:Vu,mistyrose:qu,moccasin:$u,navajowhite:Zu,navy:Ku,oldlace:Qu,olive:Ju,olivedrab:tl,orange:el,orangered:il,orchid:rl,palegoldenrod:nl,palegreen:sl,paleturquoise:ol,palevioletred:al,papayawhip:hl,peachpuff:ul,peru:ll,pink:fl,plum:cl,powderblue:dl,purple:pl,rebeccapurple:vl,red:_l,rosybrown:ml,royalblue:gl,saddlebrown:yl,salmon:xl,sandybrown:bl,seagreen:Tl,seashell:El,sienna:wl,silver:Sl,skyblue:Pl,slateblue:Cl,slategray:Al,slategrey:Rl,snow:Il,springgreen:Ol,steelblue:Ml,tan:Dl,teal:Fl,thistle:Nl,tomato:Bl,turquoise:Ll,violet:Ul,wheat:Gl,white:kl,whitesmoke:Hl,yellow:Xl,yellowgreen:Wl};function Me(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 fs(r){var e=r.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function cs(r){return typeof r=="string"&&(r=jl[r.toLowerCase()]||r,r[0]==="#"&&(r=r.slice(1))),parseInt(r,16)}function zl(){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 ds=zl();function ps(r,e){return ds[e?1:0][r]}function Yl(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 Sr(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 vs(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 Vl(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 _s(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 ms(r){return!(r&r-1)&&!!r}function gs(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 De(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 Fe(r){return r===0?0:r<0?-1:1}var ql=0;function _e(){return++ql}var ys={};function Ft(r,e,t){if(t===void 0&&(t=3),!ys[e]){var i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",e+`
6
+ Deprecated since v`+r):(i=i.split(`
7
+ `).splice(t).join(`
8
+ `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+`
9
+ Deprecated since v`+r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+`
10
+ Deprecated since v`+r),console.warn(i))),ys[e]=!0}}var xs={},$t=Object.create(null),me=Object.create(null),bs=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 $l(r){var e=r.width,t=r.height,i=r.getContext("2d",{willReadFrequently:!0}),n=i.getImageData(0,0,e,t),s=n.data,o=s.length,a={top:null,left:null,right:null,bottom:null},h=null,u,l,f;for(u=0;u<o;u+=4)s[u+3]!==0&&(l=u/4%e,f=~~(u/4/e),a.top===null&&(a.top=f),(a.left===null||l<a.left)&&(a.left=l),(a.right===null||a.right<l)&&(a.right=l+1),(a.bottom===null||a.bottom<f)&&(a.bottom=f));return a.top!==null&&(e=a.right-a.left,t=a.bottom-a.top+1,h=i.getImageData(a.left,a.top,e,t)),{height:t,width:e,data:h}}var Ri;function Zl(r,e){if(e===void 0&&(e=globalThis.location),r.indexOf("data:")===0)return"";e=e||globalThis.location,Ri||(Ri=document.createElement("a")),Ri.href=r;var t=Oe.parse(Ri.href),i=!t.port&&e.port===""||t.port===e.port;return t.hostname!==e.hostname||!i||t.protocol!==e.protocol?"anonymous":""}function Ii(r,e){var t=F.RETINA_PREFIX.exec(r);return t?parseFloat(t[1]):e!==void 0?e:1}F.SORTABLE_CHILDREN=!1;var Oi=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,o=e.d,a=e.tx,h=e.ty,u=i*t.x+s*t.y+a,l=n*t.x+o*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,o=e[0],a=e[1];t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,s=a>s?a:s,o=e[2],a=e[3],t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,s=a>s?a:s,o=e[4],a=e[5],t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,s=a>s?a:s,o=e[6],a=e[7],t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,s=a>s?a: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 o=e.a,a=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,_=o*t+h*i+l,m=a*t+u*i+f;c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=o*n+h*i+l,m=a*n+u*i+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=o*t+h*s+l,m=a*t+u*s+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=o*n+h*s+l,m=a*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,o=this.maxX,a=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,o=u>o?u:o,a=l>a?l:a}this.minX=n,this.minY=s,this.maxX=o,this.maxY=a},r.prototype.addVertices=function(e,t,i,n){this.addVerticesMatrix(e.worldTransform,t,i,n)},r.prototype.addVerticesMatrix=function(e,t,i,n,s,o){s===void 0&&(s=0),o===void 0&&(o=s);for(var a=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=a*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-o),_=Math.max(_,x+o)}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,o=e.maxY<t.maxY?e.maxY:t.maxY;if(i<=s&&n<=o){var a=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<a?i:a,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=o>l?o: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,o=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(i<=s&&n<=o){var a=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<a?i:a,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=o>l?o: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,o){e-=s,t-=o,i+=s,n+=o,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 Pr=function(r,e){return Pr=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])},Pr(r,e)};function Cr(r,e){Pr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ct=function(r){Cr(e,r);function e(){var t=r.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new Ln,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 Oi,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 Oi);var i=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var s=this._bounds,o=this._boundsID;this._bounds=this._localBounds;var a=this.getBounds(!1,t);return this.parent=n,this.transform=i,this._bounds=s,this._bounds.updateID+=this._boundsID-o,a},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,o,a,h,u,l){return t===void 0&&(t=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=1),o===void 0&&(o=0),a===void 0&&(a=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=o,this.skew.x=a,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 Ts),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*Qo},set:function(t){this.transform.rotation=t*Jo},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}(We),Ts=function(r){Cr(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.sortDirty=null,t}return e}(ct);ct.prototype.displayObjectUpdateTransform=ct.prototype.updateTransform;function Kl(r,e){return r.zIndex===e.zIndex?r._lastSortedIndex-e._lastSortedIndex:r.zIndex-e.zIndex}var Et=function(r){Cr(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 o=i[0];o.parent&&o.parent.removeChild(o),o.parent=this,this.sortDirty=!0,o.transform._parentID=-1,this.children.push(o),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",o,this,this.children.length-1),o.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);De(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 o=i[0],a=this.children.indexOf(o);if(a===-1)return null;o.parent=null,o.transform._parentID=-1,De(this.children,a,1),this._boundsID++,this.onChildrenChange(a),o.emit("removed",this),this.emit("childRemoved",o,this,a)}return i[0]},e.prototype.removeChildAt=function(t){var i=this.getChildAt(t);return i.parent=null,i.transform._parentID=-1,De(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,o=s-n,a;if(o>0&&o<=s){a=this.children.splice(n,o);for(var h=0;h<a.length;++h)a[h].parent=null,a[h].transform&&(a[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(var h=0;h<a.length;++h)a[h].emit("removed",this),this.emit("childRemoved",a[h],this,h);return a}else if(o===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(Kl),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,o=this.children.length;s<o;++s){var a=this.children[s];a.visible&&a.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 o=0,a=this.children.length;o<a;++o){var h=this.children[o],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 o=i&&this._enabledFilters&&this._enabledFilters.length||n&&(!n.isMaskData||n.enabled&&(n.autoDetect||n.type!==vt.NONE));if(o&&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,a=this.children.length;s<a;++s)this.children[s].render(t)}o&&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}(ct);Et.prototype.containerUpdateTransform=Et.prototype.updateTransform;var $e=function(){return $e=Object.assign||function(e){for(var t=arguments,i,n=1,s=arguments.length;n<s;n++){i=t[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},$e.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 Es=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=$e($e({},e),{ref:r})}if(typeof r=="object")r=$e({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Zt={_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(Es).forEach(function(n){n.type.forEach(function(s){var o,a;return(a=(o=e._removeHandlers)[s])===null||a===void 0?void 0:a.call(o,n)})}),this},add:function(){for(var r=arguments,e=this,t=[],i=0;i<arguments.length;i++)t[i]=r[i];return t.map(Es).forEach(function(n){n.type.forEach(function(s){var o=e._addHandlers,a=e._queue;o[s]?o[s](n):(a[s]=a[s]||[],a[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(o){return e(o)}),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 bt=function(){function r(e){this.items=[],this._name=e,this._aliasCount=0}return r.prototype.emit=function(e,t,i,n,s,o,a,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,o,a,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(bt.prototype,{dispatch:{value:bt.prototype.emit},run:{value:bt.prototype.emit}});F.TARGET_FPMS=.06;var Kt;(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"})(Kt||(Kt={}));var Ar=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}(),yt=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 Ar(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=Kt.NORMAL),this._addListener(new Ar(e,t,i))},r.prototype.addOnce=function(e,t,i){return i===void 0&&(i=Kt.NORMAL),this._addListener(new Ar(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}(),Ql=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,Kt.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?yt.shared:new yt,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=Xt.any?Vt.WEBGL:Vt.WEBGL2,F.STRICT_TEXTURE_CACHE=!1;var Rr=[];function ws(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=Rr.length-1;n>=0;--n){var s=Rr[n];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var Ir=function(r,e){return Ir=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])},Ir(r,e)};function it(r,e){Ir(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Or=function(){return Or=Object.assign||function(e){for(var t=arguments,i,n=1,s=arguments.length;n<s;n++){i=t[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},Or.apply(this,arguments)};function Jl(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 Ze=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 bt("setRealSize"),this.onUpdate=new bt("update"),this.onError=new bt("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}(),Ke=function(r){it(e,r);function e(t,i){var n=this,s=i||{},o=s.width,a=s.height;if(!o||!a)throw new Error("BufferResource width or height invalid");return n=r.call(this,o,a)||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===Ot.UNPACK);var o=i.realWidth,a=i.realHeight;return n.width===o&&n.height===a?s.texSubImage2D(i.target,0,0,0,o,a,i.format,n.type,this.data):(n.width=o,n.height=a,s.texImage2D(i.target,0,n.internalFormat,o,a,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}(Ze),tf={scaleMode:Gt.NEAREST,format:R.RGBA,alphaMode:Ot.NPM},q=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,o=i.mipmap,a=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 Ze)&&(t=ws(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=o!==void 0?o:F.MIPMAP_TEXTURES,n.anisotropicLevel=a!==void 0?a: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||U.UNSIGNED_BYTE,n.target=p||pe.TEXTURE_2D,n.alphaMode=s!==void 0?s:Ot.UNPACK,n.uid=_e(),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=ms(this.realWidth)&&ms(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 me[this.cacheId],delete $t[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",o=null;if(s)o=t;else{if(!t._pixiId){var a=i&&i.pixiIdPrefix||"pixiid";t._pixiId=a+"_"+_e()}o=t._pixiId}var h=me[o];if(s&&n&&!h)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return h||(h=new e(t,i),h.cacheId=o,e.addToCache(h,o)),h},e.fromBuffer=function(t,i,n,s){t=t||new Float32Array(i*n*4);var o=new Ke(t,{width:i,height:n}),a=t instanceof Float32Array?U.FLOAT:U.UNSIGNED_BYTE;return new e(o,Object.assign({},tf,s||{width:i,height:n,type:a}))},e.addToCache=function(t,i){i&&(t.textureCacheIds.indexOf(i)===-1&&t.textureCacheIds.push(i),me[i]&&console.warn("BaseTexture added to the cache with an id ["+i+"] that already had an entry"),me[i]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var i=me[t];if(i){var n=i.textureCacheIds.indexOf(t);return n>-1&&i.textureCacheIds.splice(n,1),delete me[t],i}}else if(t&&t.textureCacheIds){for(var s=0;s<t.textureCacheIds.length;++s)delete me[t.textureCacheIds[s]];return t.textureCacheIds.length=0,t}return null},e._globalBatch=0,e}(We),Ss=function(r){it(e,r);function e(t,i){var n=this,s=i||{},o=s.width,a=s.height;n=r.call(this,o,a)||this,n.items=[],n.itemDirtyIds=[];for(var h=0;h<t;h++){var u=new q;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 Ze?this.addResourceAt(t[n],n):this.addResourceAt(ws(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],o=s.realWidth,a=s.realHeight;return t.resize(o,a),Promise.resolve(t)}),this._load},e}(Ze),ef=function(r){it(e,r);function e(t,i){var n=this,s=i||{},o=s.width,a=s.height,h,u;return Array.isArray(t)?(h=t,u=t.length):u=t,n=r.call(this,u,{width:o,height:a})||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=pe.TEXTURE_2D_ARRAY},e.prototype.upload=function(t,i,n){var s=this,o=s.length,a=s.itemDirtyIds,h=s.items,u=t.gl;n.dirtyId<0&&u.texImage3D(u.TEXTURE_2D_ARRAY,0,n.internalFormat,this._width,this._height,o,0,i.format,n.type,null);for(var l=0;l<o;l++){var f=h[l];a[l]<f.dirtyId&&(a[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}(Ss),ie=function(r){it(e,r);function e(t){var i=this,n=t,s=n.naturalWidth||n.videoWidth||n.width,o=n.naturalHeight||n.videoHeight||n.height;return i=r.call(this,s,o)||this,i.source=t,i.noSubImage=!1,i}return e.crossOrigin=function(t,i,n){n===void 0&&i.indexOf("data:")!==0?t.crossOrigin=Zl(i):n!==!1&&(t.crossOrigin=typeof n=="string"?n:"anonymous")},e.prototype.upload=function(t,i,n,s){var o=t.gl,a=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 o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===Ot.UNPACK),!this.noSubImage&&i.target===o.TEXTURE_2D&&n.width===a&&n.height===h?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i.format,n.type,s):(n.width=a,n.height=h,o.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}(Ze),rf=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}(ie),nf=function(r){it(e,r);function e(t,i){var n=this,s=i||{},o=s.width,a=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:o,height:a})||this;for(var l=0;l<e.SIDES;l++)n.items[l].target=pe.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=pe.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=pe.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,o=0;o<e.SIDES;o++){var a=this.items[o];(s[o]<a.dirtyId||n.dirtyId<i.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,n),s[o]=a.dirtyId):s[o]<-1&&(t.gl.texImage2D(a.target,0,n.internalFormat,i.realWidth,i.realHeight,0,i.format,n.type,null),s[o]=-1))}return!0},e.test=function(t){return Array.isArray(t)&&t.length===e.SIDES},e.SIDES=6,e}(Ss),Ps=function(r){it(e,r);function e(t,i){var n=this;if(i=i||{},!(t instanceof HTMLImageElement)){var s=new Image;ie.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 o=i.source;i.url=o.src;var a=function(){i.destroyed||(o.onload=null,o.onerror=null,i.resize(o.width,o.height),i._load=null,i.createBitmap?n(i.process()):n(i))};o.complete&&o.src?a():(o.onload=a,o.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(o){return o.blob()}).then(function(o){return n(o,0,0,i.width,i.height,{premultiplyAlpha:t.alphaMode===null||t.alphaMode===Ot.UNPACK?"premultiply":"none"})}).then(function(o){return t.destroyed?Promise.reject():(t.bitmap=o,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,o=i._glTextures;for(var a in o){var h=o[a];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}(ie),sf=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;ie.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 o=n*t.scale,a=s*t.scale;(t._overrideWidth||t._overrideHeight)&&(o=t._overrideWidth||t._overrideHeight/s*n,a=t._overrideHeight||t._overrideWidth/n*s),o=Math.round(o),a=Math.round(a);var h=t.source;h.width=o,h.height=a,h._pixiId="canvas_"+_e(),h.getContext("2d").drawImage(i,0,0,n,s,0,0,o,a),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}(ie),of=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 o=t[0].src||t[0];ie.crossOrigin(s,o,i.crossorigin);for(var a=0;a<t.length;++a){var h=document.createElement("source"),u=t[a],l=u.src,f=u.mime;l=l||t[a];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=yt.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&&(yt.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(yt.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&&(yt.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?(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(yt.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}(ie),af=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}(ie);Rr.push(Ps,af,rf,of,sf,Ke,nf,ef);var hf=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===Ot.UNPACK);var o=i.realWidth,a=i.realHeight;return n.width===o&&n.height===a?s.texSubImage2D(i.target,0,0,0,o,a,i.format,n.type,this.data):(n.width=o,n.height=a,s.texImage2D(i.target,0,n.internalFormat,o,a,0,i.format,n.type,this.data)),!0},e}(Ke),Mr=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 bt("disposeFramebuffer"),this.multisample=lt.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 q(null,{scaleMode:Gt.NEAREST,resolution:1,mipmap:It.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(e){return this.depthTexture=e||new q(new hf(null,{width:this.width,height:this.height}),{scaleMode:Gt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:It.OFF,format:R.DEPTH_COMPONENT,type:U.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}(),Cs=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],o=arguments[2],a=arguments[3];t={width:n,height:s,scaleMode:o,resolution:a}}return t.width=t.width||100,t.height=t.height||100,t.multisample=t.multisample!==void 0?t.multisample:lt.NONE,i=r.call(this,null,t)||this,i.mipmap=It.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new Mr(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}(q),As=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 o=e.width/2/n,a=e.height/2/s,h=e.x/n+o,u=e.y/s+a;i=at.add(i,at.NW),this.x0=h+o*at.uX(i),this.y0=u+a*at.uY(i),i=at.add(i,2),this.x1=h+o*at.uX(i),this.y1=u+a*at.uY(i),i=at.add(i,2),this.x2=h+o*at.uX(i),this.y2=u+a*at.uY(i),i=at.add(i,2),this.x3=h+o*at.uX(i),this.y3=u+a*at.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}(),Rs=new As;function Mi(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var X=function(r){it(e,r);function e(t,i,n,s,o,a){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=Rs,h.uvMatrix=null,h.orig=n||i,h._rotate=Number(o||0),o===!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=a?new j(a.x,a.y):new j(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&&$t[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===Rs&&(this._uvs=new As),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",o=null;if(s)o=t;else if(t instanceof q){if(!t.cacheId){var a=i&&i.pixiIdPrefix||"pixiid";t.cacheId=a+"-"+_e(),q.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){var a=i&&i.pixiIdPrefix||"pixiid";t._pixiId=a+"_"+_e()}o=t._pixiId}var h=$t[o];if(s&&n&&!h)throw new Error('The cacheId "'+o+'" does not exist in TextureCache.');return!h&&!(t instanceof q)?(i.resolution||(i.resolution=Ii(t)),h=new e(new q(t,i)),h.baseTexture.cacheId=o,q.addToCache(h.baseTexture,o),e.addToCache(h,o)):!h&&t instanceof q&&(h=new e(t),e.addToCache(h,o)),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),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(function(){return Promise.resolve(s)})},e.fromBuffer=function(t,i,n,s){return new e(q.fromBuffer(t,i,n,s))},e.fromLoader=function(t,i,n,s){var o=new q(t,Object.assign({scaleMode:F.SCALE_MODE,resolution:Ii(i)},s)),a=o.resource;a instanceof Ps&&(a.url=i);var h=new e(o);return n||(n=i),q.addToCache(h.baseTexture,n),e.addToCache(h,n),n!==i&&(q.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),$t[i]&&console.warn("Texture added to the cache with an id ["+i+"] that already had an entry"),$t[i]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var i=$t[t];if(i){var n=i.textureCacheIds.indexOf(t);return n>-1&&i.textureCacheIds.splice(n,1),delete $t[t],i}}else if(t&&t.textureCacheIds){for(var s=0;s<t.textureCacheIds.length;++s)$t[t.textureCacheIds[s]]===t&&delete $t[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,o=t.height,a=i+s>this.baseTexture.width,h=n+o>this.baseTexture.height;if(a||h){var u=a&&h?"and":"or",l="X: "+i+" + "+s+" = "+(i+s)+" > "+this.baseTexture.width,f="Y: "+n+" + "+o+" = "+(n+o)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(l+" "+u+" "+f))}this.valid=s&&o&&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 q),Mi(e._EMPTY),Mi(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(q.from(t)),Mi(e._WHITE),Mi(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(We),ge=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,o=Math.round(t*s)/s,a=Math.round(i*s)/s;this.valid=o>0&&a>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=a,n&&this.baseTexture.resize(o,a),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"&&(Ft("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 Cs(t))},e}(X),uf=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=lt.NONE);var n=new Cs(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new ge(n)},r.prototype.getOptimalTexture=function(e,t,i,n){i===void 0&&(i=1),n===void 0&&(n=lt.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 o=this.texturePool[s].pop();return o||(o=this.createTexture(e,t,n)),o.filterPoolKey=s,o.setResolution(i),o},r.prototype.getFilterTexture=function(e,t,i){var n=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||lt.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}(),Is=function(){function r(e,t,i,n,s,o,a){t===void 0&&(t=0),i===void 0&&(i=!1),n===void 0&&(n=U.FLOAT),this.buffer=e,this.size=t,this.normalized=i,this.type=n,this.stride=s,this.start=o,this.instance=a}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}(),lf=0,mt=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=lf++,this.disposeRunner=new bt("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===Ht.ELEMENT_ARRAY_BUFFER},set:function(e){this.type=e?Ht.ELEMENT_ARRAY_BUFFER:Ht.ARRAY_BUFFER},enumerable:!1,configurable:!0}),r.from=function(e){return e instanceof Array&&(e=new Float32Array(e)),new r(e)},r}(),ff={Float32Array,Uint32Array,Int32Array,Uint8Array};function cf(r,e){for(var t=0,i=0,n={},s=0;s<r.length;s++)i+=e[s],t+=r[s].length;for(var o=new ArrayBuffer(t*4),a=null,h=0,s=0;s<r.length;s++){var u=e[s],l=r[s],f=_s(l);n[f]||(n[f]=new ff[f](o)),a=n[f];for(var c=0;c<l.length;c++){var d=(c/u|0)*i+h,p=c%u;a[d+p]=l[c]}h+=u}return new Float32Array(o)}var Os={5126:4,5123:2,5121:1},df=0,pf={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},Qe=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=df++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new bt("disposeGeometry"),this.refCount=0}return r.prototype.addAttribute=function(e,t,i,n,s,o,a,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 mt||(t instanceof Array&&(t=new Float32Array(t)),t=new mt(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 Is(f,i,n,s,o,a,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 mt||(e instanceof Array&&(e=new Uint16Array(e)),e=new mt(e)),e.type=Ht.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 mt,n;for(n in this.attributes){var s=this.attributes[n],o=this.buffers[s.buffer];e.push(o.data),t.push(s.size*Os[s.type]/4),s.buffer=0}for(i.data=cf(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 mt(this.buffers[t].data.slice(0));for(var t in this.attributes){var i=this.attributes[t];e.attributes[t]=new Is(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=Ht.ELEMENT_ARRAY_BUFFER),e},r.merge=function(e){for(var t=new r,i=[],n=[],s=[],o,a=0;a<e.length;a++){o=e[a];for(var h=0;h<o.buffers.length;h++)n[h]=n[h]||0,n[h]+=o.buffers[h].data.length,s[h]=0}for(var a=0;a<o.buffers.length;a++)i[a]=new pf[_s(o.buffers[a].data)](n[a]),t.buffers[a]=new mt(i[a]);for(var a=0;a<e.length;a++){o=e[a];for(var h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,s[h]),s[h]+=o.buffers[h].data.length}if(t.attributes=o.attributes,o.indexBuffer){t.indexBuffer=t.buffers[o.buffers.indexOf(o.indexBuffer)],t.indexBuffer.type=Ht.ELEMENT_ARRAY_BUFFER;for(var u=0,l=0,f=0,c=0,a=0;a<o.buffers.length;a++)if(o.buffers[a]!==o.indexBuffer){c=a;break}for(var a in o.attributes){var d=o.attributes[a];(d.buffer|0)===c&&(l+=d.size*Os[d.type]/4)}for(var a=0;a<e.length;a++){for(var p=e[a].indexBuffer.data,h=0;h<p.length;h++)t.indexBuffer.data[h+f]+=u;u+=e[a].buffers[c].data.length/l,f+=p.length}}return t},r}(),vf=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}(Qe),Ms=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 mt(t.vertices),t.uvBuffer=new mt(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}(Qe),_f=0,ye=function(){function r(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=_f++,this.static=!!t,this.ubo=!!i,e instanceof mt?(this.buffer=e,this.buffer.type=Ht.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new mt(new Float32Array(1)),this.buffer.type=Ht.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}(),mf=function(){function r(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=lt.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}(),Di=[new j,new j,new j,new j],Dr=new _t,gf=function(){function r(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new uf,this.texturePool.setScreenSize(e.view),this.statePool=[],this.quad=new vf,this.quadUv=new Ms,this.tempRect=new z,this.activeState={},this.globalUniforms=new ye({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,o=this.defaultFilterStack,a=this.statePool.pop()||new mf,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)}o.length===1&&(this.defaultFilterStack[0].renderTexture=h.current),o.push(a),a.resolution=u,a.multisample=l,a.legacy=d,a.target=e,a.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),a.sourceFrame.pad(f);var _=this.tempRect.copyFrom(h.sourceFrame);s.projection.transform&&this.transformAABB(Dr.copyFrom(s.projection.transform).invert(),_),c?(a.sourceFrame.fit(_),(a.sourceFrame.width<=0||a.sourceFrame.height<=0)&&(a.sourceFrame.width=0,a.sourceFrame.height=0)):a.sourceFrame.intersects(_)||(a.sourceFrame.width=0,a.sourceFrame.height=0),this.roundFrame(a.sourceFrame,h.current?h.current.resolution:s.resolution,h.sourceFrame,h.destinationFrame,s.projection.transform),a.renderTexture=this.getOptimalFilterTexture(a.sourceFrame.width,a.sourceFrame.height,u,l),a.filters=t,a.destinationFrame.width=a.renderTexture.width,a.destinationFrame.height=a.renderTexture.height;var m=this.tempRect;m.x=0,m.y=0,m.width=a.sourceFrame.width,m.height=a.sourceFrame.height,a.renderTexture.filterFrame=a.sourceFrame,a.bindingSourceFrame.copyFrom(h.sourceFrame),a.bindingDestinationFrame.copyFrom(h.destinationFrame),a.transform=s.projection.transform,s.projection.transform=null,h.bind(a.renderTexture,a.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,o=n.inputPixel,a=n.inputClamp;if(s[0]=t.destinationFrame.width,s[1]=t.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],o[0]=Math.round(s[0]*t.resolution),o[1]=Math.round(s[1]*t.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=t.sourceFrame.width*s[2]-.5*o[2],a[3]=t.sourceFrame.height*s[3]-.5*o[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,Mt.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,Mt.CLEAR,t);var d=l;l=f,f=d}i[c].apply(this,l,u.renderTexture,Mt.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=Mt.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 o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,n.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=s.stateId&1||this.forceClear;(t===Mt.CLEAR||t===Mt.BLIT&&a)&&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(Rt.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(Rt.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(e,t){var i=this.activeState,n=i.sourceFrame,s=i.destinationFrame,o=t._texture.orig,a=e.set(s.width,0,0,s.height,n.x,n.y),h=t.worldTransform.copyTo(_t.TEMP_MATRIX);return h.invert(),a.prepend(h),a.scale(1/o.width,1/o.height),a.translate(t.anchor.x,t.anchor.y),a},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=lt.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||lt.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=Di[0],n=Di[1],s=Di[2],o=Di[3];i.set(t.left,t.top),n.set(t.left,t.bottom),s.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(i,i),e.apply(n,n),e.apply(s,s),e.apply(o,o);var a=Math.min(i.x,n.x,s.x,o.x),h=Math.min(i.y,n.y,s.y,o.y),u=Math.max(i.x,n.x,s.x,o.x),l=Math.max(i.y,n.y,s.y,o.y);t.x=a,t.y=h,t.width=u-a,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 o=s.a,a=s.b,h=s.c,u=s.d;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}s=s?Dr.copyFrom(s):Dr.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}(),Fi=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}(),yf=function(){function r(e){this.renderer=e,this.emptyRenderer=new Fi(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,o=e.ids,a=e.count,h=0,u=0;u<a;u++){var l=s[u],f=l._batchLocation;if(f>=0&&f<n&&t[f]===l){o[u]=f;continue}for(;h<n;){var c=t[h];if(c&&c._batchEnabled===i&&c._batchLocation===h){h++;continue}o[u]=h,l._batchLocation=h,t[h]=l;break}}},r.prototype.destroy=function(){this.renderer=null},r}(),Ds=0,xf=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=Ds++,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=Ds++,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>=Vt.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}(),bf=function(){function r(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=lt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),Tf=new z,Ef=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Mr(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===Vt.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 o=0;o<e.colorTextures.length;o++){var a=e.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}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=gi.COLOR|gi.DEPTH);var o=this.gl;o.clearColor(e,t,i,n),o.clear(s)},r.prototype.initFramebuffer=function(e){var t=this.gl,i=new bf(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 o=0;o<s;o++){var a=n[o],h=a.parentTextureArray||a;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,o=s.length;i.drawBuffers||(o=Math.min(o,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 a=[],h=0;h<o;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),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),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=lt.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=lt.NONE),i},r.prototype.blit=function(e,t,i){var n=this,s=n.current,o=n.renderer,a=n.gl,h=n.CONTEXT_UID;if(o.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 Mr(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=Tf,t.width=s.width,t.height=s.height),i||(i=t);var f=t.width===i.width&&t.height===i.height;this.bind(e),a.bindFramebuffer(a.READ_FRAMEBUFFER,u.framebuffer),a.blitFramebuffer(t.left,t.top,t.right,t.bottom,i.left,i.top,i.right,i.bottom,a.COLOR_BUFFER_BIT,f?a.NEAREST:a.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,o=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,o),t.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,t.multisample,s.DEPTH24_STENCIL8,i,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,i,n),t.stencil=o,s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,o)}}},r.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new z},r.prototype.destroy=function(){this.renderer=null},r}(),Fr={5126:4,5123:2,5121:1},wf=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===Vt.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,o){return n.vertexAttribDivisorANGLE(s,o)},e.drawElementsInstanced=function(s,o,a,h,u){return n.drawElementsInstancedANGLE(s,o,a,h,u)},e.drawArraysInstanced=function(s,o,a,h){return n.drawArraysInstancedANGLE(s,o,a,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 o=n[t.program.id]||this.initGeometryVao(e,t,s);this._activeGeometry=e,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):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 o in i)n[o]&&s.push(o,n[o].location);return s.join("-")},r.prototype.initGeometryVao=function(e,t,i){i===void 0&&(i=!0);var n=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,a=t.program;a.glPrograms[s]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,a);var h=this.getSignature(e,a),u=e.glVertexArrayObjects[this.CONTEXT_UID],l=u[h];if(l)return u[a.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&&a.attributeData[v]?c[v].size=a.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*Fr[c[v].type];for(var v in c){var _=c[v],m=_.size;_.stride===void 0&&(d[_.buffer]===m*Fr[_.type]?_.stride=0:_.stride=d[_.buffer]),_.start===void 0&&(_.start=p[_.buffer],p[_.buffer]+=m*Fr[_.type])}l=n.createVertexArray(),n.bindVertexArray(l);for(var y=0;y<f.length;y++){var g=f[y];o.bind(g),i&&g._glBuffers[s].refCount++}return this.activateVao(e,a),this._activeVao=l,u[a.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,o=e.buffers,a=(i=this.renderer)===null||i===void 0?void 0:i.buffer;if(e.disposeRunner.remove(this),!!n){if(a)for(var h=0;h<o.length;h++){var u=o[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!t&&a.dispose(o[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,o=e.buffers,a=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);var h=null;for(var u in a){var l=a[u],f=o[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,o=this._activeGeometry;if(o.indexBuffer){var a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?s.drawElementsInstanced(e,t||o.indexBuffer.data.length,h,(i||0)*a,n||1):s.drawElements(e,t||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?s.drawArraysInstanced(e,i,t||o.getSize(),n||1):s.drawArrays(e,i,t||o.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}(),Sf=function(){function r(e){e===void 0&&(e=null),this.type=vt.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=vt.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 Fs(r,e,t){var i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}function Ns(r,e){var t=r.getShaderSource(e).split(`
11
+ `).map(function(u,l){return l+": "+u}),i=r.getShaderInfoLog(e),n=i.split(`
12
+ `),s={},o=n.map(function(u){return parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(u){return u&&!s[u]?(s[u]=!0,!0):!1}),a=[""];o.forEach(function(u){t[u-1]="%c"+t[u-1]+"%c",a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var h=t.join(`
13
+ `);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,a),console.groupEnd()}function Pf(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||Ns(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||Ns(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}function Nr(r){for(var e=new Array(r),t=0;t<e.length;t++)e[t]=!1;return e}function Bs(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 Nr(2*e);case"bvec3":return Nr(3*e);case"bvec4":return Nr(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 Ls={},Je=Ls;function Cf(){if(Je===Ls||Je&&Je.isContextLost()){var r=F.ADAPTER.createCanvas(),e=void 0;F.PREFER_ENV>=Vt.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Je=e}return Je}var Ni;function Af(){if(!Ni){Ni=Ct.MEDIUM;var r=Cf();if(r&&r.getShaderPrecisionFormat){var e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);Ni=e.precision?Ct.HIGH:Ct.MEDIUM}}return Ni}function Us(r,e,t){if(r.substring(0,9)!=="precision"){var i=e;return e===Ct.HIGH&&t!==Ct.HIGH&&(i=Ct.MEDIUM),"precision "+i+` float;
14
+ `+r}else if(t!==Ct.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var Rf={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 Gs(r){return Rf[r]}var Bi=null,ks={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 Hs(r,e){if(!Bi){var t=Object.keys(ks);Bi={};for(var i=0;i<t.length;++i){var n=t[i];Bi[r[n]]=ks[n]}}return Bi[e]}var Ne=[{test:function(r){return r.type==="float"&&r.size===1&&!r.isArray},code:function(r){return`
15
+ if(uv["`+r+'"] !== ud["'+r+`"].value)
16
+ {
17
+ ud["`+r+'"].value = uv["'+r+`"]
18
+ gl.uniform1f(ud["`+r+'"].location, uv["'+r+`"])
19
+ }
20
+ `}},{test:function(r,e){return(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(e==null||e.castToBaseTexture!==void 0)},code:function(r){return`t = syncData.textureCount++;
21
+
22
+ renderer.texture.bind(uv["`+r+`"], t);
23
+
24
+ if(ud["`+r+`"].value !== t)
25
+ {
26
+ ud["`+r+`"].value = t;
27
+ gl.uniform1i(ud["`+r+`"].location, t);
28
+ ; // eslint-disable-line max-len
29
+ }`}},{test:function(r,e){return r.type==="mat3"&&r.size===1&&!r.isArray&&e.a!==void 0},code:function(r){return`
30
+ gl.uniformMatrix3fv(ud["`+r+'"].location, false, uv["'+r+`"].toArray(true));
31
+ `},codeUbo:function(r){return`
32
+ var `+r+"_matrix = uv."+r+`.toArray(true);
33
+
34
+ data[offset] = `+r+`_matrix[0];
35
+ data[offset+1] = `+r+`_matrix[1];
36
+ data[offset+2] = `+r+`_matrix[2];
37
+
38
+ data[offset + 4] = `+r+`_matrix[3];
39
+ data[offset + 5] = `+r+`_matrix[4];
40
+ data[offset + 6] = `+r+`_matrix[5];
41
+
42
+ data[offset + 8] = `+r+`_matrix[6];
43
+ data[offset + 9] = `+r+`_matrix[7];
44
+ data[offset + 10] = `+r+`_matrix[8];
45
+ `}},{test:function(r,e){return r.type==="vec2"&&r.size===1&&!r.isArray&&e.x!==void 0},code:function(r){return`
46
+ cv = ud["`+r+`"].value;
47
+ v = uv["`+r+`"];
48
+
49
+ if(cv[0] !== v.x || cv[1] !== v.y)
50
+ {
51
+ cv[0] = v.x;
52
+ cv[1] = v.y;
53
+ gl.uniform2f(ud["`+r+`"].location, v.x, v.y);
54
+ }`},codeUbo:function(r){return`
55
+ v = uv.`+r+`;
56
+
57
+ data[offset] = v.x;
58
+ data[offset+1] = v.y;
59
+ `}},{test:function(r){return r.type==="vec2"&&r.size===1&&!r.isArray},code:function(r){return`
60
+ cv = ud["`+r+`"].value;
61
+ v = uv["`+r+`"];
62
+
63
+ if(cv[0] !== v[0] || cv[1] !== v[1])
64
+ {
65
+ cv[0] = v[0];
66
+ cv[1] = v[1];
67
+ gl.uniform2f(ud["`+r+`"].location, v[0], v[1]);
68
+ }
69
+ `}},{test:function(r,e){return r.type==="vec4"&&r.size===1&&!r.isArray&&e.width!==void 0},code:function(r){return`
70
+ cv = ud["`+r+`"].value;
71
+ v = uv["`+r+`"];
72
+
73
+ if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
74
+ {
75
+ cv[0] = v.x;
76
+ cv[1] = v.y;
77
+ cv[2] = v.width;
78
+ cv[3] = v.height;
79
+ gl.uniform4f(ud["`+r+`"].location, v.x, v.y, v.width, v.height)
80
+ }`},codeUbo:function(r){return`
81
+ v = uv.`+r+`;
82
+
83
+ data[offset] = v.x;
84
+ data[offset+1] = v.y;
85
+ data[offset+2] = v.width;
86
+ data[offset+3] = v.height;
87
+ `}},{test:function(r){return r.type==="vec4"&&r.size===1&&!r.isArray},code:function(r){return`
88
+ cv = ud["`+r+`"].value;
89
+ v = uv["`+r+`"];
90
+
91
+ if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
92
+ {
93
+ cv[0] = v[0];
94
+ cv[1] = v[1];
95
+ cv[2] = v[2];
96
+ cv[3] = v[3];
97
+
98
+ gl.uniform4f(ud["`+r+`"].location, v[0], v[1], v[2], v[3])
99
+ }`}}],If={float:`
100
+ if (cv !== v)
101
+ {
102
+ cu.value = v;
103
+ gl.uniform1f(location, v);
104
+ }`,vec2:`
105
+ if (cv[0] !== v[0] || cv[1] !== v[1])
106
+ {
107
+ cv[0] = v[0];
108
+ cv[1] = v[1];
109
+
110
+ gl.uniform2f(location, v[0], v[1])
111
+ }`,vec3:`
112
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
113
+ {
114
+ cv[0] = v[0];
115
+ cv[1] = v[1];
116
+ cv[2] = v[2];
117
+
118
+ gl.uniform3f(location, v[0], v[1], v[2])
119
+ }`,vec4:`
120
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
121
+ {
122
+ cv[0] = v[0];
123
+ cv[1] = v[1];
124
+ cv[2] = v[2];
125
+ cv[3] = v[3];
126
+
127
+ gl.uniform4f(location, v[0], v[1], v[2], v[3]);
128
+ }`,int:`
129
+ if (cv !== v)
130
+ {
131
+ cu.value = v;
132
+
133
+ gl.uniform1i(location, v);
134
+ }`,ivec2:`
135
+ if (cv[0] !== v[0] || cv[1] !== v[1])
136
+ {
137
+ cv[0] = v[0];
138
+ cv[1] = v[1];
139
+
140
+ gl.uniform2i(location, v[0], v[1]);
141
+ }`,ivec3:`
142
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
143
+ {
144
+ cv[0] = v[0];
145
+ cv[1] = v[1];
146
+ cv[2] = v[2];
147
+
148
+ gl.uniform3i(location, v[0], v[1], v[2]);
149
+ }`,ivec4:`
150
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
151
+ {
152
+ cv[0] = v[0];
153
+ cv[1] = v[1];
154
+ cv[2] = v[2];
155
+ cv[3] = v[3];
156
+
157
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
158
+ }`,uint:`
159
+ if (cv !== v)
160
+ {
161
+ cu.value = v;
162
+
163
+ gl.uniform1ui(location, v);
164
+ }`,uvec2:`
165
+ if (cv[0] !== v[0] || cv[1] !== v[1])
166
+ {
167
+ cv[0] = v[0];
168
+ cv[1] = v[1];
169
+
170
+ gl.uniform2ui(location, v[0], v[1]);
171
+ }`,uvec3:`
172
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
173
+ {
174
+ cv[0] = v[0];
175
+ cv[1] = v[1];
176
+ cv[2] = v[2];
177
+
178
+ gl.uniform3ui(location, v[0], v[1], v[2]);
179
+ }`,uvec4:`
180
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
181
+ {
182
+ cv[0] = v[0];
183
+ cv[1] = v[1];
184
+ cv[2] = v[2];
185
+ cv[3] = v[3];
186
+
187
+ gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
188
+ }`,bool:`
189
+ if (cv !== v)
190
+ {
191
+ cu.value = v;
192
+ gl.uniform1i(location, v);
193
+ }`,bvec2:`
194
+ if (cv[0] != v[0] || cv[1] != v[1])
195
+ {
196
+ cv[0] = v[0];
197
+ cv[1] = v[1];
198
+
199
+ gl.uniform2i(location, v[0], v[1]);
200
+ }`,bvec3:`
201
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
202
+ {
203
+ cv[0] = v[0];
204
+ cv[1] = v[1];
205
+ cv[2] = v[2];
206
+
207
+ gl.uniform3i(location, v[0], v[1], v[2]);
208
+ }`,bvec4:`
209
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
210
+ {
211
+ cv[0] = v[0];
212
+ cv[1] = v[1];
213
+ cv[2] = v[2];
214
+ cv[3] = v[3];
215
+
216
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
217
+ }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
218
+ if (cv !== v)
219
+ {
220
+ cu.value = v;
221
+
222
+ gl.uniform1i(location, v);
223
+ }`,samplerCube:`
224
+ if (cv !== v)
225
+ {
226
+ cu.value = v;
227
+
228
+ gl.uniform1i(location, v);
229
+ }`,sampler2DArray:`
230
+ if (cv !== v)
231
+ {
232
+ cu.value = v;
233
+
234
+ gl.uniform1i(location, v);
235
+ }`},Of={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 Mf(r,e){var t,i=[`
236
+ var v = null;
237
+ var cv = null;
238
+ var cu = null;
239
+ var t = 0;
240
+ var gl = renderer.gl;
241
+ `];for(var n in r.uniforms){var s=e[n];if(!s){!((t=r.uniforms[n])===null||t===void 0)&&t.group&&(r.uniforms[n].ubo?i.push(`
242
+ renderer.shader.syncUniformBufferGroup(uv.`+n+", '"+n+`');
243
+ `):i.push(`
244
+ renderer.shader.syncUniformGroup(uv.`+n+`, syncData);
245
+ `));continue}for(var o=r.uniforms[n],a=!1,h=0;h<Ne.length;h++)if(Ne[h].test(s,o)){i.push(Ne[h].code(n,o)),a=!0;break}if(!a){var u=s.size===1&&!s.isArray?If:Of,l=u[s.type].replace("location",'ud["'+n+'"].location');i.push(`
246
+ cu = ud["`+n+`"];
247
+ cv = cu.value;
248
+ v = uv["`+n+`"];
249
+ `+l+";")}}return new Function("ud","uv","renderer","syncData",i.join(`
250
+ `))}var Df=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
251
+ `);function Ff(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 Nf(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=Df.replace(/%forloop%/gi,Ff(r));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))r=r/2|0;else break}return r}var ti;function Bf(){if(typeof ti=="boolean")return ti;try{var r=new Function("param1","param2","param3","return param1[param2] === param3;");ti=r({a:"b"},"a","b")===!0}catch{ti=!1}return ti}var Lf=`varying vec2 vTextureCoord;
253
+
254
+ uniform sampler2D uSampler;
255
+
256
+ void main(void){
257
+ gl_FragColor *= texture2D(uSampler, vTextureCoord);
258
+ }`,Uf=`attribute vec2 aVertexPosition;
259
+ attribute vec2 aTextureCoord;
260
+
261
+ uniform mat3 projectionMatrix;
262
+
263
+ varying vec2 vTextureCoord;
264
+
265
+ void main(void){
266
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
267
+ vTextureCoord = aTextureCoord;
268
+ }
269
+ `,Gf=0,Li={},ei=function(){function r(e,t,i){i===void 0&&(i="pixi-shader"),this.id=Gf++,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,"-"),Li[i]?(Li[i]++,i+="-"+Li[i]):Li[i]=1,this.vertexSrc="#define SHADER_NAME "+i+`
270
+ `+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+i+`
271
+ `+this.fragmentSrc,this.vertexSrc=Us(this.vertexSrc,F.PRECISION_VERTEX,Ct.HIGH),this.fragmentSrc=Us(this.fragmentSrc,F.PRECISION_FRAGMENT,Af())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(r,"defaultVertexSrc",{get:function(){return Uf},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentSrc",{get:function(){return Lf},enumerable:!1,configurable:!0}),r.from=function(e,t,i){var n=e+t,s=xs[n];return s||(xs[n]=s=new r(e,t,i)),s},r}(),re=function(){function r(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof ye?this.uniformGroup=t:this.uniformGroup=new ye(t):this.uniformGroup=new ye({}),this.disposeRunner=new bt("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=ei.from(e,t);return new r(n,i)},r}(),Br=0,Lr=1,Ur=2,Gr=3,kr=4,Hr=5,xe=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<<Br)},set:function(e){!!(this.data&1<<Br)!==e&&(this.data^=1<<Br)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"offsets",{get:function(){return!!(this.data&1<<Lr)},set:function(e){!!(this.data&1<<Lr)!==e&&(this.data^=1<<Lr)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{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,"depthTest",{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,"depthMask",{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,"clockwiseFrontFace",{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,"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}(),kf=`varying vec2 vTextureCoord;
272
+
273
+ uniform sampler2D uSampler;
274
+
275
+ void main(void){
276
+ gl_FragColor = texture2D(uSampler, vTextureCoord);
277
+ }
278
+ `,Hf=`attribute vec2 aVertexPosition;
279
+
280
+ uniform mat3 projectionMatrix;
281
+
282
+ varying vec2 vTextureCoord;
283
+
284
+ uniform vec4 inputSize;
285
+ uniform vec4 outputFrame;
286
+
287
+ vec4 filterVertexPosition( void )
288
+ {
289
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
290
+
291
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
292
+ }
293
+
294
+ vec2 filterTextureCoord( void )
295
+ {
296
+ return aVertexPosition * (outputFrame.zw * inputSize.zw);
297
+ }
298
+
299
+ void main(void)
300
+ {
301
+ gl_Position = filterVertexPosition();
302
+ vTextureCoord = filterTextureCoord();
303
+ }
304
+ `,ne=function(r){it(e,r);function e(t,i,n){var s=this,o=ei.from(t||e.defaultVertexSrc,i||e.defaultFragmentSrc);return s=r.call(this,o,n)||this,s.padding=0,s.resolution=F.FILTER_RESOLUTION,s.multisample=F.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new xe,s}return e.prototype.apply=function(t,i,n,s,o){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 Hf},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultFragmentSrc",{get:function(){return kf},enumerable:!1,configurable:!0}),e}(re),Xf=`attribute vec2 aVertexPosition;
305
+ attribute vec2 aTextureCoord;
306
+
307
+ uniform mat3 projectionMatrix;
308
+ uniform mat3 otherMatrix;
309
+
310
+ varying vec2 vMaskCoord;
311
+ varying vec2 vTextureCoord;
312
+
313
+ void main(void)
314
+ {
315
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
316
+
317
+ vTextureCoord = aTextureCoord;
318
+ vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
319
+ }
320
+ `,Wf=`varying vec2 vMaskCoord;
321
+ varying vec2 vTextureCoord;
322
+
323
+ uniform sampler2D uSampler;
324
+ uniform sampler2D mask;
325
+ uniform float alpha;
326
+ uniform float npmAlpha;
327
+ uniform vec4 maskClamp;
328
+
329
+ void main(void)
330
+ {
331
+ float clip = step(3.5,
332
+ step(maskClamp.x, vMaskCoord.x) +
333
+ step(maskClamp.y, vMaskCoord.y) +
334
+ step(vMaskCoord.x, maskClamp.z) +
335
+ step(vMaskCoord.y, maskClamp.w));
336
+
337
+ vec4 original = texture2D(uSampler, vTextureCoord);
338
+ vec4 masky = texture2D(mask, vMaskCoord);
339
+ float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
340
+
341
+ original *= (alphaMul * masky.r * alpha * clip);
342
+
343
+ gl_FragColor = original;
344
+ }
345
+ `,Xs=new _t,Xr=function(){function r(e,t){this._texture=e,this.mapCoord=new _t,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],o=e[n+1];t[n]=s*i.a+o*i.c+i.tx,t[n+1]=s*i.b+o*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&&(Xs.set(n.width/s.width,0,0,n.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Xs));var o=t.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,u=this.clampOffset;return a[0]=(t._frame.x+h+u)/o.width,a[1]=(t._frame.y+h+u)/o.height,a[2]=(t._frame.x+t._frame.width-h+u)/o.width,a[3]=(t._frame.y+t._frame.height-h+u)/o.height,this.uClampOffset[0]=u/o.realWidth,this.uClampOffset[1]=u/o.realHeight,this.isSimple=t._frame.width===o.width&&t._frame.height===o.height&&t.rotate===0,!0},r}(),jf=function(r){it(e,r);function e(t,i,n){var s=this,o=null;return typeof t!="string"&&i===void 0&&n===void 0&&(o=t,t=void 0,i=void 0,n=void 0),s=r.call(this,t||Xf,i||Wf,n)||this,s.maskSprite=o,s.maskMatrix=new _t,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 o=this._maskSprite,a=o._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new Xr(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,i,n,s))},e}(ne),zf=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 Sf;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!==vt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case vt.SCISSOR:this.renderer.scissor.push(i);break;case vt.STENCIL:this.renderer.stencil.push(i);break;case vt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case vt.COLOR:this.pushColorMask(i);break}i.type===vt.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 vt.SCISSOR:this.renderer.scissor.pop(t);break;case vt.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case vt.SPRITE:this.popSpriteMask(t);break;case vt.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===vt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}},r.prototype.detect=function(e){var t=e.maskObject;t?t.isSprite?e.type=vt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=vt.SCISSOR:e.type=vt.STENCIL:e.type=vt.COLOR},r.prototype.pushSpriteMask=function(e){var t,i,n=e.maskObject,s=e._target,o=e._filters;o||(o=this.alphaMaskPool[this.alphaMaskIndex],o||(o=this.alphaMaskPool[this.alphaMaskIndex]=[new jf]));var a=this.renderer,h=a.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||a.resolution,l=(i=e.multisample)!==null&&i!==void 0?i:a.multisample;o[0].resolution=u,o[0].multisample=l,o[0].maskSprite=n;var c=s.filterArea;s.filterArea=n.getBounds(!0),a.filter.push(s,o),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}(),Ws=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}(),js=new _t,zs=[],Yf=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,o=this.renderer,a=o.renderTexture,h=s.getBounds(!0,(i=zs.pop())!==null&&i!==void 0?i:new z);this.roundFrameToPixels(h,a.current?a.current.resolution:o.resolution,a.sourceFrame,a.destinationFrame,o.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,o=t.d;return(Math.abs(n)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(i)>1e-4||Math.abs(o)>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,o){e.isMatrixRotated(o)||(o=o?js.copyFrom(o):js.identity(),o.translate(-n.x,-n.y).scale(s.width/n.width,s.height/n.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,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}(Ws),Vf=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 o=t._colorMask;o!==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,o!==0&&(t._colorMask=o,n.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&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}(Ws),qf=function(){function r(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new _t,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,o=n?-1:1;s.identity(),s.a=1/t.width*2,s.d=o*(1/t.height*2),s.tx=-1-t.x*s.a,s.ty=-o-t.y*s.d},r.prototype.setTransform=function(e){},r.prototype.destroy=function(){this.renderer=null},r}(),be=new z,ii=new z,$f=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,o,a;e?(s=e.baseTexture,a=s.resolution,t||(be.width=e.frame.width,be.height=e.frame.height,t=be),i||(ii.x=e.frame.x,ii.y=e.frame.y,ii.width=t.width,ii.height=t.height,i=ii),o=s.framebuffer):(a=n.resolution,t||(be.width=n.screen.width,be.height=n.screen.height,t=be),i||(i=be,i.width=t.width,i.height=t.height));var h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,e||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,t,a,!o),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 o=this.viewportFrame,a=o.x,h=o.y,u=o.width,l=o.height;a=Math.round(a),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(a,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 Zf(r,e,t,i,n){t.buffer.update(n)}var Kf={float:`
346
+ data[offset] = v;
347
+ `,vec2:`
348
+ data[offset] = v[0];
349
+ data[offset+1] = v[1];
350
+ `,vec3:`
351
+ data[offset] = v[0];
352
+ data[offset+1] = v[1];
353
+ data[offset+2] = v[2];
354
+
355
+ `,vec4:`
356
+ data[offset] = v[0];
357
+ data[offset+1] = v[1];
358
+ data[offset+2] = v[2];
359
+ data[offset+3] = v[3];
360
+ `,mat2:`
361
+ data[offset] = v[0];
362
+ data[offset+1] = v[1];
363
+
364
+ data[offset+4] = v[2];
365
+ data[offset+5] = v[3];
366
+ `,mat3:`
367
+ data[offset] = v[0];
368
+ data[offset+1] = v[1];
369
+ data[offset+2] = v[2];
370
+
371
+ data[offset + 4] = v[3];
372
+ data[offset + 5] = v[4];
373
+ data[offset + 6] = v[5];
374
+
375
+ data[offset + 8] = v[6];
376
+ data[offset + 9] = v[7];
377
+ data[offset + 10] = v[8];
378
+ `,mat4:`
379
+ for(var i = 0; i < 16; i++)
380
+ {
381
+ data[offset + i] = v[i];
382
+ }
383
+ `},Ys={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 Qf(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 o=e[s];if(t=Ys[o.data.type],o.data.size>1&&(t=Math.max(t,16)*o.data.size),o.dataLen=t,i%t!==0&&i<16){var a=i%t%16;i+=a,n+=a}i+t>16?(n=Math.ceil(n/16)*16,o.offset=n,n+=t,i=t):(o.offset=n,i+=t,n+=t)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function Jf(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 tc(r,e){if(!r.autoManage)return{size:0,syncFunc:Zf};for(var t=Jf(r.uniforms,e),i=Qf(t),n=i.uboElements,s=i.size,o=[`
384
+ var v = null;
385
+ var v2 = null;
386
+ var cv = null;
387
+ var t = 0;
388
+ var gl = renderer.gl
389
+ var index = 0;
390
+ var data = buffer.data;
391
+ `],a=0;a<n.length;a++){for(var h=n[a],u=r.uniforms[h.data.name],l=h.data.name,f=!1,c=0;c<Ne.length;c++){var d=Ne[c];if(d.codeUbo&&d.test(h.data,u)){o.push("offset = "+h.offset/4+";",Ne[c].codeUbo(h.data.name,u)),f=!0;break}}if(!f)if(h.data.size>1){var p=Gs(h.data.type),v=Math.max(Ys[h.data.type]/16,1),_=p/v,m=(4-_%4)%4;o.push(`
392
+ cv = ud.`+l+`.value;
393
+ v = uv.`+l+`;
394
+ offset = `+h.offset/4+`;
395
+
396
+ t = 0;
397
+
398
+ for(var i=0; i < `+h.data.size*v+`; i++)
399
+ {
400
+ for(var j = 0; j < `+_+`; j++)
401
+ {
402
+ data[offset++] = v[t++];
403
+ }
404
+ offset += `+m+`;
405
+ }
406
+
407
+ `)}else{var y=Kf[h.data.type];o.push(`
408
+ cv = ud.`+l+`.value;
409
+ v = uv.`+l+`;
410
+ offset = `+h.offset/4+`;
411
+ `+y+`;
412
+ `)}}return o.push(`
413
+ renderer.buffer.update(buffer);
414
+ `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
415
+ `))}}var ec=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 ic(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 o=Hs(e,s.type),a={type:o,name:s.name,size:Gs(o),location:e.getAttribLocation(r,s.name)};t[s.name]=a}}return t}function rc(r,e){for(var t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS),n=0;n<i;n++){var s=e.getActiveUniform(r,n),o=s.name.replace(/\[.*?\]$/,""),a=!!s.name.match(/\[.*?\]$/),h=Hs(e,s.type);t[o]={name:o,index:n,type:h,size:s.size,isArray:a,value:Bs(h,s.size)}}return t}function nc(r,e){var t=Fs(r,r.VERTEX_SHADER,e.vertexSrc),i=Fs(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)||Pf(r,n,t,i),e.attributeData=ic(n,r),e.uniformData=rc(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 o=0;o<s.length;o++)e.attributeData[s[o]].location=o,r.bindAttribLocation(n,o,s[o]);r.linkProgram(n)}r.deleteShader(t),r.deleteShader(i);var a={};for(var o in e.uniformData){var h=e.uniformData[o];a[o]={location:r.getUniformLocation(n,o),value:Bs(h.type,h.size)}}var u=new ec(n,a);return u}var sc=0,Ui={textureCount:0,uboCount:0},oc=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=sc++}return r.prototype.systemCheck=function(){if(!Bf())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||(Ui.textureCount=0,Ui.uboCount=0,this.syncUniformGroup(e.uniformGroup,Ui)),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]=Mf(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,Ui,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 o=this.getSignature(e,this.shader.program.uniformData,"ubo"),a=this._uboCache[o];if(a||(a=this._uboCache[o]=tc(e,this.shader.program.uniformData)),e.autoManage){var h=new Float32Array(a.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]},r.prototype.getSignature=function(e,t,i){var n=e.uniforms,s=[i+"-"];for(var o in n)s.push(o),t[o]&&s.push(t[o].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=nc(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 ac(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 hc=0,uc=1,lc=2,fc=3,cc=4,dc=5,pc=function(){function r(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=G.NONE,this._blendEq=!1,this.map=[],this.map[hc]=this.setBlend,this.map[uc]=this.setOffset,this.map[lc]=this.setCullFace,this.map[fc]=this.setDepthTest,this.map[cc]=this.setFrontFace,this.map[dc]=this.setDepthMask,this.checks=[],this.defaultState=new xe,this.defaultState.blend=!0}return r.prototype.contextChange=function(e){this.gl=e,this.blendModes=ac(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}(),vc=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!==xi.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 o=0,n=0;n<t.length;n++)t[n]!==null&&(t[o++]=t[n]);t.length=o}},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 _c(r){var e,t,i,n,s,o,a,h,u,l,f,c,d,p,v,_,m,y,g,b,x,T,E;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?E=(e={},e[U.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[U.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[U.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[U.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[U.UNSIGNED_INT]=(o={},o[R.RGBA_INTEGER]=r.RGBA32UI,o[R.RGB_INTEGER]=r.RGB32UI,o[R.RG_INTEGER]=r.RG32UI,o[R.RED_INTEGER]=r.R32UI,o[R.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,o),e[U.INT]=(a={},a[R.RGBA_INTEGER]=r.RGBA32I,a[R.RGB_INTEGER]=r.RGB32I,a[R.RG_INTEGER]=r.RG32I,a[R.RED_INTEGER]=r.R32I,a),e[U.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[U.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[U.UNSIGNED_SHORT_5_6_5]=(l={},l[R.RGB]=r.RGB565,l),e[U.UNSIGNED_SHORT_4_4_4_4]=(f={},f[R.RGBA]=r.RGBA4,f),e[U.UNSIGNED_SHORT_5_5_5_1]=(c={},c[R.RGBA]=r.RGB5_A1,c),e[U.UNSIGNED_INT_2_10_10_10_REV]=(d={},d[R.RGBA]=r.RGB10_A2,d[R.RGBA_INTEGER]=r.RGB10_A2UI,d),e[U.UNSIGNED_INT_10F_11F_11F_REV]=(p={},p[R.RGB]=r.R11F_G11F_B10F,p),e[U.UNSIGNED_INT_5_9_9_9_REV]=(v={},v[R.RGB]=r.RGB9_E5,v),e[U.UNSIGNED_INT_24_8]=(_={},_[R.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,_),e[U.FLOAT_32_UNSIGNED_INT_24_8_REV]=(m={},m[R.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,m),e):E=(y={},y[U.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[U.UNSIGNED_SHORT_5_6_5]=(b={},b[R.RGB]=r.RGB,b),y[U.UNSIGNED_SHORT_4_4_4_4]=(x={},x[R.RGBA]=r.RGBA,x),y[U.UNSIGNED_SHORT_5_5_5_1]=(T={},T[R.RGBA]=r.RGBA,T),y),E}var Wr=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=U.UNSIGNED_BYTE,this.internalFormat=R.RGBA,this.samplerType=0}return r}(),mc=function(){function r(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new q,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=_c(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 Wr(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 Wr(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 o=e-1;o>=0;--o){var a=i[o];if(a){var h=a._glTextures[s];h.samplerType!==yi.FLOAT&&this.renderer.texture.unbind(a)}}},r.prototype.initTexture=function(e){var t=new Wr(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===U.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!==yi.FLOAT&&(this.hasIntegerTextures=!0);else{var n=e.realWidth,s=e.realHeight,o=i.gl;(t.width!==n||t.height!==s||t.dirtyId<0)&&(t.width=n,t.height=s,o.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&&De(this.managedTextures,n,1)}},r.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===It.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=kt.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!==It.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===Gt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===Gt.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===Gt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Gt.LINEAR?i.LINEAR:i.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),jr=new _t,gc=function(r){it(e,r);function e(t,i){t===void 0&&(t=Xe.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&&(Ft("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"&&(Ft("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),i={scaleMode:i,resolution:n,region:s});var o=i.region,a=Jl(i,["region"]);s=o||t.getLocalBounds(null,!0),s.width===0&&(s.width=1),s.height===0&&(s.height=1);var h=ge.create(Or({width:s.width,height:s.height},a));return jr.tx=-s.x,jr.ty=-s.y,this.render(t,{renderTexture:h,clear:!1,transform:jr,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=Xe.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=fs(t),Me(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}(We),yc=function(){function r(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),xc=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 o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,n.bindBufferBase(n.UNIFORM_BUFFER,t,o.buffer)}},r.prototype.bindBufferRange=function(e,t,i){var n=this,s=n.gl,o=n.CONTEXT_UID;i=i||0;var a=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,a.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 o=e.static?i.STATIC_DRAW:i.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,i.bufferData(e.type,e.data,o)}},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 yc(n.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[i]},r}(),Vs=function(r){it(e,r);function e(t){var i=r.call(this,Xe.WEBGL,t)||this;return t=i.options,i.gl=null,i.CONTEXT_UID=0,i.runners={destroy:new bt("destroy"),contextChange:new bt("contextChange"),reset:new bt("reset"),update:new bt("update"),postrender:new bt("postrender"),prerender:new bt("prerender"),resize:new bt("resize")},i.runners.contextChange.add(i),i.globalUniforms=new ye({projectionMatrix:new _t},!0),i.addSystem(zf,"mask").addSystem(xf,"context").addSystem(pc,"state").addSystem(oc,"shader").addSystem(mc,"texture").addSystem(xc,"buffer").addSystem(wf,"geometry").addSystem(Ef,"framebuffer").addSystem(Yf,"scissor").addSystem(Vf,"stencil").addSystem(qf,"projection").addSystem(vc,"textureGC").addSystem(gf,"filter").addSystem($f,"renderTexture").addSystem(yf,"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,ih(i.context.webGLVersion===2?"WebGL 2":"WebGL 1"),i.resize(i.options.width,i.options.height),i}return e.create=function(t){if(rh())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>=lt.HIGH?this.multisample=lt.HIGH:i>=lt.MEDIUM?this.multisample=lt.MEDIUM:i>=lt.LOW?this.multisample=lt.LOW:this.multisample=lt.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,o,a;if(i&&(i instanceof ge?(Ft("6.0.0","Renderer#render arguments changed, use options instead."),n=i,s=arguments[2],o=arguments[3],a=arguments[4]):(n=i.renderTexture,s=i.clear,o=i.transform,a=i.skipUpdateTransform)),this.renderingToScreen=!n,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=o,!this.context.isLost){if(n||(this._lastObjectRendered=t),!a){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 o=r.prototype.generateTexture.call(this,t,i,n,s);return this.framebuffer.blit(),o},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 Ft("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){Ft("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Zt.add({name:t,type:tt.RendererPlugin,ref:i})},e.__plugins={},e}(gc);Zt.handleByMap(tt.RendererPlugin,Vs.__plugins);function bc(r){return Vs.create(r)}var Tc=`attribute vec2 aVertexPosition;
416
+ attribute vec2 aTextureCoord;
417
+
418
+ uniform mat3 projectionMatrix;
419
+
420
+ varying vec2 vTextureCoord;
421
+
422
+ void main(void)
423
+ {
424
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
425
+ vTextureCoord = aTextureCoord;
426
+ }`,Ec=`attribute vec2 aVertexPosition;
427
+
428
+ uniform mat3 projectionMatrix;
429
+
430
+ varying vec2 vTextureCoord;
431
+
432
+ uniform vec4 inputSize;
433
+ uniform vec4 outputFrame;
434
+
435
+ vec4 filterVertexPosition( void )
436
+ {
437
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
438
+
439
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
440
+ }
441
+
442
+ vec2 filterTextureCoord( void )
443
+ {
444
+ return aVertexPosition * (outputFrame.zw * inputSize.zw);
445
+ }
446
+
447
+ void main(void)
448
+ {
449
+ gl_Position = filterVertexPosition();
450
+ vTextureCoord = filterTextureCoord();
451
+ }
452
+ `,wc=Tc,qs=Ec,zr=function(){function r(){this.texArray=null,this.blend=0,this.type=Rt.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),Yr=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}(),Vr=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}(),Sc=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=xe.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===Vt.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=Nf(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 Yr);for(var o=0;o<this.MAX_TEXTURES;o++)this._tempBoundTextures[o]=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,o=this.renderer.batch,a=this._tempBoundTextures,h=this.renderer.textureGC.count,u=++q._globalBatch,l=0,f=s[0],c=0;o.copyBoundTextures(a,n);for(var d=0;d<this._bufferSize;++d){var p=i[d];i[d]=null,p._batchEnabled!==u&&(f.count>=n&&(o.boundArray(f,a,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&&(o.boundArray(f,a,u,n),this.buildDrawCalls(f,c,this._bufferSize),++l,++u);for(var d=0;d<a.length;d++)a[d]=null;q._globalBatch=u},e.prototype.buildDrawCalls=function(t,i,n){var s=this,o=s._bufferedElements,a=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 _=o[v],m=_._texture.baseTexture,y=ds[m.alphaMode?1:0][_.blendMode];o[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(_,a,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,o=e._drawCallPool,a=null,h=0;h<t;h++){var u=o[h],l=u.texArray,f=u.type,c=u.size,d=u.start,p=u.blend;a!==l&&(a=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=gs(i),s=i*8;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);var o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new Vr(s*this.vertexSize*4)),o},e.prototype.getIndexBuffer=function(t){var i=Ai(Math.ceil(t/12)),n=gs(i),s=i*12;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);var o=this._iBuffers[n];return o||(this._iBuffers[n]=o=new Uint16Array(s)),o},e.prototype.packInterleavedGeometry=function(t,i,n,s,o){for(var a=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?Sr(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],a[s++]=v,h[s++]=d;for(var _=0;_<f.length;_++)n[o++]=u+f[_]},e._drawCallPool=[],e._textureArrayPool=[],e}(Fi),Pc=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]=ye.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 ei(this.vertexSrc,n)}var s={tint:new Float32Array([1,1,1,1]),translationMatrix:new _t,default:this.defaultGroupCache[e]};return new re(this.programCache[e],s)},r.prototype.generateSampleSrc=function(e){var t="";t+=`
453
+ `,t+=`
454
+ `;for(var i=0;i<e;i++)i>0&&(t+=`
455
+ else `),i<e-1&&(t+="if(vTextureId < "+i+".5)"),t+=`
456
+ {`,t+=`
457
+ color = texture2D(uSamplers[`+i+"], vTextureCoord);",t+=`
458
+ }`;return t+=`
459
+ `,t+=`
460
+ `,t},r}(),$s=function(r){it(e,r);function e(t){t===void 0&&(t=!1);var i=r.call(this)||this;return i._buffer=new mt(null,t,!1),i._indexBuffer=new mt(null,t,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,U.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,U.FLOAT).addAttribute("aColor",i._buffer,4,!0,U.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,U.FLOAT).addIndex(i._indexBuffer),i}return e}(Qe),Zs=`precision highp float;
461
+ attribute vec2 aVertexPosition;
462
+ attribute vec2 aTextureCoord;
463
+ attribute vec4 aColor;
464
+ attribute float aTextureId;
465
+
466
+ uniform mat3 projectionMatrix;
467
+ uniform mat3 translationMatrix;
468
+ uniform vec4 tint;
469
+
470
+ varying vec2 vTextureCoord;
471
+ varying vec4 vColor;
472
+ varying float vTextureId;
473
+
474
+ void main(void){
475
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
476
+
477
+ vTextureCoord = aTextureCoord;
478
+ vTextureId = aTextureId;
479
+ vColor = aColor * tint;
480
+ }
481
+ `,Ks=`varying vec2 vTextureCoord;
482
+ varying vec4 vColor;
483
+ varying float vTextureId;
484
+ uniform sampler2D uSamplers[%count%];
485
+
486
+ void main(void){
487
+ vec4 color;
488
+ %forloop%
489
+ gl_FragColor = color * vColor;
490
+ }
491
+ `,Cc=function(){function r(){}return r.create=function(e){var t=Object.assign({vertex:Zs,fragment:Ks,geometryClass:$s,vertexSize:6},e),i=t.vertex,n=t.fragment,s=t.vertexSize,o=t.geometryClass;return function(a){it(h,a);function h(u){var l=a.call(this,u)||this;return l.shaderGenerator=new Pc(i,n),l.geometryClass=o,l.vertexSize=s,l}return h}(Sc)},Object.defineProperty(r,"defaultVertexSrc",{get:function(){return Zs},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentTemplate",{get:function(){return Ks},enumerable:!1,configurable:!0}),r}(),Qs=Cc.create();Object.assign(Qs,{extension:{name:"batch",type:tt.RendererPlugin}});var Ac={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};ct.mixin(Ac);var Rc=9,Gi=100,Ic=0,Oc=0,Js=2,to=1,Mc=-1e3,Dc=-1e3,Fc=2,Nc=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,(Xt.tablet||Xt.phone)&&this.createTouchHook();var t=document.createElement("div");t.style.width=Gi+"px",t.style.height=Gi+"px",t.style.position="absolute",t.style.top=Ic+"px",t.style.left=Oc+"px",t.style.zIndex=Js.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=to+"px",t.style.height=to+"px",t.style.position="absolute",t.style.top=Mc+"px",t.style.left=Dc+"px",t.style.zIndex=Fc.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(!(Xt.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,o=t.height,a=this.renderer,h=a.width,u=a.height,l=a.resolution,f=s/h*l,c=o/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,De(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=Gi+"px",t.style.height=Gi+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Js.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===Rc&&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 eo=function(){function r(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new j,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 qr=function(r,e){return qr=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])},qr(r,e)};function Bc(r,e){qr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Lc=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}(),$r=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}(),Uc=function(){function r(){this._tempPoint=new j}return r.prototype.recursiveFindHit=function(e,t,i,n,s){var o;if(!t||!t.visible)return!1;var a=e.data.global;s=t.interactive||s;var h=!1,u=s,l=!0;if(t.hitArea)n&&(t.worldTransform.applyInverse(a,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&&!(!((o=f.containsPoint)===null||o===void 0)&&o.call(f,a))&&(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(a)&&(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}(),Gc={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};ct.mixin(Gc);var ki=1,Hi={target:null,data:{global:null}},kc=function(r){Bc(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 eo,n.mouse.identifier=ki,n.mouse.global.set(-999999),n.activeInteractionData={},n.activeInteractionData[ki]=n.mouse,n.interactionDataPool=[],n.eventData=new Lc,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 Uc,n._tempDisplayObject=new Ts,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 Hi.target=null,Hi.data.global=t,i||(i=this.lastObjectRendered),this.processInteractive(Hi,i,null,!0),Hi.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||(yt.system.add(this.tickerUpdate,this,Kt.INTERACTION),this.tickerAdded=!0)},e.prototype.removeTickerListener=function(){this.tickerAdded&&(yt.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 o=1/this.resolution;t.x=(i-s.left)*(this.interactionDOMElement.width/s.width)*o,t.y=(n-s.top)*(this.interactionDOMElement.height/s.height)*o},e.prototype.processInteractive=function(t,i,n,s){var o=this.search.findHit(t,i,n,s),a=this.delayedEvents;if(!a.length)return o;t.stopPropagationHint=!1;var h=a.length;this.delayedEvents=[];for(var u=0;u<h;u++){var l=a[u],f=l.displayObject,c=l.eventString,d=l.eventData;d.stopsPropagatingAt===f&&(d.stopPropagationHint=!0),this.dispatchEvent(f,c,d)}return o},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,o=0;o<s;o++){var a=i[o],h=this.getInteractionDataForPointerId(a),u=this.configureInteractionEventForDOMEvent(this.eventData,a,h);if(u.data.originalEvent=t,this.processInteractive(u,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",u),a.pointerType==="touch")this.emit("touchstart",u);else if(a.pointerType==="mouse"||a.pointerType==="pen"){var l=a.button===2;this.emit(l?"rightdown":"mousedown",this.eventData)}}}},e.prototype.processPointerDown=function(t,i,n){var s=t.data,o=t.data.identifier;if(n){if(i.trackedPointers[o]||(i.trackedPointers[o]=new $r(o)),this.dispatchEvent(i,"pointerdown",t),s.pointerType==="touch")this.dispatchEvent(i,"touchstart",t);else if(s.pointerType==="mouse"||s.pointerType==="pen"){var a=s.button===2;a?i.trackedPointers[o].rightDown=!0:i.trackedPointers[o].leftDown=!0,this.dispatchEvent(i,a?"rightdown":"mousedown",t)}}},e.prototype.onPointerComplete=function(t,i,n){var s=this.normalizeToPointerData(t),o=s.length,a=t.target;t.composedPath&&t.composedPath().length>0&&(a=t.composedPath()[0]);for(var h=a!==this.interactionDOMElement?"outside":"",u=0;u<o;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,o=t.data.identifier,a=i.trackedPointers[o],h=s.pointerType==="touch",u=s.pointerType==="mouse"||s.pointerType==="pen",l=!1;if(u){var f=s.button===2,c=$r.FLAGS,d=f?c.RIGHT_DOWN:c.LEFT_DOWN,p=a!==void 0&&a.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),a&&(f?a.rightDown=!1:a.leftDown=!1)}n?(this.dispatchEvent(i,"pointerup",t),h&&this.dispatchEvent(i,"touchend",t),a&&((!u||l)&&this.dispatchEvent(i,"pointertap",t),h&&(this.dispatchEvent(i,"tap",t),a.over=!1))):a&&(this.dispatchEvent(i,"pointerupoutside",t),h&&this.dispatchEvent(i,"touchendoutside",t)),a&&a.none&&delete i.trackedPointers[o]},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 o=i[s],a=this.getInteractionDataForPointerId(o),h=this.configureInteractionEventForDOMEvent(this.eventData,o,a);h.data.originalEvent=t,this.processInteractive(h,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",h),o.pointerType==="touch"&&this.emit("touchmove",h),(o.pointerType==="mouse"||o.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,o=s.pointerType==="touch",a=s.pointerType==="mouse"||s.pointerType==="pen";a&&this.processPointerOverOut(t,i,n),(!this.moveWhenInside||n)&&(this.dispatchEvent(i,"pointermove",t),o&&this.dispatchEvent(i,"touchmove",t),a&&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),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);o.data.originalEvent=n,this.processInteractive(o,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",o),n.pointerType==="mouse"||n.pointerType==="pen"?this.emit("mouseout",o):this.releaseInteractionDataForPointerId(s.identifier)}},e.prototype.processPointerOverOut=function(t,i,n){var s=t.data,o=t.data.identifier,a=s.pointerType==="mouse"||s.pointerType==="pen",h=i.trackedPointers[o];n&&!h&&(h=i.trackedPointers[o]=new $r(o)),h!==void 0&&(n&&this.mouseOverRenderer?(h.over||(h.over=!0,this.delayDispatchEvent(i,"pointerover",t),a&&this.delayDispatchEvent(i,"mouseover",t)),a&&this.cursor===null&&(this.cursor=i.cursor)):h.over&&(h.over=!1,this.dispatchEvent(i,"pointerout",this.eventData),a&&this.dispatchEvent(i,"mouseout",t),h.none&&delete i.trackedPointers[o]))},e.prototype.onPointerOver=function(t){if(!(this.supportsTouchEvents&&t.pointerType==="touch")){var i=this.normalizeToPointerData(t),n=i[0],s=this.getInteractionDataForPointerId(n),o=this.configureInteractionEventForDOMEvent(this.eventData,n,s);o.data.originalEvent=n,n.pointerType==="mouse"&&(this.mouseOverRenderer=!0),this.emit("pointerover",o),(n.pointerType==="mouse"||n.pointerType==="pen")&&this.emit("mouseover",o)}},e.prototype.getInteractionDataForPointerId=function(t){var i=t.pointerId,n;return i===ki||t.pointerType==="mouse"?n=this.mouse:this.activeInteractionData[i]?n=this.activeInteractionData[i]:(n=this.interactionDataPool.pop()||new eo,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 o=t.changedTouches[n];typeof o.button>"u"&&(o.button=t.touches.length?1:0),typeof o.buttons>"u"&&(o.buttons=t.touches.length?1:0),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,i.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){var a=t;typeof a.isPrimary>"u"&&(a.isPrimary=!0),typeof a.width>"u"&&(a.width=1),typeof a.height>"u"&&(a.height=1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="mouse"),typeof a.pointerId>"u"&&(a.pointerId=ki),typeof a.pressure>"u"&&(a.pressure=.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),a.isNormalized=!0,i.push(a)}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}(We);var io=new z,ro=4,Hc=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,o,a=!1;e&&(e instanceof ge?o=e:(o=this.renderer.generateTexture(e),a=!0)),o?(n=o.baseTexture.resolution,t=t??o.frame,s=!1,i.renderTexture.bind(o)):(n=i.resolution,t||(t=io,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 bs(h,u,1),f=new Uint8Array(ro*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 bs(l.width,l.height,1);p.context.scale(1,-1),p.context.drawImage(l.canvas,0,-u),l.destroy(),l=p}return a&&o.destroy(!0),l.canvas},r.prototype.pixels=function(e,t){var i=this.renderer,n,s,o=!1;e&&(e instanceof ge?s=e:(s=this.renderer.generateTexture(e),o=!0)),s?(n=s.baseTexture.resolution,t=t??s.frame,i.renderTexture.bind(s)):(n=i.resolution,t||(t=io,t.width=i.width,t.height=i.height),i.renderTexture.bind(null));var a=Math.round(t.width*n),h=Math.round(t.height*n),u=new Uint8Array(ro*a*h),l=i.gl;return l.readPixels(Math.round(t.x*n),Math.round(t.y*n),a,h,l.RGBA,l.UNSIGNED_BYTE,u),o&&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 Xi=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 no(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 Qt=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 Xi))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 no(this,new Xi(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 no(this,new Xi(e,!0,t))},r.prototype.detach=function(e){if(!(e instanceof Xi))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 so(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(o,a,h){a&&(n[t.q.name][a]=h)}),n}var Zr,Wi=null,Xc=0,oo=200,Wc=204,jc=1223,zc=2;function ao(){}function ho(r,e,t){e&&e.indexOf(".")===0&&(e=e.substring(1)),e&&(r[e]=t)}function Kr(r){return r.toString().replace("object ","")}var ft=function(){function r(e,t,i){if(this._dequeue=ao,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=ao,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 Qt,this.onProgress=new Qt,this.onComplete=new Qt,this.onAfterMiddleware=new Qt}return r.setExtensionLoadType=function(e,t){ho(r._loadTypeMap,e,t)},r.setExtensionXhrType=function(e,t){ho(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 Zr>"u"&&(Zr=!!(globalThis.XDomainRequest&&!("withCredentials"in new XMLHttpRequest))),Zr&&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(Kr(e)+" Request failed. Status: "+e.status+', text: "'+e.statusText+'"')},r.prototype._xhrOnTimeout=function(){var e=this.xhr;this.abort(Kr(e)+" Request timed out.")},r.prototype._xhrOnAbort=function(){var e=this.xhr;this.abort(Kr(e)+" Request was aborted by the user.")},r.prototype._xhrOnLoad=function(){var e=this.xhr,t="",i=typeof e.status>"u"?oo:e.status;(e.responseType===""||e.responseType==="text"||typeof e.responseType>"u")&&(t=e.responseText),i===Xc&&(t.length>0||e.responseType===r.XHR_RESPONSE_TYPE.BUFFER)?i=oo:i===jc&&(i=Wc);var n=i/100|0;if(n===zc)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(a){this.abort("Error trying to parse loaded json: "+a);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 o=document.createElement("div");o.innerHTML=t,this.data=o}this.type=r.TYPE.XML}catch(a){this.abort("Error trying to parse loaded xml: "+a);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,Wi||(Wi=document.createElement("a")),Wi.href=e;var i=so(Wi.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("#"),o=Math.min(n>-1?n:e.length,s>-1?s:e.length);e=e.substring(0,o),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=="})(ft||(ft={}));function Te(){}function Yc(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 Vc=function(){function r(e,t){this.data=e,this.callback=t}return r}(),Qr=function(){function r(e,t){var i=this;if(t===void 0&&(t=1),this.workers=0,this.saturated=Te,this.unsaturated=Te,this.empty=Te,this.drain=Te,this.error=Te,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(n,s,o){if(o&&typeof o!="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 a=new Vc(n,typeof o=="function"?o:Te);s?i._tasks.unshift(a):i._tasks.push(a),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,Yc(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=Te,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,o=e.length;function a(h){if(h||s===o){i&&i(h);return}n?setTimeout(function(){t(e[s++],a)},1):t(e[s++],a)}a()},r.queue=function(e,t){return new r(e,t)},r}(),Jr=100,qc=/(#[\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=Qr.queue(this._boundLoadResource,t),this._queue.pause(),this.resources={},this.onProgress=new Qt,this.onError=new Qt,this.onLoad=new Qt,this.onStart=new Qt,this.onComplete=new Qt;for(var n=0;n<r._plugins.length;++n){var s=r._plugins[n],o=s.pre,a=s.use;o&&this.pre(o),a&&this.use(a)}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 ft(e,t,i),typeof n=="function"&&this.resources[e].onAfterMiddleware.once(n),this.loading){for(var s=i.parentResource,o=[],a=0;a<s.children.length;++a)s.children[a].isComplete||o.push(s.children[a]);var h=s.progressChunk*(o.length+1),u=h/(o.length+2);s.children.push(this.resources[e]),s.progressChunk=u;for(var a=0;a<o.length;++a)o[a].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(Ft("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=Jr/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=so(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=qc.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,Qr.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=Jr,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(),Qr.eachSeries(this._afterMiddleware,function(i,n){i.call(t,e,n)},function(){e.onAfterMiddleware.dispatch(e),t.progress=Math.min(Jr,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 Ft("6.5.0","Loader.registerPlugin() is deprecated, use extensions.add() instead."),Zt.add({type:tt.Loader,ref:e}),r},r._plugins=[],r}();Zt.handleByList(tt.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 $c=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=tt.Application,r}(),Zc=function(){function r(){}return r.add=function(){ft.setExtensionLoadType("svg",ft.LOAD_TYPE.XHR),ft.setExtensionXhrType("svg",ft.XHR_RESPONSE_TYPE.TEXT)},r.use=function(e,t){if(e.data&&(e.type===ft.TYPE.IMAGE||e.extension==="svg")){var i=e.data,n=e.url,s=e.name,o=e.metadata;X.fromLoader(i,n,s,o).then(function(a){e.texture=a,t()}).catch(t)}else t()},r.extension=tt.Loader,r}(),Kc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Qc(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 o=t-(r.length-1);switch(o){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64;break}for(var s=0;s<n.length;++s)e+=Kc.charAt(n[s])}return e}function Jc(r,e){if(!r.data){e();return}if(r.xhr&&r.xhrType===ft.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,"+Qc(r.xhr.responseText),r.type=ft.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=ft.TYPE.IMAGE,r.data.onload=function(){i.revokeObjectURL(n),r.data.onload=null,e()};return}}e()}var td=function(){function r(){}return r.extension=tt.Loader,r.use=Jc,r}();Zt.add(Zc,td);var J,W;(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"})(W||(W={}));var zi=(J={},J[W.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,J[W.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,J[W.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,J[W.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,J[W.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,J[W.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,J[W.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,J[W.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,J[W.COMPRESSED_R11_EAC]=.5,J[W.COMPRESSED_SIGNED_R11_EAC]=.5,J[W.COMPRESSED_RG11_EAC]=1,J[W.COMPRESSED_SIGNED_RG11_EAC]=1,J[W.COMPRESSED_RGB8_ETC2]=.5,J[W.COMPRESSED_RGBA8_ETC2_EAC]=1,J[W.COMPRESSED_SRGB8_ETC2]=.5,J[W.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=1,J[W.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,J[W.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,J[W.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,J[W.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,J[W.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,J[W.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,J[W.COMPRESSED_RGB_ETC1_WEBGL]=.5,J[W.COMPRESSED_RGB_ATC_WEBGL]=.5,J[W.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,J[W.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,J[W.COMPRESSED_RGBA_ASTC_4x4_KHR]=1,J);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 uo(r,e){tn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function ed(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(l){try{u(i.next(l))}catch(f){o(f)}}function h(l){try{u(i.throw(l))}catch(f){o(f)}}function u(l){l.done?s(l.value):n(l.value).then(a,h)}u((i=i.apply(r,e||[])).next())})}function id(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(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 rd=function(r){uo(e,r);function e(t,i){i===void 0&&(i={width:1,height:1,autoLoad:!0});var n=this,s,o;return typeof t=="string"?(s=t,o=new Uint8Array):(s=null,o=t),n=r.call(this,o,i)||this,n.origin=s,n.buffer=o?new Vr(o):null,n.origin&&i.autoLoad!==!1&&n.load(),o&&o.length&&(n.loaded=!0,n.onBlobLoaded(n.buffer.rawBinaryData)),n}return e.prototype.onBlobLoaded=function(t){},e.prototype.load=function(){return ed(this,void 0,Promise,function(){var t,i,n;return id(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 Vr(n),this.loaded=!0,this.onBlobLoaded(n),this.update(),[2,this]}})})},e}(Ke),en=function(r){uo(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,o=t.context.extensions[this._extension];if(!o)throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var a=0,h=this.levels;a<h;a++){var u=this._levelBuffers[a],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,o,a,h){for(var u=new Array(n),l=t.byteOffset,f=a,c=h,d=f+s-1&~(s-1),p=c+o-1&~(o-1),v=d*p*zi[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+o-1&~(o-1),v=d*p*zi[i];return u},e}(rd),nd=function(){function r(){}return r.use=function(e,t){var i=e.data,n=this;if(e.type===ft.TYPE.JSON&&i&&i.cacheID&&i.textures){for(var s=i.textures,o=void 0,a=void 0,h=0,u=s.length;h<u;h++){var l=s[h],f=l.src,c=l.format;if(c||(a=f),r.textureFormats[c]){o=f;break}}if(o=o||a,!o){t(new Error("Cannot load compressed-textures in "+e.url+", make sure you provide a fallback"));return}if(o===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=Oe.resolve(e.url.replace(n.baseUrl,""),o),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=tt.Loader,r}();function lo(r,e,t){var i={textures:{},texture:null};if(!e)return i;var n=e.map(function(s){return new X(new q(s,Object.assign({mipmap:It.OFF,alphaMode:Ot.NO_PREMULTIPLIED_ALPHA},t)))});return n.forEach(function(s,o){var a=s.baseTexture,h=r+"-"+(o+1);q.addToCache(a,h),X.addToCache(s,h),o===0&&(q.addToCache(a,r),X.addToCache(s,r),i.texture=s),i.textures[h]=s}),i}var ri,Nt,rn=4,Yi=124,sd=32,fo=20,od=542327876,Vi={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},ad={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},qi={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Bt;(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"})(Bt||(Bt={}));var nn;(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"})(nn||(nn={}));var hd=1,ud=2,ld=4,fd=64,cd=512,dd=131072,pd=827611204,vd=861165636,_d=894720068,md=808540228,gd=4,yd=(ri={},ri[pd]=W.COMPRESSED_RGBA_S3TC_DXT1_EXT,ri[vd]=W.COMPRESSED_RGBA_S3TC_DXT3_EXT,ri[_d]=W.COMPRESSED_RGBA_S3TC_DXT5_EXT,ri),xd=(Nt={},Nt[Bt.DXGI_FORMAT_BC1_TYPELESS]=W.COMPRESSED_RGBA_S3TC_DXT1_EXT,Nt[Bt.DXGI_FORMAT_BC1_UNORM]=W.COMPRESSED_RGBA_S3TC_DXT1_EXT,Nt[Bt.DXGI_FORMAT_BC2_TYPELESS]=W.COMPRESSED_RGBA_S3TC_DXT3_EXT,Nt[Bt.DXGI_FORMAT_BC2_UNORM]=W.COMPRESSED_RGBA_S3TC_DXT3_EXT,Nt[Bt.DXGI_FORMAT_BC3_TYPELESS]=W.COMPRESSED_RGBA_S3TC_DXT5_EXT,Nt[Bt.DXGI_FORMAT_BC3_UNORM]=W.COMPRESSED_RGBA_S3TC_DXT5_EXT,Nt[Bt.DXGI_FORMAT_BC1_UNORM_SRGB]=W.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,Nt[Bt.DXGI_FORMAT_BC2_UNORM_SRGB]=W.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,Nt[Bt.DXGI_FORMAT_BC3_UNORM_SRGB]=W.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,Nt);function bd(r){var e=new Uint32Array(r),t=e[0];if(t!==od)throw new Error("Invalid DDS file magic word");var i=new Uint32Array(r,0,Yi/Uint32Array.BYTES_PER_ELEMENT),n=i[Vi.HEIGHT],s=i[Vi.WIDTH],o=i[Vi.MIPMAP_COUNT],a=new Uint32Array(r,Vi.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,sd/Uint32Array.BYTES_PER_ELEMENT),h=a[hd];if(h&ld){var u=a[ad.FOURCC];if(u!==md){var l=yd[u],f=rn+Yi,c=new Uint8Array(r,f),d=new en(c,{format:l,width:s,height:n,levels:o});return[d]}var p=rn+Yi,v=new Uint32Array(e.buffer,p,fo/Uint32Array.BYTES_PER_ELEMENT),_=v[qi.DXGI_FORMAT],m=v[qi.RESOURCE_DIMENSION],y=v[qi.MISC_FLAG],g=v[qi.ARRAY_SIZE],b=xd[_];if(b===void 0)throw new Error("DDSParser cannot parse texture data with DXGI format "+_);if(y===gd)throw new Error("DDSParser does not support cubemap textures");if(m===nn.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");var x=new Array,T=rn+Yi+fo;if(g===1)x.push(new Uint8Array(r,T));else{for(var E=zi[b],O=0,P=s,S=n,D=0;D<o;D++){var L=Math.max(1,P+3&-4),k=Math.max(1,S+3&-4),Y=L*k*E;O+=Y,P=P>>>1,S=S>>>1}for(var M=T,D=0;D<g;D++)x.push(new Uint8Array(r,M,O)),M+=O}return x.map(function(I){return new en(I,{format:b,width:s,height:n,levels:o})})}throw h&fd?new Error("DDSParser does not support uncompressed texture data."):h&cd?new Error("DDSParser does not supported YUV uncompressed texture data."):h&dd?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&ud?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 se,Jt,ni,co=[171,75,84,88,32,49,49,187,13,10,26,10],Td=67305985,Lt={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},sn=64,po=(se={},se[U.UNSIGNED_BYTE]=1,se[U.UNSIGNED_SHORT]=2,se[U.INT]=4,se[U.UNSIGNED_INT]=4,se[U.FLOAT]=4,se[U.HALF_FLOAT]=8,se),Ed=(Jt={},Jt[R.RGBA]=4,Jt[R.RGB]=3,Jt[R.RG]=2,Jt[R.RED]=1,Jt[R.LUMINANCE]=1,Jt[R.LUMINANCE_ALPHA]=2,Jt[R.ALPHA]=1,Jt),wd=(ni={},ni[U.UNSIGNED_SHORT_4_4_4_4]=2,ni[U.UNSIGNED_SHORT_5_5_5_1]=2,ni[U.UNSIGNED_SHORT_5_6_5]=2,ni);function Sd(r,e,t){t===void 0&&(t=!1);var i=new DataView(e);if(!Pd(r,i))return null;var n=i.getUint32(Lt.ENDIANNESS,!0)===Td,s=i.getUint32(Lt.GL_TYPE,n),o=i.getUint32(Lt.GL_FORMAT,n),a=i.getUint32(Lt.GL_INTERNAL_FORMAT,n),h=i.getUint32(Lt.PIXEL_WIDTH,n),u=i.getUint32(Lt.PIXEL_HEIGHT,n)||1,l=i.getUint32(Lt.PIXEL_DEPTH,n)||1,f=i.getUint32(Lt.NUMBER_OF_ARRAY_ELEMENTS,n)||1,c=i.getUint32(Lt.NUMBER_OF_FACES,n),d=i.getUint32(Lt.NUMBER_OF_MIPMAP_LEVELS,n),p=i.getUint32(Lt.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?po[s]?x=po[s]*Ed[o]:x=wd[s]:x=zi[a],x===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var T=t?Ad(i,p,n):null,E=b*x,O=E,P=h,S=u,D=m,L=y,k=sn+p,Y=0;Y<d;Y++){for(var M=i.getUint32(k,n),I=k+4,H=0;H<f;H++){var A=g[H];A||(A=g[H]=new Array(d)),A[Y]={levelID:Y,levelWidth:d>1||s!==0?P:D,levelHeight:d>1||s!==0?S:L,levelBuffer:new Uint8Array(e,I,O)},I+=O}k+=M+4,k=k%4!==0?k+4-k%4:k,P=P>>1||1,S=S>>1||1,D=P+v-1&~(v-1),L=S+_-1&~(_-1),O=D*L*x}return s!==0?{uncompressed:g.map(function(N){var C=N[0].levelBuffer,w=!1;return s===U.FLOAT?C=new Float32Array(N[0].levelBuffer.buffer,N[0].levelBuffer.byteOffset,N[0].levelBuffer.byteLength/4):s===U.UNSIGNED_INT?(w=!0,C=new Uint32Array(N[0].levelBuffer.buffer,N[0].levelBuffer.byteOffset,N[0].levelBuffer.byteLength/4)):s===U.INT&&(w=!0,C=new Int32Array(N[0].levelBuffer.buffer,N[0].levelBuffer.byteOffset,N[0].levelBuffer.byteLength/4)),{resource:new Ke(C,{width:N[0].levelWidth,height:N[0].levelHeight}),type:s,format:w?Cd(o):o}}),kvData:T}:{compressed:g.map(function(N){return new en(null,{format:a,width:h,height:u,levels:d,levelBuffers:N})}),kvData:T}}function Pd(r,e){for(var t=0;t<co.length;t++)if(e.getUint8(t)!==co[t])return console.error(r+" is not a valid *.ktx file!"),!1;return!0}function Cd(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 Ad(r,e,t){for(var i=new Map,n=0;n<e;){var s=r.getUint32(sn+n,t),o=sn+n+4,a=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(o+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,o,h)),l=new DataView(r.buffer,o+h+1,s-h-1);i.set(u,l),n+=4+s+a}return i}ft.setExtensionXhrType("dds",ft.XHR_RESPONSE_TYPE.BUFFER);var Rd=function(){function r(){}return r.use=function(e,t){if(e.extension==="dds"&&e.data)try{Object.assign(e,lo(e.name||e.url,bd(e.data),e.metadata))}catch(i){t(i);return}t()},r.extension=tt.Loader,r}();ft.setExtensionXhrType("ktx",ft.XHR_RESPONSE_TYPE.BUFFER);var Id=function(){function r(){}return r.use=function(e,t){if(e.extension==="ktx"&&e.data)try{var i=e.name||e.url,n=Sd(i,e.data,this.loadKeyValueData),s=n.compressed,o=n.uncompressed,a=n.kvData;if(s){var h=lo(i,s,e.metadata);if(a&&h.textures)for(var u in h.textures)h.textures[u].baseTexture.ktxKeyValueData=a;Object.assign(e,h)}else if(o){var l={};o.forEach(function(f,c){var d=new X(new q(f.resource,{mipmap:It.OFF,alphaMode:Ot.NO_PREMULTIPLIED_ALPHA,type:f.type,format:f.format})),p=i+"-"+(c+1);a&&(d.baseTexture.ktxKeyValueData=a),q.addToCache(d.baseTexture,p),X.addToCache(d,p),c===0&&(l[i]=d,q.addToCache(d.baseTexture,i),X.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 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 vo(r,e){on(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){vo(e,r);function e(t,i,n,s){t===void 0&&(t=1500),n===void 0&&(n=16384),s===void 0&&(s=!1);var o=r.call(this)||this,a=16384;return n>a&&(n=a),o._properties=[!1,!0,!1,!1,!1],o._maxSize=t,o._batchSize=n,o._buffers=null,o._bufferUpdateIDs=[],o._updateID=0,o.interactiveChildren=!1,o.blendMode=G.NORMAL,o.autoResize=s,o.roundPixels=!0,o.baseTexture=null,o.setProperties(i),o._tint=0,o.tintRgb=new Float32Array(4),o.tint=16777215,o}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,Me(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})(Et);var _o=function(){function r(e,t,i){this.geometry=new Qe,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||U.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 mt(Vl(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 mt(this.dynamicData,!1,!1);var o=0;this.staticStride=0;for(var i=0;i<this.staticProperties.length;++i){var n=this.staticProperties[i];n.offset=o,o+=n.size,this.staticStride+=n.size}var a=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(a),this.staticDataUint32=new Uint32Array(a),this.staticBuffer=new mt(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===U.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===U.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===U.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===U.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}(),Od=`varying vec2 vTextureCoord;
492
+ varying vec4 vColor;
493
+
494
+ uniform sampler2D uSampler;
495
+
496
+ void main(void){
497
+ vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
498
+ gl_FragColor = color;
499
+ }`,Md=`attribute vec2 aVertexPosition;
500
+ attribute vec2 aTextureCoord;
501
+ attribute vec4 aColor;
502
+
503
+ attribute vec2 aPositionCoord;
504
+ attribute float aRotation;
505
+
506
+ uniform mat3 translationMatrix;
507
+ uniform vec4 uColor;
508
+
509
+ varying vec2 vTextureCoord;
510
+ varying vec4 vColor;
511
+
512
+ void main(void){
513
+ float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
514
+ float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
515
+
516
+ vec2 v = vec2(x, y);
517
+ v = v + aPositionCoord;
518
+
519
+ gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
520
+
521
+ vTextureCoord = aTextureCoord;
522
+ vColor = aColor * uColor;
523
+ }
524
+ `,Dd=function(r){vo(e,r);function e(t){var i=r.call(this,t)||this;return i.shader=null,i.properties=null,i.tempMatrix=new _t,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:U.UNSIGNED_BYTE,uploadFunction:i.uploadTint,offset:0}],i.shader=re.from(Md,Od,{}),i.state=xe.for2d(),i}return e.prototype.render=function(t){var i=t.children,n=t._maxSize,s=t._batchSize,o=this.renderer,a=i.length;if(a!==0){a>n&&!t.autoResize&&(a=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=ps(t.blendMode,l),o.state.set(this.state);var f=o.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(o.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Yl(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<a;p+=s,v+=1){var _=a-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,_)),o.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,o=t._properties,a=0;a<n;a+=s)i.push(new _o(this.properties,o,s));return i},e.prototype._generateOneMoreBuffer=function(t){var i=t._batchSize,n=t._properties;return new _o(this.properties,n,i)},e.prototype.uploadVertices=function(t,i,n,s,o,a){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[a]=u*v,s[a+1]=f*_,s[a+o]=h*v,s[a+o+1]=f*_,s[a+o*2]=h*v,s[a+o*2+1]=l*_,s[a+o*3]=u*v,s[a+o*3+1]=l*_,a+=o*4}},e.prototype.uploadPosition=function(t,i,n,s,o,a){for(var h=0;h<n;h++){var u=t[i+h].position;s[a]=u.x,s[a+1]=u.y,s[a+o]=u.x,s[a+o+1]=u.y,s[a+o*2]=u.x,s[a+o*2+1]=u.y,s[a+o*3]=u.x,s[a+o*3+1]=u.y,a+=o*4}},e.prototype.uploadRotation=function(t,i,n,s,o,a){for(var h=0;h<n;h++){var u=t[i+h].rotation;s[a]=u,s[a+o]=u,s[a+o*2]=u,s[a+o*3]=u,a+=o*4}},e.prototype.uploadUvs=function(t,i,n,s,o,a){for(var h=0;h<n;++h){var u=t[i+h]._texture._uvs;u?(s[a]=u.x0,s[a+1]=u.y0,s[a+o]=u.x1,s[a+o+1]=u.y1,s[a+o*2]=u.x2,s[a+o*2+1]=u.y2,s[a+o*3]=u.x3,s[a+o*3+1]=u.y3,a+=o*4):(s[a]=0,s[a+1]=0,s[a+o]=0,s[a+o+1]=0,s[a+o*2]=0,s[a+o*2+1]=0,s[a+o*3]=0,s[a+o*3+1]=0,a+=o*4)}},e.prototype.uploadTint=function(t,i,n,s,o,a){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?Sr(u._tintRGB,f):u._tintRGB+(f*255<<24);s[a]=c,s[a+o]=c,s[a+o*2]=c,s[a+o*3]=c,a+=o*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}(Fi);var te;(function(r){r.MITER="miter",r.BEVEL="bevel",r.ROUND="round"})(te||(te={}));var oe;(function(r){r.BUTT="butt",r.ROUND="round",r.SQUARE="square"})(oe||(oe={}));var si={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}},mo=function(){function r(){this.color=16777215,this.alpha=1,this.texture=X.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=X.WHITE,this.matrix=null,this.visible=!1},r.prototype.destroy=function(){this.texture=null,this.matrix=null},r}();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 hn(r,e){an(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function go(r,e){var t,i;e===void 0&&(e=!1);var n=r.length;if(!(n<6)){for(var s=0,o=0,a=r[n-2],h=r[n-1];o<n;o+=2){var u=r[o],l=r[o+1];s+=(u-a)*(l+h),a=u,h=l}if(!e&&s>0||e&&s<=0)for(var f=n/2,o=f+f%2;o<n;o+=2){var c=n-o-2,d=n-o-1,p=o,v=o+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 yo={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){go(t,!1);for(var o=[],a=0;a<i.length;a++){var h=i[a];go(h.points,!0),o.push(t.length/2),t=t.concat(h.points)}var u=Ti.exports(t,o,2);if(!u)return;for(var l=n.length/2,a=0;a<u.length;a+=3)s.push(u[a]+l),s.push(u[a+1]+l),s.push(u[a+2]+l);for(var a=0;a<t.length;a++)n.push(t[a])}}},$i={build:function(r){var e=r.points,t,i,n,s,o,a;if(r.type===gt.CIRC){var h=r.shape;t=h.x,i=h.y,o=a=h.radius,n=s=0}else if(r.type===gt.ELIP){var u=r.shape;t=u.x,i=u.y,o=u.width,a=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,o=a=Math.max(0,Math.min(l.radius,Math.min(f,c))),n=f-o,s=c-a}if(!(o>=0&&a>=0&&n>=0&&s>=0)){e.length=0;return}var d=Math.ceil(2.3*Math.sqrt(o+a)),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+o,b=s,x=t+g,T=t-g,E=i+b;if(e[v++]=x,e[v++]=E,e[--_]=E,e[--_]=T,s){var O=i-b;e[m++]=T,e[m++]=O,e[--y]=O,e[--y]=x}}for(var P=1;P<d;P++){var S=Math.PI/2*(P/d),g=n+Math.cos(S)*o,b=s+Math.sin(S)*a,x=t+g,T=t-g,E=i+b,O=i-b;e[v++]=x,e[v++]=E,e[--_]=E,e[--_]=T,e[m++]=T,e[m++]=O,e[--y]=O,e[--y]=x}{var g=n,b=s+a,x=t+g,T=t-g,E=i+b,O=i-b;e[v++]=x,e[v++]=E,e[--y]=O,e[--y]=x,n&&(e[v++]=T,e[v++]=E,e[--y]=O,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,o=s,a,h;if(r.type!==gt.RREC){var u=r.shape;a=u.x,h=u.y}else{var l=r.shape;a=l.x+l.width/2,h=l.y+l.height/2}var f=r.matrix;i.push(r.matrix?f.a*a+f.c*h+f.tx:a,r.matrix?f.b*a+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++,o,s);n.push(o+1,o,s)}}},Fd={build:function(r){var e=r.shape,t=e.x,i=e.y,n=e.width,s=e.height,o=r.points;o.length=0,o.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 Be(r,e,t){var i=e-r;return r+i*t}function Zi(r,e,t,i,n,s,o){o===void 0&&(o=[]);for(var a=20,h=o,u=0,l=0,f=0,c=0,d=0,p=0,v=0,_=0;v<=a;++v)_=v/a,u=Be(r,t,_),l=Be(e,i,_),f=Be(t,n,_),c=Be(i,s,_),d=Be(u,f,_),p=Be(l,c,_),!(v===0&&h[h.length-2]===d&&h[h.length-1]===p)&&h.push(d,p);return h}var Nd={build:function(r){if(Se.nextRoundedRectBehavior){$i.build(r);return}var e=r.shape,t=r.points,i=e.x,n=e.y,s=e.width,o=e.height,a=Math.max(0,Math.min(e.radius,Math.min(s,o)/2));t.length=0,a?(Zi(i,n+a,i,n,i+a,n,t),Zi(i+s-a,n,i+s,n,i+s,n+a,t),Zi(i+s,n+o-a,i+s,n+o,i+s-a,n+o,t),Zi(i+a,n+o,i,n+o,i,n+o-a,t)):t.push(i,n,i+s,n,i+s,n+o,i,n+o)},triangulate:function(r,e){if(Se.nextRoundedRectBehavior){$i.triangulate(r,e);return}for(var t=r.points,i=e.points,n=e.indices,s=i.length/2,o=Ti.exports(t,null,2),a=0,h=o.length;a<h;a+=3)n.push(o[a]+s),n.push(o[a+1]+s),n.push(o[a+2]+s);for(var a=0,h=t.length;a<h;a++)i.push(t[a],t[++a])}};function xo(r,e,t,i,n,s,o,a){var h=r-t*n,u=e-i*n,l=r+t*s,f=e+i*s,c,d;o?(c=i,d=-t):(c=-i,d=t);var p=h+c,v=u+d,_=l+c,m=f+d;return a.push(p,v),a.push(_,m),2}function Ee(r,e,t,i,n,s,o,a){var h=t-r,u=i-e,l=Math.atan2(h,u),f=Math.atan2(n-r,s-e);a&&l<f?l+=Math.PI*2:!a&&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,a){o.push(r,e),o.push(t,i);for(var y=1,g=c;y<_;y++,g+=m)o.push(r,e),o.push(r+Math.sin(g)*v,e+Math.cos(g)*v);o.push(r,e),o.push(n,s)}else{o.push(t,i),o.push(r,e);for(var y=1,g=c;y<_;y++,g+=m)o.push(r+Math.sin(g)*v,e+Math.cos(g)*v),o.push(r,e);o.push(n,s),o.push(r,e)}return _*2}function Bd(r,e){var t=r.shape,i=r.points||t.points.slice(),n=e.closePointEps;if(i.length!==0){var s=r.lineStyle,o=new j(i[0],i[1]),a=new j(i[i.length-2],i[i.length-1]),h=t.type!==gt.POLY||t.closeStroke,u=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(h){i=i.slice(),u&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));var l=(o.x+a.x)*.5,f=(a.y+o.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],E=0,O=0,P=-(b-T),S=g-x,D=0,L=0,k=Math.sqrt(P*P+S*S);P/=k,S/=k,P*=_,S*=_;var Y=s.alignment,M=(1-Y)*2,I=Y*2;h||(s.cap===oe.ROUND?p+=Ee(g-P*(M-I)*.5,b-S*(M-I)*.5,g-P*M,b-S*M,g+P*I,b+S*I,c,!0)+2:s.cap===oe.SQUARE&&(p+=xo(g,b,P,S,M,I,!0,c))),c.push(g-P*M,b-S*M),c.push(g+P*I,b+S*I);for(var H=1;H<d-1;++H){g=i[(H-1)*2],b=i[(H-1)*2+1],x=i[H*2],T=i[H*2+1],E=i[(H+1)*2],O=i[(H+1)*2+1],P=-(b-T),S=g-x,k=Math.sqrt(P*P+S*S),P/=k,S/=k,P*=_,S*=_,D=-(T-O),L=x-E,k=Math.sqrt(D*D+L*L),D/=k,L/=k,D*=_,L*=_;var A=x-g,N=b-T,C=x-E,w=O-T,B=A*C+N*w,V=N*C-w*A,K=V<0;if(Math.abs(V)<.001*Math.abs(B)){c.push(x-P*M,T-S*M),c.push(x+P*I,T+S*I),B>=0&&(s.join===te.ROUND?p+=Ee(x,T,x-P*M,T-S*M,x-D*M,T-L*M,c,!1)+4:p+=2,c.push(x-D*I,T-L*I),c.push(x+D*M,T+L*M));continue}var dt=(-P+g)*(-S+T)-(-P+x)*(-S+b),nt=(-D+E)*(-L+T)-(-D+x)*(-L+O),st=(A*nt-C*dt)/V,xt=(w*dt-N*nt)/V,Tt=(st-x)*(st-x)+(xt-T)*(xt-T),pt=x+(st-x)*M,et=T+(xt-T)*M,rt=x-(st-x)*I,ot=T-(xt-T)*I,$=Math.min(A*A+N*N,C*C+w*w),wt=K?M:I,Pt=$+wt*wt*m,Q=Tt<=Pt;Q?s.join===te.BEVEL||Tt/m>y?(K?(c.push(pt,et),c.push(x+P*I,T+S*I),c.push(pt,et),c.push(x+D*I,T+L*I)):(c.push(x-P*M,T-S*M),c.push(rt,ot),c.push(x-D*M,T-L*M),c.push(rt,ot)),p+=2):s.join===te.ROUND?K?(c.push(pt,et),c.push(x+P*I,T+S*I),p+=Ee(x,T,x+P*I,T+S*I,x+D*I,T+L*I,c,!0)+4,c.push(pt,et),c.push(x+D*I,T+L*I)):(c.push(x-P*M,T-S*M),c.push(rt,ot),p+=Ee(x,T,x-P*M,T-S*M,x-D*M,T-L*M,c,!1)+4,c.push(x-D*M,T-L*M),c.push(rt,ot)):(c.push(pt,et),c.push(rt,ot)):(c.push(x-P*M,T-S*M),c.push(x+P*I,T+S*I),s.join===te.ROUND?K?p+=Ee(x,T,x+P*I,T+S*I,x+D*I,T+L*I,c,!0)+2:p+=Ee(x,T,x-P*M,T-S*M,x-D*M,T-L*M,c,!1)+2:s.join===te.MITER&&Tt/m<=y&&(K?(c.push(rt,ot),c.push(rt,ot)):(c.push(pt,et),c.push(pt,et)),p+=2),c.push(x-D*M,T-L*M),c.push(x+D*I,T+L*I),p+=2)}g=i[(d-2)*2],b=i[(d-2)*2+1],x=i[(d-1)*2],T=i[(d-1)*2+1],P=-(b-T),S=g-x,k=Math.sqrt(P*P+S*S),P/=k,S/=k,P*=_,S*=_,c.push(x-P*M,T-S*M),c.push(x+P*I,T+S*I),h||(s.cap===oe.ROUND?p+=Ee(x-P*(M-I)*.5,T-S*(M-I)*.5,x-P*M,T-S*M,x+P*I,T+S*I,c,!1)+2:s.cap===oe.SQUARE&&(p+=xo(x,T,P,S,M,I,!1,c)));for(var Yt=e.indices,ke=si.epsilon*si.epsilon,H=v;H<p+v-2;++H)g=c[H*2],b=c[H*2+1],x=c[(H+1)*2],T=c[(H+1)*2+1],E=c[(H+2)*2],O=c[(H+2)*2+1],!(Math.abs(g*(T-O)+x*(O-b)+E*(b-T))<ke)&&Yt.push(H,H+1,H+2)}}function Ld(r,e){var t=0,i=r.shape,n=r.points||i.points,s=i.type!==gt.POLY||i.closeStroke;if(n.length!==0){var o=e.points,a=e.indices,h=n.length/2,u=o.length/2,l=u;for(o.push(n[0],n[1]),t=1;t<h;t++)o.push(n[t*2],n[t*2+1]),a.push(l,l+1),l++;s&&a.push(l,u)}}function bo(r,e){r.lineStyle.native?Ld(r,e):Bd(r,e)}var To=function(){function r(){}return r.curveTo=function(e,t,i,n,s,o){var a=o[o.length-2],h=o[o.length-1],u=h-t,l=a-e,f=n-t,c=i-e,d=Math.abs(u*c-l*f);if(d<1e-8||s===0)return(o[o.length-2]!==e||o[o.length-1]!==t)&&o.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,E=l*(y+g),O=u*(y+g),P=c*(m+b),S=f*(m+b),D=Math.atan2(O-T,E-x),L=Math.atan2(S-T,P-x);return{cx:x+e,cy:T+t,radius:s,startAngle:D,endAngle:L,anticlockwise:l*f>c*u}},r.arc=function(e,t,i,n,s,o,a,h,u){for(var l=a-o,f=si._segmentsCount(Math.abs(l)*s,Math.ceil(Math.abs(l)/pi)*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+o+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}(),Ud=function(){function r(){}return r.curveLength=function(e,t,i,n,s,o,a,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,E=1;E<=u;++E)f=E/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*a,y=_*t+3*v*f*n+3*p*c*o+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,o,a){var h=a[a.length-2],u=a[a.length-1];a.length-=2;var l=si._segmentsCount(r.curveLength(h,u,e,t,i,n,s,o)),f=0,c=0,d=0,p=0,v=0;a.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,a.push(d*h+3*c*m*e+3*f*p*i+v*s,d*u+3*c*m*t+3*f*p*n+v*o)},r}(),Gd=function(){function r(){}return r.curveLength=function(e,t,i,n,s,o){var a=e-2*i+s,h=t-2*n+o,u=2*i-2*e,l=2*n-2*t,f=4*(a*a+h*h),c=4*(a*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 o=s[s.length-2],a=s[s.length-1],h=si._segmentsCount(r.curveLength(o,a,e,t,i,n)),u=0,l=0,f=1;f<=h;++f){var c=f/h;u=o+(e-o)*c,l=a+(t-a)*c,s.push(u+(e+(i-e)*c-u)*c,l+(t+(n-t)*c-l)*c)}},r}(),kd=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}(),we,un=(we={},we[gt.POLY]=yo,we[gt.CIRC]=$i,we[gt.ELIP]=$i,we[gt.RECT]=Fd,we[gt.RREC]=Nd,we),Eo=[],Ki=[],wo=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}(),Le=new j,Hd=function(r){hn(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 Oi,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(),Ki.push(this.drawCalls[t]);this.drawCalls.length=0;for(var t=0;t<this.batches.length;t++){var i=this.batches[t];i.reset(),Eo.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 o=new wo(t,i,n,s);return this.graphicsData.push(o),this.dirty++,this},e.prototype.drawHole=function(t,i){if(i===void 0&&(i=null),!this.graphicsData.length)return null;var n=new wo(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,Le):Le.copyFrom(t),s.shape.contains(Le.x,Le.y))){var o=!1;if(s.holes)for(var a=0;a<s.holes.length;a++){var h=s.holes[a];if(h.shape.contains(Le.x,Le.y)){o=!0;break}}if(!o)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 o=this.shapeIndex;o<i.length;o++){this.shapeIndex++;var a=i[o],h=a.fillStyle,u=a.lineStyle,l=un[a.type];l.build(a),a.matrix&&this.transformPoints(a.points,a.matrix),(h.visible||u.visible)&&this.processHoles(a.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=kt.REPEAT,f===0?this.processFill(a):this.processLine(a);var _=this.points.length/2-v;_!==0&&(n&&!this._compareStyles(s,c)&&(n.end(p,v),n=null),n||(n=Eo.pop()||new kd,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,o=n.lineStyle;if(s&&!s.texture.baseTexture.valid||o&&!o.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],o=0;o<s.size;o++){var a=s.start+o;this.indicesUint16[a]=this.indicesUint16[a]-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=++q._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),Ki.push(this.drawCalls[i]);this.drawCalls.length=0;var n=this.colors,s=this.textureIds,o=Ki.pop();o||(o=new zr,o.texArray=new Yr),o.texArray.count=0,o.start=0,o.size=0,o.type=Rt.TRIANGLES;var a=0,h=null,u=0,l=!1,f=Rt.TRIANGLES,c=0;this.drawCalls.push(o);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?Rt.LINES:Rt.TRIANGLES,h=null,a=p,t++),h!==_&&(h=_,_._batchEnabled!==t&&(a===p&&(t++,a=0,o.size>0&&(o=Ki.pop(),o||(o=new zr,o.texArray=new Yr),this.drawCalls.push(o)),o.start=c,o.size=0,o.texArray.count=0,o.type=f),_.touched=1,_._batchEnabled=t,_._batchLocation=a,_.wrapMode=kt.REPEAT,o.texArray.elements[o.texArray.count++]=_,a++)),o.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)}q._globalBatch=t,this.packAttributes()},e.prototype.packAttributes=function(){for(var t=this.points,i=this.uvs,n=this.colors,s=this.textureIds,o=new ArrayBuffer(t.length*3*4),a=new Float32Array(o),h=new Uint32Array(o),u=0,l=0;l<t.length/2;l++)a[u++]=t[l*2],a[u++]=t[l*2+1],a[u++]=i[l*2],a[u++]=i[l*2+1],h[u++]=n[l],a[u++]=s[l];this._buffer.update(o),this._indexBuffer.update(this.indicesUint16)},e.prototype.processFill=function(t){if(t.holes.length)yo.triangulate(t,this);else{var i=un[t.type];i.triangulate(t,this)}},e.prototype.processLine=function(t){bo(t,this);for(var i=0;i<t.holes.length;i++)bo(t.holes[i],this)},e.prototype.processHoles=function(t){for(var i=0;i<t.length;i++){var n=t[i],s=un[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],o=t[n*2+1];t[n*2]=i.a*s+i.c*o+i.tx,t[n*2+1]=i.b*s+i.d*o+i.ty}},e.prototype.addColors=function(t,i,n,s,o){o===void 0&&(o=0);var a=(i>>16)+(i&65280)+((i&255)<<16),h=Sr(a,n);t.length=Math.max(t.length,o+s);for(var u=0;u<s;u++)t[o+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 o=0;o<n;o++)t[s+o]=i},e.prototype.addUvs=function(t,i,n,s,o,a){a===void 0&&(a=null);for(var h=0,u=i.length,l=n.frame;h<o;){var f=t[(s+h)*2],c=t[(s+h)*2+1];if(a){var d=a.a*f+a.c*c+a.tx;c=a.b*f+a.d*c+a.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,o)},e.prototype.adjustUvs=function(t,i,n,s){for(var o=i.baseTexture,a=1e-6,h=n+s*2,u=i.frame,l=u.width/o.width,f=u.height/o.height,c=u.x/u.width,d=u.y/u.height,p=Math.floor(t[n]+a),v=Math.floor(t[n+1]+a),_=n+2;_<h;_+=2)p=Math.min(p,Math.floor(t[_]+a)),v=Math.min(v,Math.floor(t[_+1]+a));c-=p,d-=v;for(var _=n;_<h;_+=2)t[_]=(t[_]+c)*l,t[_+1]=(t[_+1]+d)*f},e.BATCHABLE_SIZE=100,e}($s),Xd=function(r){hn(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=oe.BUTT,t.join=te.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}(mo),Wd=new Float32Array(3),ln={},Se=function(r){hn(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 mo,i._lineStyle=new Xd,i._matrix=null,i._holeMode=!1,i.state=xe.for2d(),i._geometry=t||new Hd,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,o){return t===void 0&&(t=null),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=.5),o===void 0&&(o=!1),typeof t=="number"&&(t={width:t,color:i,alpha:n,alignment:s,native:o}),this.lineTextureStyle(t)},e.prototype.lineTextureStyle=function(t){t=Object.assign({width:0,texture:X.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:oe.BUTT,join:te.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 _i,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[i-2],t[i-1]))}else this.currentPath=new _i,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],o=n[n.length-1];return(s!==t||o!==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 o=this.currentPath.points;return o.length===0&&this.moveTo(0,0),Gd.curveTo(t,i,n,s,o),this},e.prototype.bezierCurveTo=function(t,i,n,s,o,a){return this._initCurve(),Ud.curveTo(t,i,n,s,o,a,this.currentPath.points),this},e.prototype.arcTo=function(t,i,n,s,o){this._initCurve(t,i);var a=this.currentPath.points,h=To.curveTo(t,i,n,s,o,a);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,o,a){if(a===void 0&&(a=!1),s===o)return this;!a&&o<=s?o+=pi:a&&s<=o&&(s+=pi);var h=o-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 To.arc(u,l,t,i,n,s,o,a,c),this},e.prototype.beginFill=function(t,i){return t===void 0&&(t=0),i===void 0&&(i=1),this.beginTextureFill({texture:X.WHITE,color:t,alpha:i})},e.prototype.beginTextureFill=function(t){t=Object.assign({texture:X.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,o){return this.drawShape(new ia(t,i,n,s,o))},e.prototype.drawCircle=function(t,i,n){return this.drawShape(new ta(t,i,n))},e.prototype.drawEllipse=function(t,i,n,s){return this.drawShape(new ea(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,o=!0,a=i[0];a.points?(o=a.closeStroke,s=a.points):Array.isArray(i[0])?s=i[0]:s=i;var h=new _i(s);return h.closeStroke=o,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===gt.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 o=t.batches[s],a=o.style.color,h=new Float32Array(this.vertexData.buffer,o.attribStart*4*2,o.attribSize*2),u=new Float32Array(t.uvsFloat32.buffer,o.attribStart*4*2,o.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,o.start*2,o.size),f={vertexData:h,blendMode:i,indices:l,uvs:u,_batchRGB:Me(a),_tintRGB:a,_texture:o.style.texture,alpha:o.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,o=this.worldAlpha,a=i.uniforms,h=n.drawCalls;a.translationMatrix=this.transform.worldTransform,a.tint[0]=(s>>16&255)/255*o,a.tint[1]=(s>>8&255)/255*o,a.tint[2]=(s&255)/255*o,a.tint[3]=o,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,o=i.size,a=i.start,h=n.count,u=0;u<h;u++)t.texture.bind(n.elements[u],u);t.geometry.draw(s,o,a)},e.prototype._resolveDirectShader=function(t){var i=this.shader,n=this.pluginName;if(!i){if(!ln[n]){for(var s=t.plugins[n].MAX_TEXTURES,o=new Int32Array(s),a=0;a<s;a++)o[a]=a;var h={tint:new Float32Array([1,1,1,1]),translationMatrix:new _t,default:ye.from({uSamplers:o},!0)},u=t.plugins[n]._shader.program;ln[n]=new re(u,h)}i=ln[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,o=i.maxX,a=i.maxY;this._bounds.addFrame(this.transform,n,s,o,a)}},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=Me(this.tint,Wd),i=0;i<this.batches.length;i++){var n=this.batches[i],s=n._batchRGB,o=t[0]*s[0]*255,a=t[1]*s[1]*255,h=t[2]*s[2]*255,u=(o<<16)+(a<<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,o=i.c,a=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+o*v+h,f[c++]=a*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 j,e}(Et);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 jd(r,e){fn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var oi=new j,zd=new Uint16Array([0,1,2,0,2,3]),ai=function(r){jd(e,r);function e(t){var i=r.call(this)||this;return i._anchor=new Ce(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||X.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=zd,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=Fe(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Fe(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,o=i.c,a=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+o*m+h,l[1]=a*m+s*v+u,l[2]=n*p+o*m+h,l[3]=a*m+s*p+u,l[4]=n*p+o*_+h,l[5]=a*_+s*p+u,l[6]=n*v+o*_+h,l[7]=a*_+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,o=this.transform.worldTransform,a=o.a,h=o.b,u=o.c,l=o.d,f=o.tx,c=o.ty,d=-s._x*n.width,p=d+n.width,v=-s._y*n.height,_=v+n.height;i[0]=a*d+u*v+f,i[1]=l*v+h*d+c,i[2]=a*p+u*v+f,i[3]=l*v+h*p+c,i[4]=a*p+u*_+f,i[5]=l*_+h*p+c,i[6]=a*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 Oi),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,oi);var i=this._texture.orig.width,n=this._texture.orig.height,s=-i*this.anchor.x,o=0;return oi.x>=s&&oi.x<s+i&&(o=-n*this.anchor.y,oi.y>=o&&oi.y<o+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 X?t:X.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=Fe(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=Fe(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||X.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}(Et);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 Yd(r,e){cn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var hi;(function(r){r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"})(hi||(hi={}));var dn={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:hi.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},Vd=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Ue=function(){function r(e){this.styleID=0,this.reset(),vn(this,e,e)}return r.prototype.clone=function(){var e={};return vn(e,this,dn),new r(e)},r.prototype.reset=function(){vn(this,dn,dn)},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=pn(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=pn(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){qd(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=pn(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)&&Vd.indexOf(n)<0&&(n='"'+n+'"'),t[i]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+e+" "+t.join(",")},r}();function So(r){return typeof r=="number"?fs(r):(typeof r=="string"&&r.indexOf("0x")===0&&(r=r.replace("0x","#")),r)}function pn(r){if(Array.isArray(r)){for(var e=0;e<r.length;++e)r[e]=So(r[e]);return r}else return So(r)}function qd(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 vn(r,e,t){for(var i in t)Array.isArray(e[i])?r[i]=e[i].slice():r[i]=e[i]}var Qi={willReadFrequently:!0},jt=function(){function r(e,t,i,n,s,o,a,h,u){this.text=e,this.style=t,this.width=i,this.height=n,this.lines=s,this.lineWidths=o,this.lineHeight=a,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(),o=r.measureFont(s);o.fontSize===0&&(o.fontSize=t.fontSize,o.ascent=t.fontSize);var a=n.getContext("2d",Qi);a.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=a.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||o.fontSize+t.strokeThickness,_=Math.max(v,o.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,o)},r.wordWrap=function(e,t,i){i===void 0&&(i=r._canvas);for(var n=i.getContext("2d",Qi),s=0,o="",a="",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){a+=r.addLine(o),d=!f,o="",s=0;continue}m=" "}if(f){var y=r.isBreakingSpace(m),g=r.isBreakingSpace(o[o.length-1]);if(y&&g)continue}var b=r.getFromCache(m,u,h,n);if(b>p)if(o!==""&&(a+=r.addLine(o),o="",s=0),r.canBreakWords(m,t.breakWords))for(var x=r.wordWrapSplit(m),T=0;T<x.length;T++){for(var E=x[T],O=1;x[T+O];){var P=x[T+O],S=E[E.length-1];if(!r.canBreakChars(S,P,m,T,t.breakWords))E+=P;else break;O++}T+=E.length-1;var D=r.getFromCache(E,u,h,n);D+s>p&&(a+=r.addLine(o),d=!1,o="",s=0),o+=E,s+=D}else{o.length>0&&(a+=r.addLine(o),o="",s=0);var L=_===v.length-1;a+=r.addLine(m,!L),d=!1,o="",s=0}else b+s>p&&(d=!1,a+=r.addLine(o),o="",s=0),(o.length>0||!r.isBreakingSpace(m)||d)&&(o+=m,s+=b)}return a+=r.addLine(o,!1),a},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 o=e.length*t;s=n.measureText(e).width+o,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],o=e[n+1];if(r.isBreakingSpace(s,o)||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,o=Math.ceil(n.measureText(s).width),a=Math.ceil(n.measureText(r.BASELINE_SYMBOL).width),h=Math.ceil(r.HEIGHT_MULTIPLIER*a);a=a*r.BASELINE_MULTIPLIER|0,i.width=o,i.height=h,n.fillStyle="#f00",n.fillRect(0,0,o,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,a);var u=n.getImageData(0,0,o,h).data,l=u.length,f=o*4,c=0,d=0,p=!1;for(c=0;c<a;++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=a-c,d=l-f,p=!1,c=h;c>a;--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-a,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",Qi);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",Qi)),r.__context},enumerable:!1,configurable:!0}),r}();jt._fonts={},jt.METRICS_STRING="|ÉqÅ",jt.BASELINE_SYMBOL="M",jt.BASELINE_MULTIPLIER=1.4,jt.HEIGHT_MULTIPLIER=2,jt._newlines=[10,13],jt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var $d={texture:!0,children:!1,baseTexture:!0},Po=function(r){Yd(e,r);function e(t,i,n){var s=this,o=!1;n||(n=F.ADAPTER.createCanvas(),o=!0),n.width=3,n.height=3;var a=X.from(n);return a.orig=new z,a.trim=new z,s=r.call(this,a)||this,s._ownCanvas=o,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=jt.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),o=s.width,a=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,o)+i.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+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,a)+i.padding*2):0,g=y*this._resolution;if(m){n.fillStyle="black",n.strokeStyle="black";var b=i.dropShadowColor,x=Me(typeof b=="number"?b:cs(b)),T=i.dropShadowBlur*this._resolution,E=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)*E,n.shadowOffsetY=Math.sin(i.dropShadowAngle)*E+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 O=(u-c.fontSize)/2;(!e.nextLineHeightBehavior||u-c.fontSize<0)&&(O=0);for(var P=0;P<h.length;P++)d=i.strokeThickness/2,p=i.strokeThickness/2+P*u+c.ascent+O,i.align==="right"?d+=f-l[P]:i.align==="center"&&(d+=(f-l[P])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(h[P],d+i.padding,p+i.padding-y,!0),i.fill&&this.drawLetterSpacing(h[P],d+i.padding,p+i.padding-y)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,i,n,s){s===void 0&&(s=!1);var o=this._style,a=o.letterSpacing,h=e.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(a===0||h){h&&(this.context.letterSpacing=a,this.context.textLetterSpacing=a),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+a,f=c}},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var i=$l(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,o=s.trim?0:s.padding,a=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=-o,n.trim.y=-o,n.orig.width=n._frame.width-o*2,n.orig.height=n._frame.height-o*2,this._onTextureUpdate(),a.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 o,a=t.dropShadow?t.dropShadowDistance:0,h=t.padding||0,u=this.canvas.width/this._resolution-a-h*2,l=this.canvas.height/this._resolution-a-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===hi.LINEAR_VERTICAL){o=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,E=0;E<f.length;E++){var O=0;typeof c[E]=="number"?O=c[E]:O=E/f.length;var P=Math.min(1,Math.max(0,y/l+O*T));P=Number(P.toFixed(5)),o.addColorStop(P,f[E])}}}else{o=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 L=void 0;typeof c[p]=="number"?L=c[p]:L=D/S,o.addColorStop(L,f[p]),D++}}return o},e.prototype.destroy=function(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},$d,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=Fe(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=Fe(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 Ue?this._style=t:this._style=new Ue(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}(ai);F.UPLOADS_PER_FRAME=4;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 Zd(r,e){_n(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Kd=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 Qd(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 X){var n=r._textures[i].baseTexture;e.indexOf(n)===-1&&(e.push(n),t=!0)}}return t}function Jd(r,e){if(r.baseTexture instanceof q){var t=r.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function tp(r,e){if(r._texture&&r._texture instanceof X){var t=r._texture.baseTexture;return e.indexOf(t)===-1&&e.push(t),!0}return!1}function ep(r,e){return e instanceof Po?(e.updateText(!0),!0):!1}function ip(r,e){if(e instanceof Ue){var t=e.toFontString();return jt.measureFont(t),!0}return!1}function rp(r,e){if(r instanceof Po){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 np(r,e){return r instanceof Ue?(e.indexOf(r)===-1&&e.push(r),!0):!1}var sp=function(){function r(e){var t=this;this.limiter=new Kd(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(rp),this.registerFindHook(np),this.registerFindHook(Qd),this.registerFindHook(Jd),this.registerFindHook(tp),this.registerUploadHook(ep),this.registerUploadHook(ip)}return r.prototype.upload=function(e,t){var i=this;return typeof e=="function"&&(t=e,e=null),t&&Ft("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,yt.system.addOnce(i.tick,i,Kt.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)yt.system.addOnce(this.tick,this,Kt.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 Et)for(var t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this},r.prototype.destroy=function(){this.ticking&&yt.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 Co(r,e){return e instanceof q?(e._glTextures[r.CONTEXT_UID]||r.texture.bind(e),!0):!1}function op(r,e){if(!(e instanceof Se))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&&Co(r,s.baseTexture)}return t.batchable||r.geometry.bind(t,e._resolveDirectShader(r)),!0}function ap(r,e){return r instanceof Se?(e.push(r),!0):!1}var hp=function(r){Zd(e,r);function e(t){var i=r.call(this,t)||this;return i.uploadHookHelper=i.renderer,i.registerFindHook(ap),i.registerUploadHook(Co),i.registerUploadHook(op),i}return e.extension={name:"prepare",type:tt.RendererPlugin},e}(sp);var up=function(){function r(e,t,i){i===void 0&&(i=null),this.linkedSheets=[],this._texture=e instanceof X?e:null,this.baseTexture=e instanceof q?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=Ii(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&&Ft("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],o=s.frame;if(o){var a=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?a=new z(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new z(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.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(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[n]=new X(this.baseTexture,a,l,h,s.rotated?2:0,s.anchor),X.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}(),lp=function(){function r(){}return r.use=function(e,t){var i,n,s=this,o=e.name+"_image";if(!e.data||e.type!==ft.TYPE.JSON||!e.data.frames||s.resources[o]){t();return}var a=(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(a))for(var h=function(p){if(typeof p!="string")return"continue";var v=p.replace(".json",""),_=Oe.resolve(e.url.replace(s.baseUrl,""),p);if(s.resources[v]||Object.values(s.resources).some(function(y){return Oe.format(Oe.parse(y.url))===_}))return"continue";var m={crossOrigin:e.crossOrigin,loadType:ft.LOAD_TYPE.XHR,xhrType:ft.XHR_RESPONSE_TYPE.JSON,parentResource:e,metadata:e.metadata};s.add(v,_,m)},u=0,l=a;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(o,d,c,function(v){if(v.error){t(v.error);return}var _=new up(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:Oe.resolve(e.url.replace(t,""),e.data.meta.image)},r.extension=tt.Loader,r}();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 Ao(r,e){mn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ui=new j;(function(r){Ao(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 Ln,s._width=i,s._height=n,s.uvMatrix=s.texture.uvMatrix||new Xr(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,ui);var i=this._width,n=this._height,s=-i*this.anchor._x;if(ui.x>=s&&ui.x<s+i){var o=-n*this.anchor._y;if(ui.y>=o&&ui.y<o+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 X?t:X.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})(ai);var fp=`#version 100
526
+ #define SHADER_NAME Tiling-Sprite-Simple-100
527
+
528
+ precision lowp float;
529
+
530
+ varying vec2 vTextureCoord;
531
+
532
+ uniform sampler2D uSampler;
533
+ uniform vec4 uColor;
534
+
535
+ void main(void)
536
+ {
537
+ vec4 texSample = texture2D(uSampler, vTextureCoord);
538
+ gl_FragColor = texSample * uColor;
539
+ }
540
+ `,Ro=`#version 100
541
+ #define SHADER_NAME Tiling-Sprite-100
542
+
543
+ precision lowp float;
544
+
545
+ attribute vec2 aVertexPosition;
546
+ attribute vec2 aTextureCoord;
547
+
548
+ uniform mat3 projectionMatrix;
549
+ uniform mat3 translationMatrix;
550
+ uniform mat3 uTransform;
551
+
552
+ varying vec2 vTextureCoord;
553
+
554
+ void main(void)
555
+ {
556
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
557
+
558
+ vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
559
+ }
560
+ `,cp=`#version 100
561
+ #ifdef GL_EXT_shader_texture_lod
562
+ #extension GL_EXT_shader_texture_lod : enable
563
+ #endif
564
+ #define SHADER_NAME Tiling-Sprite-100
565
+
566
+ precision lowp float;
567
+
568
+ varying vec2 vTextureCoord;
569
+
570
+ uniform sampler2D uSampler;
571
+ uniform vec4 uColor;
572
+ uniform mat3 uMapCoord;
573
+ uniform vec4 uClampFrame;
574
+ uniform vec2 uClampOffset;
575
+
576
+ void main(void)
577
+ {
578
+ vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
579
+ coord = (uMapCoord * vec3(coord, 1.0)).xy;
580
+ vec2 unclamped = coord;
581
+ coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
582
+
583
+ #ifdef GL_EXT_shader_texture_lod
584
+ vec4 texSample = unclamped == coord
585
+ ? texture2D(uSampler, coord)
586
+ : texture2DLodEXT(uSampler, coord, 0);
587
+ #else
588
+ vec4 texSample = texture2D(uSampler, coord);
589
+ #endif
590
+
591
+ gl_FragColor = texSample * uColor;
592
+ }
593
+ `,dp=`#version 300 es
594
+ #define SHADER_NAME Tiling-Sprite-300
595
+
596
+ precision lowp float;
597
+
598
+ in vec2 aVertexPosition;
599
+ in vec2 aTextureCoord;
600
+
601
+ uniform mat3 projectionMatrix;
602
+ uniform mat3 translationMatrix;
603
+ uniform mat3 uTransform;
604
+
605
+ out vec2 vTextureCoord;
606
+
607
+ void main(void)
608
+ {
609
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
610
+
611
+ vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
612
+ }
613
+ `,pp=`#version 300 es
614
+ #define SHADER_NAME Tiling-Sprite-100
615
+
616
+ precision lowp float;
617
+
618
+ in vec2 vTextureCoord;
619
+
620
+ out vec4 fragmentColor;
621
+
622
+ uniform sampler2D uSampler;
623
+ uniform vec4 uColor;
624
+ uniform mat3 uMapCoord;
625
+ uniform vec4 uClampFrame;
626
+ uniform vec2 uClampOffset;
627
+
628
+ void main(void)
629
+ {
630
+ vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
631
+ coord = (uMapCoord * vec3(coord, 1.0)).xy;
632
+ vec2 unclamped = coord;
633
+ coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
634
+
635
+ vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
636
+
637
+ fragmentColor = texSample * uColor;
638
+ }
639
+ `,Ji=new _t,vp=function(r){Ao(e,r);function e(t){var i=r.call(this,t)||this;return t.runners.contextChange.add(i),i.quad=new Ms,i.state=xe.for2d(),i}return e.prototype.contextChange=function(){var t=this.renderer,i={globals:t.globalUniforms};this.simpleShader=re.from(Ro,fp,i),this.shader=t.context.webGLVersion>1?re.from(dp,pp,i):re.from(Ro,cp,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 o=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;s=n.uvs,s[0]=s[6]=-o,s[1]=s[3]=-a,s[2]=s[4]=1-o,s[5]=s[7]=1-a,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!==kt.CLAMP:u.wrapMode===kt.CLAMP&&(u.wrapMode=kt.REPEAT));var p=d?this.simpleShader:this.shader,v=h.width,_=h.height,m=t._width,y=t._height;Ji.set(f.a*v/m,f.b*v/y,f.c*_/m,f.d*_/y,f.tx/m,f.ty/y),Ji.invert(),d?Ji.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=Ji.toArray(!0),p.uniforms.uColor=vs(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=ps(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}(Fi);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 yn(r,e){gn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var _p=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}(),xn=new j,Io=new _i,li=function(r){yn(e,r);function e(t,i,n,s){s===void 0&&(s=Rt.TRIANGLES);var o=r.call(this)||this;return o.geometry=t,o.shader=i,o.state=n||xe.for2d(),o.drawMode=s,o.start=0,o.size=0,o.uvs=null,o.indices=null,o.vertexData=new Float32Array(1),o.vertexDirty=-1,o._transformID=-1,o._roundPixels=F.ROUND_PIXELS,o.batchUvs=null,o}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===Rt.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 o=this.transform.worldTransform,a=o.a,h=o.b,u=o.c,l=o.d,f=o.tx,c=o.ty,d=this.vertexData,p=0;p<d.length/2;p++){var v=n[p*2],_=n[p*2+1];d[p*2]=a*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 _p(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,xn);for(var i=this.geometry.getBuffer("aVertexPosition").data,n=Io.points,s=this.geometry.getIndex().data,o=s.length,a=this.drawMode===4?3:1,h=0;h+2<o;h+=a){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],Io.contains(xn.x,xn.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}(Et),mp=`varying vec2 vTextureCoord;
640
+ uniform vec4 uColor;
641
+
642
+ uniform sampler2D uSampler;
643
+
644
+ void main(void)
645
+ {
646
+ gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
647
+ }
648
+ `,gp=`attribute vec2 aVertexPosition;
649
+ attribute vec2 aTextureCoord;
650
+
651
+ uniform mat3 projectionMatrix;
652
+ uniform mat3 translationMatrix;
653
+ uniform mat3 uTextureMatrix;
654
+
655
+ varying vec2 vTextureCoord;
656
+
657
+ void main(void)
658
+ {
659
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
660
+
661
+ vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
662
+ }
663
+ `,fi=function(r){yn(e,r);function e(t,i){var n=this,s={uSampler:t,alpha:1,uTextureMatrix:_t.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||ei.from(gp,mp),s)||this,n._colorDirty=!1,n.uvMatrix=new Xr(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;vs(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(re),tr=function(r){yn(e,r);function e(t,i,n){var s=r.call(this)||this,o=new mt(t),a=new mt(i,!0),h=new mt(n,!0,!0);return s.addAttribute("aVertexPosition",o,2,!1,U.FLOAT).addAttribute("aTextureCoord",a,2,!1,U.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}(Qe);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 yp(r,e){bn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var er=function(){function r(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}return r}(),xp=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],o=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(var h in o){var u=o[h].split("="),l=u[0],f=u[1].replace(/"/gm,""),c=parseFloat(f),d=isNaN(c)?f:c;a[l]=d}i[s].push(a)}var p=new er;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}(),Tn=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 er,i=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),s=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=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<o.length;u++){var l=o[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<a.length;u++)t.kerning.push({first:parseInt(a[u].getAttribute("first"),10),second:parseInt(a[u].getAttribute("second"),10),amount:parseInt(a[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}(),bp=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 Tn.test(t)}return!1},r.parse=function(e){var t=new globalThis.DOMParser().parseFromString(e,"text/xml");return Tn.parse(t)},r}(),En=[xp,Tn,bp];function Oo(r){for(var e=0;e<En.length;e++)if(En[e].test(r))return En[e];return null}function Tp(r,e,t,i,n,s){var o=t.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;var a,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=o.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(o[0]),d.unshift(0),c.push(o[o.length-1]),d.push(1),t.fillGradientType===hi.LINEAR_VERTICAL){a=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,E=Math.max(_,T);E=Math.min(E,1),a.addColorStop(E,c[b]),_=E}}else{a=e.createLinearGradient(u,f/2,l+u,f/2);for(var O=c.length+1,P=1,v=0;v<c.length;v++){var S=void 0;typeof d[v]=="number"?S=d[v]:S=P/O,a.addColorStop(S,c[v]),P++}}return a}function Ep(r,e,t,i,n,s,o){var a=t.text,h=t.fontProperties;e.translate(i,n),e.scale(s,s);var u=o.strokeThickness/2,l=-(o.strokeThickness/2);if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=Tp(r,e,o,s,[a],t),e.strokeStyle=o.stroke,o.dropShadow){var f=o.dropShadowColor,c=Me(typeof f=="number"?f:cs(f)),d=o.dropShadowBlur*s,p=o.dropShadowDistance*s;e.shadowColor="rgba("+c[0]*255+","+c[1]*255+","+c[2]*255+","+o.dropShadowAlpha+")",e.shadowBlur=d,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*p,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*p}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,u,l+t.lineHeight-h.descent),o.fill&&e.fillText(a,u,l+t.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function Mo(r){return Array.from?Array.from(r):r.split("")}function wp(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),o=n[1].charCodeAt(0);if(o<s)throw new Error("[BitmapFont]: Invalid character range.");for(var a=s,h=o;a<=h;a++)e.push(String.fromCharCode(a))}else e.push.apply(e,Mo(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}function ir(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}var Ut=function(){function r(e,t,i){var n,s,o=e.info[0],a=e.common[0],h=e.page[0],u=e.distanceField[0],l=Ii(h.file),f={};this._ownsTextures=i,this.font=o.face,this.size=o.size,this.lineHeight=a.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=Ot.NO_PREMULTIPLIED_ALPHA,f[p].baseTexture.mipmap=It.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,E=y.xoffset,O=y.yoffset,P=y.xadvance;g/=l,b/=l,x/=l,T/=l,E/=l,O/=l,P/=l;var S=new z(g+f[m].frame.x/l,b+f[m].frame.y/l,x,T);this.chars[p]={xOffset:E,yOffset:O,xAdvance:P,kerning:{},texture:new X(f[m].baseTexture,S),page:m}}for(var c=0;c<e.kerning.length;c++){var D=e.kerning[c],L=D.first,k=D.second,Y=D.amount;L/=l,k/=l,Y/=l,this.chars[k]&&(this.chars[k].kerning[L]=Y)}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 er)n=e;else{var s=Oo(e);if(!s)throw new Error("Unrecognized data format for font.");n=s.parse(e)}t instanceof X&&(t=[t]);var o=new r(n,t,i);return r.available[o.font]=o,o},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,o=n.padding,a=n.resolution,h=n.textureWidth,u=n.textureHeight,l=wp(s),f=t instanceof Ue?t:new Ue(t),c=h,d=new er;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 q(_,{resolution:a}),b.push(new X(y)),d.page.push({id:b.length-1,file:""}));var T=l[x],E=jt.measureText(T,f,!1,_),O=E.width,P=Math.ceil(E.height),S=Math.ceil((f.fontStyle==="italic"?2:1)*O);if(v>=u-P*a){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(P+E.fontProperties.descent,g),S*a+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*a,v=Math.ceil(v),p=0,g=0;continue}Ep(_,m,E,p,v,a,f);var D=ir(E.text);d.char.push({id:D,page:b.length-1,x:p/a,y:v/a,width:S,height:P,xoffset:0,yoffset:0,xadvance:Math.ceil(O-(f.dropShadow?f.dropShadowDistance:0)-(f.stroke?f.strokeThickness:0))}),p+=(S+2*o)*a,p=Math.ceil(p)}for(var x=0,L=l.length;x<L;x++)for(var k=l[x],Y=0;Y<L;Y++){var M=l[Y],I=m.measureText(k).width,H=m.measureText(M).width,A=m.measureText(k+M).width,N=A-(I+H);N&&d.kerning.push({first:ir(k),second:ir(M),amount:N})}var C=new r(d,b,!0);return r.available[e]!==void 0&&r.uninstall(e),r.available[e]=C,C},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}(),Sp=`// Pixi texture info\r
664
+ varying vec2 vTextureCoord;\r
665
+ uniform sampler2D uSampler;\r
666
+ \r
667
+ // Tint\r
668
+ uniform vec4 uColor;\r
669
+ \r
670
+ // on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
671
+ uniform float uFWidth;\r
672
+ \r
673
+ void main(void) {\r
674
+ \r
675
+ // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
676
+ vec4 texColor = texture2D(uSampler, vTextureCoord);\r
677
+ \r
678
+ // MSDF\r
679
+ float median = texColor.r + texColor.g + texColor.b -\r
680
+ min(texColor.r, min(texColor.g, texColor.b)) -\r
681
+ max(texColor.r, max(texColor.g, texColor.b));\r
682
+ // SDF\r
683
+ median = min(median, texColor.a);\r
684
+ \r
685
+ float screenPxDistance = uFWidth * (median - 0.5);\r
686
+ float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
687
+ if (median < 0.01) {\r
688
+ alpha = 0.0;\r
689
+ } else if (median > 0.99) {\r
690
+ alpha = 1.0;\r
691
+ }\r
692
+ \r
693
+ // NPM Textures, NPM outputs\r
694
+ gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r
695
+ \r
696
+ }\r
697
+ `,Pp=`// Mesh material default fragment\r
698
+ attribute vec2 aVertexPosition;\r
699
+ attribute vec2 aTextureCoord;\r
700
+ \r
701
+ uniform mat3 projectionMatrix;\r
702
+ uniform mat3 translationMatrix;\r
703
+ uniform mat3 uTextureMatrix;\r
704
+ \r
705
+ varying vec2 vTextureCoord;\r
706
+ \r
707
+ void main(void)\r
708
+ {\r
709
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
710
+ \r
711
+ vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
712
+ }\r
713
+ `,Do=[],Fo=[],No=[],wn=function(r){yp(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),o=s.align,a=s.tint,h=s.maxWidth,u=s.letterSpacing,l=s.fontName,f=s.fontSize;if(!Ut.available[l])throw new Error('Missing BitmapFont "'+l+'"');return n._activePagesMeshData=[],n._textWidth=0,n._textHeight=0,n._align=o,n._tint=a,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 Ce(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=Ut.available[this._fontName],n=this.fontSize,s=n/i.size,o=new j,a=[],h=[],u=[],l=this._text.replace(/(?:\r\n|\r)/g,`
714
+ `)||" ",f=Mo(l),c=this._maxWidth*i.size/n,d=i.distanceFieldType==="none"?Do:Fo,p=null,v=0,_=0,m=0,y=-1,g=0,b=0,x=0,T=0,E=0;E<f.length;E++){var O=f[E],P=ir(O);if(/(?:\s)/.test(O)&&(y=E,g=v,T++),O==="\r"||O===`
715
+ `){h.push(v),u.push(-1),_=Math.max(_,v),++m,++b,o.x=0,o.y+=i.lineHeight,p=null,T=0;continue}var S=i.chars[P];if(S){p&&S.kerning[p]&&(o.x+=S.kerning[p]);var D=No.pop()||{texture:X.EMPTY,line:0,charCode:0,prevSpaces:0,position:new j};D.texture=S.texture,D.line=m,D.charCode=P,D.position.x=o.x+S.xOffset+this._letterSpacing/2,D.position.y=o.y+S.yOffset,D.prevSpaces=T,a.push(D),v=D.position.x+Math.max(S.xAdvance-S.xOffset,S.texture.orig.width),o.x+=S.xAdvance+this._letterSpacing,x=Math.max(x,S.yOffset+S.texture.height),p=P,y!==-1&&c>0&&o.x>c&&(++b,De(a,1+y-b,1+E-y),E=y,y=-1,h.push(g),u.push(a.length>0?a[a.length-1].prevSpaces:0),_=Math.max(_,g),m++,o.x=0,o.y+=i.lineHeight,p=null,T=0)}}var L=f[f.length-1];L!=="\r"&&L!==`
716
+ `&&(/(?:\s)/.test(L)&&(v=g),h.push(v),_=Math.max(_,v),u.push(-1));for(var k=[],E=0;E<=m;E++){var Y=0;this._align==="right"?Y=_-h[E]:this._align==="center"?Y=(_-h[E])/2:this._align==="justify"&&(Y=u[E]<0?0:(_-h[E])/u[E]),k.push(Y)}var M=a.length,I={},H=[],A=this._activePagesMeshData;d.push.apply(d,A);for(var E=0;E<M;E++){var N=a[E].texture,C=N.baseTexture.uid;if(!I[C]){var w=d.pop();if(!w){var B=new tr,V=void 0,K=void 0;i.distanceFieldType==="none"?(V=new fi(X.EMPTY),K=G.NORMAL):(V=new fi(X.EMPTY,{program:ei.from(Pp,Sp),uniforms:{uFWidth:0}}),K=G.NORMAL_NPM);var dt=new li(B,V);dt.blendMode=K,w={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:dt,vertices:null,uvs:null,indices:null}}w.index=0,w.indexCount=0,w.vertexCount=0,w.uvsCount=0,w.total=0;var nt=this._textureCache;nt[C]=nt[C]||new X(N.baseTexture),w.mesh.texture=nt[C],w.mesh.tint=this._tint,H.push(w),I[C]=w}I[C].total++}for(var E=0;E<A.length;E++)H.indexOf(A[E])===-1&&this.removeChild(A[E].mesh);for(var E=0;E<H.length;E++)H[E].mesh.parent!==this&&this.addChild(H[E].mesh);this._activePagesMeshData=H;for(var E in I){var w=I[E],st=w.total;if(!(((t=w.indices)===null||t===void 0?void 0:t.length)>6*st)||w.vertices.length<li.BATCHABLE_SIZE*2)w.vertices=new Float32Array(4*2*st),w.uvs=new Float32Array(4*2*st),w.indices=new Uint16Array(6*st);else for(var xt=w.total,Tt=w.vertices,pt=xt*4*2;pt<Tt.length;pt++)Tt[pt]=0;w.mesh.size=6*st}for(var E=0;E<M;E++){var O=a[E],et=O.position.x+k[O.line]*(this._align==="justify"?O.prevSpaces:1);this._roundPixels&&(et=Math.round(et));var rt=et*s,ot=O.position.y*s,N=O.texture,$=I[N.baseTexture.uid],wt=N.frame,Pt=N._uvs,Q=$.index++;$.indices[Q*6+0]=0+Q*4,$.indices[Q*6+1]=1+Q*4,$.indices[Q*6+2]=2+Q*4,$.indices[Q*6+3]=0+Q*4,$.indices[Q*6+4]=2+Q*4,$.indices[Q*6+5]=3+Q*4,$.vertices[Q*8+0]=rt,$.vertices[Q*8+1]=ot,$.vertices[Q*8+2]=rt+wt.width*s,$.vertices[Q*8+3]=ot,$.vertices[Q*8+4]=rt+wt.width*s,$.vertices[Q*8+5]=ot+wt.height*s,$.vertices[Q*8+6]=rt,$.vertices[Q*8+7]=ot+wt.height*s,$.uvs[Q*8+0]=Pt.x0,$.uvs[Q*8+1]=Pt.y0,$.uvs[Q*8+2]=Pt.x1,$.uvs[Q*8+3]=Pt.y1,$.uvs[Q*8+4]=Pt.x2,$.uvs[Q*8+5]=Pt.y2,$.uvs[Q*8+6]=Pt.x3,$.uvs[Q*8+7]=Pt.y3}this._textWidth=_*s,this._textHeight=(o.y+i.lineHeight)*s;for(var E in I){var w=I[E];if(this.anchor.x!==0||this.anchor.y!==0)for(var Yt=0,ke=this._textWidth*this.anchor.x,ar=this._textHeight*this.anchor.y,qo=0;qo<w.total;qo++)w.vertices[Yt++]-=ke,w.vertices[Yt++]-=ar,w.vertices[Yt++]-=ke,w.vertices[Yt++]-=ar,w.vertices[Yt++]-=ke,w.vertices[Yt++]-=ar,w.vertices[Yt++]-=ke,w.vertices[Yt++]-=ar;this._maxLineHeight=x*s;var $o=w.mesh.geometry.getBuffer("aVertexPosition"),Zo=w.mesh.geometry.getBuffer("aTextureCoord"),Ko=w.mesh.geometry.getIndex();$o.data=w.vertices,Zo.data=w.uvs,Ko.data=w.indices,$o.update(),Zo.update(),Ko.update()}for(var E=0;E<a.length;E++)No.push(a[E]);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=Ut.available[this._fontName],n=i.distanceFieldRange,s=i.distanceFieldType,o=i.size;if(s!=="none")for(var a=this.worldTransform,h=a.a,u=a.b,l=a.c,f=a.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/o,_=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=Ut.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(!Ut.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:Ut.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=Ut.available[this._fontName],s=n.distanceFieldType==="none"?Do:Fo;s.push.apply(s,this._activePagesMeshData);for(var o=0,a=this._activePagesMeshData;o<a.length;o++){var h=a[o];this.removeChild(h.mesh)}this._activePagesMeshData=[],s.filter(function(f){return i[f.mesh.texture.baseTexture.uid]}).forEach(function(f){f.mesh.texture=X.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}(Et),Cp=function(){function r(){}return r.add=function(){ft.setExtensionXhrType("fnt",ft.XHR_RESPONSE_TYPE.TEXT)},r.use=function(e,t){var i=Oo(e.data);if(!i){t();return}for(var n=r.getBaseUrl(this,e),s=i.parse(e.data),o={},a=function(v){o[v.metadata.pageFile]=v.texture,Object.keys(o).length===s.page.length&&(e.bitmapFont=Ut.install(s,o,!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?a(d):d.onAfterMiddleware.add(a),f=!0;break}}if(!f){var p={crossOrigin:e.crossOrigin,loadType:ft.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:u},e.metadata.imageMetadata),parentResource:e};this.add(l,p,a)}}},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 Sn=function(r,e){return Sn=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])},Sn(r,e)};function Ap(r,e){Sn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Rp=`varying vec2 vTextureCoord;
717
+
718
+ uniform sampler2D uSampler;
719
+ uniform float uAlpha;
720
+
721
+ void main(void)
722
+ {
723
+ gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
724
+ }
725
+ `;(function(r){Ap(e,r);function e(t){t===void 0&&(t=1);var i=r.call(this,wc,Rp,{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})(ne);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 Bo(r,e){Pn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ip=`
726
+ attribute vec2 aVertexPosition;
727
+
728
+ uniform mat3 projectionMatrix;
729
+
730
+ uniform float strength;
731
+
732
+ varying vec2 vBlurTexCoords[%size%];
733
+
734
+ uniform vec4 inputSize;
735
+ uniform vec4 outputFrame;
736
+
737
+ vec4 filterVertexPosition( void )
738
+ {
739
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
740
+
741
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
742
+ }
743
+
744
+ vec2 filterTextureCoord( void )
745
+ {
746
+ return aVertexPosition * (outputFrame.zw * inputSize.zw);
747
+ }
748
+
749
+ void main(void)
750
+ {
751
+ gl_Position = filterVertexPosition();
752
+
753
+ vec2 textureCoord = filterTextureCoord();
754
+ %blur%
755
+ }`;function Op(r,e){var t=Math.ceil(r/2),i=Ip,n="",s;e?s="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":s="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var o=0;o<r;o++){var a=s.replace("%index%",o.toString());a=a.replace("%sampleIndex%",o-(t-1)+".0"),n+=a,n+=`
756
+ `}return i=i.replace("%blur%",n),i=i.replace("%size%",r.toString()),i}var Mp={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]},Dp=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
757
+ `);function Fp(r){for(var e=Mp[r],t=e.length,i=Dp,n="",s="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;",o,a=0;a<r;a++){var h=s.replace("%index%",a.toString());o=a,a>=t&&(o=r-a-1),h=h.replace("%value%",e[o].toString()),n+=h,n+=`
758
+ `}return i=i.replace("%blur%",n),i=i.replace("%size%",r.toString()),i}var Lo=function(r){Bo(e,r);function e(t,i,n,s,o){i===void 0&&(i=8),n===void 0&&(n=4),s===void 0&&(s=F.FILTER_RESOLUTION),o===void 0&&(o=5);var a=this,h=Op(o,t),u=Fp(o);return a=r.call(this,h,u)||this,a.horizontal=t,a.resolution=s,a._quality=0,a.quality=n,a.blur=i,a}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 o=t.getFilterTexture(),a=t.renderer,h=i,u=o;this.state.blend=!1,t.applyFilter(this,h,u,Mt.CLEAR);for(var l=1;l<this.passes-1;l++){t.bindAndClear(h,Mt.BLIT),this.uniforms.uSampler=u;var f=u;u=h,h=f,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,u,n,s),t.returnFilterTexture(o)}},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}(ne);(function(r){Bo(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 o=r.call(this)||this;return o.blurXFilter=new Lo(!0,t,i,n,s),o.blurYFilter=new Lo(!1,t,i,n,s),o.resolution=n,o.quality=i,o.blur=t,o.repeatEdgePixels=!1,o}return e.prototype.apply=function(t,i,n,s){var o=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(o&&a){var h=t.getFilterTexture();this.blurXFilter.apply(t,i,h,Mt.CLEAR),this.blurYFilter.apply(t,h,n,s),t.returnFilterTexture(h)}else a?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})(ne);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 Np(r,e){Cn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Bp=`varying vec2 vTextureCoord;
759
+ uniform sampler2D uSampler;
760
+ uniform float m[20];
761
+ uniform float uAlpha;
762
+
763
+ void main(void)
764
+ {
765
+ vec4 c = texture2D(uSampler, vTextureCoord);
766
+
767
+ if (uAlpha == 0.0) {
768
+ gl_FragColor = c;
769
+ return;
770
+ }
771
+
772
+ // Un-premultiply alpha before applying the color matrix. See issue #3539.
773
+ if (c.a > 0.0) {
774
+ c.rgb /= c.a;
775
+ }
776
+
777
+ vec4 result;
778
+
779
+ result.r = (m[0] * c.r);
780
+ result.r += (m[1] * c.g);
781
+ result.r += (m[2] * c.b);
782
+ result.r += (m[3] * c.a);
783
+ result.r += m[4];
784
+
785
+ result.g = (m[5] * c.r);
786
+ result.g += (m[6] * c.g);
787
+ result.g += (m[7] * c.b);
788
+ result.g += (m[8] * c.a);
789
+ result.g += m[9];
790
+
791
+ result.b = (m[10] * c.r);
792
+ result.b += (m[11] * c.g);
793
+ result.b += (m[12] * c.b);
794
+ result.b += (m[13] * c.a);
795
+ result.b += m[14];
796
+
797
+ result.a = (m[15] * c.r);
798
+ result.a += (m[16] * c.g);
799
+ result.a += (m[17] * c.b);
800
+ result.a += (m[18] * c.a);
801
+ result.a += m[19];
802
+
803
+ vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
804
+
805
+ // Premultiply alpha again.
806
+ rgb *= result.a;
807
+
808
+ gl_FragColor = vec4(rgb, result.a);
809
+ }
810
+ `,Uo=function(r){Np(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,Bp,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,o=t&255,a=[n/255,0,0,0,0,0,s/255,0,0,0,0,0,o/255,0,0,0,0,0,1,0];this._loadMatrix(a,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),o=Math.sqrt,a=1/3,h=o(a),u=n+(1-n)*a,l=a*(1-n)-h*s,f=a*(1-n)+h*s,c=a*(1-n)+h*s,d=n+a*(1-n),p=a*(1-n)-h*s,v=a*(1-n)-h*s,_=a*(1-n)+h*s,m=n+a*(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),o=[n,0,0,0,s,0,n,0,0,s,0,0,n,0,s,0,0,0,1,0];this._loadMatrix(o,i)},e.prototype.saturate=function(t,i){t===void 0&&(t=0);var n=t*2/3+1,s=(n-1)*-.5,o=[n,s,s,0,0,s,n,s,0,0,s,s,n,0,0,0,0,0,1,0];this._loadMatrix(o,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,o){t=t||.2,i=i||.15,n=n||16770432,s=s||3375104;var a=(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,a,h,u,t,0,l,f,c,i,0,a-l,h-f,u-c,0,0];this._loadMatrix(d,o)},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}(ne);Uo.prototype.grayscale=Uo.prototype.greyscale;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 Lp(r,e){An(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Up=`varying vec2 vFilterCoord;
811
+ varying vec2 vTextureCoord;
812
+
813
+ uniform vec2 scale;
814
+ uniform mat2 rotation;
815
+ uniform sampler2D uSampler;
816
+ uniform sampler2D mapSampler;
817
+
818
+ uniform highp vec4 inputSize;
819
+ uniform vec4 inputClamp;
820
+
821
+ void main(void)
822
+ {
823
+ vec4 map = texture2D(mapSampler, vFilterCoord);
824
+
825
+ map -= 0.5;
826
+ map.xy = scale * inputSize.zw * (rotation * map.xy);
827
+
828
+ gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
829
+ }
830
+ `,Gp=`attribute vec2 aVertexPosition;
831
+
832
+ uniform mat3 projectionMatrix;
833
+ uniform mat3 filterMatrix;
834
+
835
+ varying vec2 vTextureCoord;
836
+ varying vec2 vFilterCoord;
837
+
838
+ uniform vec4 inputSize;
839
+ uniform vec4 outputFrame;
840
+
841
+ vec4 filterVertexPosition( void )
842
+ {
843
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
844
+
845
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
846
+ }
847
+
848
+ vec2 filterTextureCoord( void )
849
+ {
850
+ return aVertexPosition * (outputFrame.zw * inputSize.zw);
851
+ }
852
+
853
+ void main(void)
854
+ {
855
+ gl_Position = filterVertexPosition();
856
+ vTextureCoord = filterTextureCoord();
857
+ vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
858
+ }
859
+ `;(function(r){Lp(e,r);function e(t,i){var n=this,s=new _t;return t.renderable=!1,n=r.call(this,Gp,Up,{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 j(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 o=this.maskSprite.worldTransform,a=Math.sqrt(o.a*o.a+o.b*o.b),h=Math.sqrt(o.c*o.c+o.d*o.d);a!==0&&h!==0&&(this.uniforms.rotation[0]=o.a/a,this.uniforms.rotation[1]=o.b/a,this.uniforms.rotation[2]=o.c/h,this.uniforms.rotation[3]=o.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})(ne);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 kp(r,e){Rn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Hp=`
860
+ attribute vec2 aVertexPosition;
861
+
862
+ uniform mat3 projectionMatrix;
863
+
864
+ varying vec2 v_rgbNW;
865
+ varying vec2 v_rgbNE;
866
+ varying vec2 v_rgbSW;
867
+ varying vec2 v_rgbSE;
868
+ varying vec2 v_rgbM;
869
+
870
+ varying vec2 vFragCoord;
871
+
872
+ uniform vec4 inputSize;
873
+ uniform vec4 outputFrame;
874
+
875
+ vec4 filterVertexPosition( void )
876
+ {
877
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
878
+
879
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
880
+ }
881
+
882
+ void texcoords(vec2 fragCoord, vec2 inverseVP,
883
+ out vec2 v_rgbNW, out vec2 v_rgbNE,
884
+ out vec2 v_rgbSW, out vec2 v_rgbSE,
885
+ out vec2 v_rgbM) {
886
+ v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
887
+ v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
888
+ v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
889
+ v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
890
+ v_rgbM = vec2(fragCoord * inverseVP);
891
+ }
892
+
893
+ void main(void) {
894
+
895
+ gl_Position = filterVertexPosition();
896
+
897
+ vFragCoord = aVertexPosition * outputFrame.zw;
898
+
899
+ texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
900
+ }
901
+ `,Xp=`varying vec2 v_rgbNW;
902
+ varying vec2 v_rgbNE;
903
+ varying vec2 v_rgbSW;
904
+ varying vec2 v_rgbSE;
905
+ varying vec2 v_rgbM;
906
+
907
+ varying vec2 vFragCoord;
908
+ uniform sampler2D uSampler;
909
+ uniform highp vec4 inputSize;
910
+
911
+
912
+ /**
913
+ Basic FXAA implementation based on the code on geeks3d.com with the
914
+ modification that the texture2DLod stuff was removed since it's
915
+ unsupported by WebGL.
916
+
917
+ --
918
+
919
+ From:
920
+ https://github.com/mitsuhiko/webgl-meincraft
921
+
922
+ Copyright (c) 2011 by Armin Ronacher.
923
+
924
+ Some rights reserved.
925
+
926
+ Redistribution and use in source and binary forms, with or without
927
+ modification, are permitted provided that the following conditions are
928
+ met:
929
+
930
+ * Redistributions of source code must retain the above copyright
931
+ notice, this list of conditions and the following disclaimer.
932
+
933
+ * Redistributions in binary form must reproduce the above
934
+ copyright notice, this list of conditions and the following
935
+ disclaimer in the documentation and/or other materials provided
936
+ with the distribution.
937
+
938
+ * The names of the contributors may not be used to endorse or
939
+ promote products derived from this software without specific
940
+ prior written permission.
941
+
942
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
943
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
944
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
945
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
946
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
947
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
948
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
949
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
950
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
951
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
952
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
953
+ */
954
+
955
+ #ifndef FXAA_REDUCE_MIN
956
+ #define FXAA_REDUCE_MIN (1.0/ 128.0)
957
+ #endif
958
+ #ifndef FXAA_REDUCE_MUL
959
+ #define FXAA_REDUCE_MUL (1.0 / 8.0)
960
+ #endif
961
+ #ifndef FXAA_SPAN_MAX
962
+ #define FXAA_SPAN_MAX 8.0
963
+ #endif
964
+
965
+ //optimized version for mobile, where dependent
966
+ //texture reads can be a bottleneck
967
+ vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
968
+ vec2 v_rgbNW, vec2 v_rgbNE,
969
+ vec2 v_rgbSW, vec2 v_rgbSE,
970
+ vec2 v_rgbM) {
971
+ vec4 color;
972
+ vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
973
+ vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
974
+ vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
975
+ vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
976
+ vec4 texColor = texture2D(tex, v_rgbM);
977
+ vec3 rgbM = texColor.xyz;
978
+ vec3 luma = vec3(0.299, 0.587, 0.114);
979
+ float lumaNW = dot(rgbNW, luma);
980
+ float lumaNE = dot(rgbNE, luma);
981
+ float lumaSW = dot(rgbSW, luma);
982
+ float lumaSE = dot(rgbSE, luma);
983
+ float lumaM = dot(rgbM, luma);
984
+ float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
985
+ float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
986
+
987
+ mediump vec2 dir;
988
+ dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
989
+ dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
990
+
991
+ float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
992
+ (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
993
+
994
+ float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
995
+ dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
996
+ max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
997
+ dir * rcpDirMin)) * inverseVP;
998
+
999
+ vec3 rgbA = 0.5 * (
1000
+ texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
1001
+ texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
1002
+ vec3 rgbB = rgbA * 0.5 + 0.25 * (
1003
+ texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
1004
+ texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
1005
+
1006
+ float lumaB = dot(rgbB, luma);
1007
+ if ((lumaB < lumaMin) || (lumaB > lumaMax))
1008
+ color = vec4(rgbA, texColor.a);
1009
+ else
1010
+ color = vec4(rgbB, texColor.a);
1011
+ return color;
1012
+ }
1013
+
1014
+ void main() {
1015
+
1016
+ vec4 color;
1017
+
1018
+ color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
1019
+
1020
+ gl_FragColor = color;
1021
+ }
1022
+ `;(function(r){kp(e,r);function e(){return r.call(this,Hp,Xp)||this}return e})(ne);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 Wp(r,e){In(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var jp=`precision highp float;
1023
+
1024
+ varying vec2 vTextureCoord;
1025
+ varying vec4 vColor;
1026
+
1027
+ uniform float uNoise;
1028
+ uniform float uSeed;
1029
+ uniform sampler2D uSampler;
1030
+
1031
+ float rand(vec2 co)
1032
+ {
1033
+ return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
1034
+ }
1035
+
1036
+ void main()
1037
+ {
1038
+ vec4 color = texture2D(uSampler, vTextureCoord);
1039
+ float randomValue = rand(gl_FragCoord.xy * uSeed);
1040
+ float diff = (randomValue - 0.5) * uNoise;
1041
+
1042
+ // Un-premultiply alpha before applying the color matrix. See issue #3539.
1043
+ if (color.a > 0.0) {
1044
+ color.rgb /= color.a;
1045
+ }
1046
+
1047
+ color.r += diff;
1048
+ color.g += diff;
1049
+ color.b += diff;
1050
+
1051
+ // Premultiply alpha again.
1052
+ color.rgb *= color.a;
1053
+
1054
+ gl_FragColor = color;
1055
+ }
1056
+ `;(function(r){Wp(e,r);function e(t,i){t===void 0&&(t=.5),i===void 0&&(i=Math.random());var n=r.call(this,qs,jp,{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})(ne);var Go=new _t;ct.prototype._cacheAsBitmap=!1,ct.prototype._cacheData=null,ct.prototype._cacheAsBitmapResolution=null,ct.prototype._cacheAsBitmapMultisample=lt.NONE;var zp=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(ct.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 zp),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)}}}}),ct.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))},ct.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 o=e.renderTexture.current,a=e.renderTexture.sourceFrame.clone(),h=e.renderTexture.destinationFrame.clone(),u=e.projection.transform,l=ge.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_"+_e();this._cacheData.textureCacheId=f,q.addToCache(l.baseTexture,f),X.addToCache(l,f);var c=this.transform.localTransform.copyTo(Go).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(o,a,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 ai(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)}},ct.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))},ct.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 o=ge.create({width:t.width,height:t.height}),a="cacheAsBitmap_"+_e();this._cacheData.textureCacheId=a,q.addToCache(o.baseTexture,a),X.addToCache(o,a);var h=Go;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:o,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 ai(o);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)}},ct.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},ct.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},ct.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,q.removeFromCache(this._cacheData.textureCacheId),X.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},ct.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)};ct.prototype.name=null,Et.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 o=s.getChildByName(e,!0);if(o)return o}}return null};ct.prototype.getGlobalPosition=function(e,t){return e===void 0&&(e=new j),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 Yp=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,o=s.clientWidth,a=s.clientHeight;i=o,n=a}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}(),ko=function(){function r(e){var t=this;this.stage=new Et,e=Object.assign({forceCanvas:!1},e),this.renderer=bc(e),r._plugins.forEach(function(i){i.init.call(t,e)})}return r.registerPlugin=function(e){Ft("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),Zt.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}();Zt.handleByList(tt.Application,ko._plugins),Zt.add(Yp);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 Ge(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=function(r){Ge(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 o=r.call(this)||this;return o.segWidth=n,o.segHeight=s,o.width=t,o.height=i,o.build(),o}return e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,i=[],n=[],s=[],o=this.segWidth-1,a=this.segHeight-1,h=this.width/o,u=this.height/a,l=0;l<t;l++){var f=l%this.segWidth,c=l/this.segWidth|0;i.push(f*h,c*u),n.push(f/o,c/a)}for(var d=o*a,l=0;l<d;l++){var p=l%o,v=l/o|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}(tr),qp=function(r){Ge(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 o=n.data,a=s.data;o[0]=0,o[1]=0,o[2]=0,o[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);o[d]=h,o[d+1]=0,o[d+2]=h,o[d+3]=1}for(var m=0,c=0;c<f-1;c++){var d=c*2;a[m++]=d,a[m++]=d+1,a[m++]=d+2,a[m++]=d+2,a[m++]=d+1,a[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,o=0,a=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,o=-(n.x-i.x),s=n.y-i.y;var c=Math.sqrt(s*s+o*o),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;s/=c,o/=c,s*=d,o*=d,a[f]=l.x+s,a[f+1]=l.y+o,a[f+2]=l.x-s,a[f+3]=l.y-o,i=l}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(tr);(function(r){Ge(e,r);function e(t,i,n){n===void 0&&(n=0);var s=this,o=new qp(t.height,i,n),a=new fi(t);return n>0&&(t.baseTexture.wrapMode=kt.REPEAT),s=r.call(this,o,a)||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})(li);var $p=function(r){Ge(e,r);function e(t,i,n){var s=this,o=new Vp(t.width,t.height,i,n),a=new fi(X.WHITE);return s=r.call(this,o,a)||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}(li);(function(r){Ge(e,r);function e(t,i,n,s,o){t===void 0&&(t=X.EMPTY);var a=this,h=new tr(i,n,s);h.getBuffer("aVertexPosition").static=!1;var u=new fi(t);return a=r.call(this,h,u,null,o)||this,a.autoUpdate=!0,a}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})(li);var rr=10;(function(r){Ge(e,r);function e(t,i,n,s,o){i===void 0&&(i=rr),n===void 0&&(n=rr),s===void 0&&(s=rr),o===void 0&&(o=rr);var a=r.call(this,X.WHITE,4,4)||this;return a._origWidth=t.orig.width,a._origHeight=t.orig.height,a._width=a._origWidth,a._height=a._origHeight,a._leftWidth=i,a._rightWidth=s,a._topHeight=n,a._bottomHeight=o,a.texture=t,a}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,o=Math.min(i,s);return o},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})($p);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 Zp(r,e){Mn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}(function(r){Zp(e,r);function e(t,i){i===void 0&&(i=!0);var n=r.call(this,t[0]instanceof X?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&&(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1))},e.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(yt.shared.add(this.update,this,Kt.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 o=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*o,this._currentTime+=o;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(X.from(t[n]));return new e(i)},e.fromImages=function(t){for(var i=[],n=0;n<t.length;++n)i.push(X.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 X)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?(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(yt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),e})(ai);Zt.add(Nc,Hc,kc,Dd,hp,Qs,vp,Cp,nd,Rd,Id,lp,Ql,$c);var Ho={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 o(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 a(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(" ")}a.prototype.load=function(v,_){var m=this,y=v||"BESbswy",g=0,b=_||3e3,x=new Date().getTime();return new Promise(function(T,E){if(d(m.context)&&!c(m.context)){var O=new Promise(function(S,D){function L(){new Date().getTime()-x>=b?D(Error(""+b+"ms timeout exceeded")):m.context.document.fonts.load(p(m,'"'+m.family+'"'),y).then(function(k){1<=k.length?S():setTimeout(L,25)},D)}L()}),P=new Promise(function(S,D){g=setTimeout(function(){D(Error(""+b+"ms timeout exceeded"))},b)});Promise.race([P,O]).then(function(){clearTimeout(g),T(m)},E)}else t(function(){function S(){var B;(B=M!=-1&&I!=-1||M!=-1&&H!=-1||I!=-1&&H!=-1)&&((B=M!=I&&M!=H&&I!=H)||(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==A&&I==A&&H==A||M==N&&I==N&&H==N||M==C&&I==C&&H==C)),B=!B),B&&(w.parentNode!==null&&w.parentNode.removeChild(w),clearTimeout(g),T(m))}function D(){if(new Date().getTime()-x>=b)w.parentNode!==null&&w.parentNode.removeChild(w),E(Error(""+b+"ms timeout exceeded"));else{var B=m.context.document.hidden;(B===!0||B===void 0)&&(M=L.g.offsetWidth,I=k.g.offsetWidth,H=Y.g.offsetWidth,S()),g=setTimeout(D,50)}}var L=new i(y),k=new i(y),Y=new i(y),M=-1,I=-1,H=-1,A=-1,N=-1,C=-1,w=document.createElement("div");w.dir="ltr",n(L,p(m,"sans-serif")),n(k,p(m,"serif")),n(Y,p(m,"monospace")),w.appendChild(L.g),w.appendChild(k.g),w.appendChild(Y.g),m.context.document.body.appendChild(w),A=L.g.offsetWidth,N=k.g.offsetWidth,C=Y.g.offsetWidth,D(),o(L,function(B){M=B,S()}),n(L,p(m,'"'+m.family+'",sans-serif')),o(k,function(B){I=B,S()}),n(k,p(m,'"'+m.family+'",serif')),o(Y,function(B){H=B,S()}),n(Y,p(m,'"'+m.family+'",monospace'))})})},r.exports=a})()})(Ho);const Kp=Ho.exports,Qp=["0123456789","abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ",`.,:;!?()[]{}<>|/\\@'"`].join("");function Jp(r){return new Promise(e=>{new Kp("InterVariable").load().then(()=>{const i={resolution:r,chars:Qp};Ut.from("NodeTextDefault",{fontFamily:"InterVariable",fontSize:24,lineHeight:32,fill:1120295},i),Ut.from("NodeTextInverse",{fontFamily:"InterVariable",fontSize:24,lineHeight:32,fill:16777215},i),Ut.from("TimeMarkerLabel",{fontFamily:"InterVariable",fontSize:16,lineHeight:24,fill:9741240},i),e({nodeTextDefault:{fontName:"NodeTextDefault",fontSize:24},nodeTextInverse:{fontName:"NodeTextInverse",fontSize:24},timeMarkerLabel:{fontName:"TimeMarkerLabel",fontSize:12}})})})}function tv(r){const e=new ko({backgroundAlpha:0,width:r.clientWidth,height:r.clientWidth,resolution:devicePixelRatio,autoDensity:!0,antialias:!0});return r.appendChild(e.view),e}class At{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 ev=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function iv(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 Xo=iv(function(r,e){(function(){var t,i;i=function(n){return r.exports=n},t={linear:function(n,s,o,a){return o*n/a+s},easeInQuad:function(n,s,o,a){return o*(n/=a)*n+s},easeOutQuad:function(n,s,o,a){return-o*(n/=a)*(n-2)+s},easeInOutQuad:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n+s:-o/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,o,a){return o*(n/=a)*n*n+s},easeOutCubic:function(n,s,o,a){return o*((n=n/a-1)*n*n+1)+s},easeInOutCubic:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n+s:o/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,o,a){return o*(n/=a)*n*n*n+s},easeOutQuart:function(n,s,o,a){return-o*((n=n/a-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n+s:-o/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,o,a){return o*(n/=a)*n*n*n*n+s},easeOutQuint:function(n,s,o,a){return o*((n=n/a-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n*n+s:o/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,o,a){return-o*Math.cos(n/a*(Math.PI/2))+o+s},easeOutSine:function(n,s,o,a){return o*Math.sin(n/a*(Math.PI/2))+s},easeInOutSine:function(n,s,o,a){return-o/2*(Math.cos(Math.PI*n/a)-1)+s},easeInExpo:function(n,s,o,a){return n===0?s:o*Math.pow(2,10*(n/a-1))+s},easeOutExpo:function(n,s,o,a){return n===a?s+o:o*(-Math.pow(2,-10*n/a)+1)+s},easeInOutExpo:function(n,s,o,a){return(n/=a/2)<1?o/2*Math.pow(2,10*(n-1))+s:o/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,o,a){return-o*(Math.sqrt(1-(n/=a)*n)-1)+s},easeOutCirc:function(n,s,o,a){return o*Math.sqrt(1-(n=n/a-1)*n)+s},easeInOutCirc:function(n,s,o,a){return(n/=a/2)<1?-o/2*(Math.sqrt(1-n*n)-1)+s:o/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a),u||(u=a*.3),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u))+s},easeOutElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a),u||(u=a*.3),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*n)*Math.sin((n*a-l)*(2*Math.PI)/u)+o+s},easeInOutElastic:function(n,s,o,a){var h,u,l;return l=1.70158,u=0,h=o,n===0||(n/=a/2),u||(u=a*(.3*1.5)),h<Math.abs(o)?(h=o,l=u/4):l=u/(2*Math.PI)*Math.asin(o/h),n<1?-.5*(h*Math.pow(2,10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u))+s:h*Math.pow(2,-10*(n-=1))*Math.sin((n*a-l)*(2*Math.PI)/u)*.5+o+s},easeInBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),o*(n/=a)*n*((h+1)*n-h)+s},easeOutBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),o*((n=n/a-1)*n*((h+1)*n+h)+1)+s},easeInOutBack:function(n,s,o,a,h){return h===void 0&&(h=1.70158),(n/=a/2)<1?o/2*(n*n*(((h*=1.525)+1)*n-h))+s:o/2*((n-=2)*n*(((h*=1.525)+1)*n+h)+2)+s},easeInBounce:function(n,s,o,a){var h;return h=t.easeOutBounce(a-n,0,o,a),o-h+s},easeOutBounce:function(n,s,o,a){return(n/=a)<1/2.75?o*(7.5625*n*n)+s:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+s:o*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,o,a){var h;return n<a/2?(h=t.easeInBounce(n*2,0,o,a),h*.5+s):(h=t.easeOutBounce(n*2-a,0,o,a),h*.5+o*.5+s)}},i(t)}).call(ev)});function nr(r,e){if(r){if(typeof r=="function")return r;if(typeof r=="string")return Xo[r]}else return Xo[e]}const nv={removeOnInterrupt:!1,ease:"linear",time:1e3};class ee extends At{__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),ee.prototype.__init.call(this),ee.prototype.__init2.call(this),ee.prototype.__init3.call(this),ee.prototype.__init4.call(this),ee.prototype.__init5.call(this),ee.prototype.__init6.call(this),ee.prototype.__init7.call(this),this.options=Object.assign({},nv,t),this.options.ease=nr(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 j(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,o=this.deltaX,a=this.deltaY,h=new j(this.parent.x,this.parent.y);this.parent.moveCenter(n+o*i,s+a*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 sr(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((...o)=>t.call(e,...o)),e=void 0)}return t}const sv={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class ov extends At{constructor(e,t={}){super(e),this.options=Object.assign({},sv,t),this.ease=nr(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 j(t*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new j(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 j(0,0),bottomRight:new j(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===sr([t,"access",s=>s.options,"optionalAccess",s=>s.friction])||t.y&&t.percentChangeY===sr([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||{},!sr([i,"optionalAccess",s=>s.active])&&!sr([n,"optionalAccess",s=>s.active])&&(!this.toX||!this.toY)&&(!t.x||!t.y)){e=e||this.oob();const s=e.topLeft,o=e.bottomRight;if(!this.toX&&!t.x){let a=null;e.left&&this.left?a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-s.x:e.right&&this.right&&(a=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-o.x),a!==null&&this.parent.x!==a&&(this.toX={time:0,start:this.parent.x,delta:a-this.parent.x,end:a},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!t.y){let a=null;e.top&&this.top?a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-s.y:e.bottom&&this.bottom&&(a=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-o.y),a!==null&&this.parent.y!==a&&(this.toY={time:0,start:this.parent.y,delta:a-this.parent.y,end:a},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const av={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class hv extends At{constructor(e,t={}){super(e),this.options=Object.assign({},av,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 uv={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class lv extends At{constructor(e,t={}){super(e),this.options=Object.assign({},uv,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 fv={friction:.98,bounce:.8,minSpeed:.01},ae=16;class cv extends At{constructor(e,t={}){super(e),this.options=Object.assign({},fv,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,o=Math.log(s);this.parent.x+=this.x*ae/o*(Math.pow(s,n/ae)-Math.pow(s,i/ae)),this.x*=Math.pow(this.percentChangeX,e/ae)}if(this.y){const s=this.percentChangeY,o=Math.log(s);this.parent.y+=this.y*ae/o*(Math.pow(s,n/ae)-Math.pow(s,i/ae)),this.y*=Math.pow(this.percentChangeY,e/ae)}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 dv={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 Dn extends At{__init(){this.windowEventHandlers=new Array}constructor(e,t={}){super(e),Dn.prototype.__init.call(this),this.options=Object.assign({},dv,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,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(s)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:t,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:e,screen:new j(this.last.x,this.last.y),world:this.parent.toWorld(new j(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 j(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,o]=this.options.wheelSwapAxes?n.reverse():n;return this.xDirection&&(this.parent.x+=s*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*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 pv={speed:0,acceleration:null,radius:null};class vv extends At{constructor(e,t,i={}){super(e),this.target=t,this.options=Object.assign({},pv,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,o=n-t.y;if(s||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(n-t.y,i-t.x),h=Math.sqrt(Math.pow(s,2)+Math.pow(o,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(a)*this.velocity.x,f=Math.sin(a)*this.velocity.y,c=Math.abs(l)>Math.abs(s)?i:t.x+l,d=Math.abs(f)>Math.abs(o)?n:t.y+f;this.parent.moveCenter(c,d),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(n-t.y,i-t.x),h=Math.cos(a)*this.options.speed,u=Math.sin(a)*this.options.speed,l=Math.abs(h)>Math.abs(s)?i:t.x+h,f=Math.abs(u)>Math.abs(o)?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 _v={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class mv extends At{constructor(e,t={}){super(e),this.options=Object.assign({},_v,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 o=Math.atan2(n.y-i,n.x-t);this.options.linear?(this.horizontal=Math.round(Math.cos(o))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(o))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(o)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(o)*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 ci extends At{__init(){this.active=!1}__init2(){this.pinching=!1}__init3(){this.moved=!1}constructor(e,t={}){super(e),ci.prototype.__init.call(this),ci.prototype.__init2.call(this),ci.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],o=n[1],a=s.last&&o.last?Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2)):null;if(s.id===e.data.pointerId?s.last={x:t,y:i,data:e.data}:o.id===e.data.pointerId&&(o.last={x:t,y:i,data:e.data}),a){let h;const u={x:s.last.x+(o.last.x-s.last.x)/2,y:s.last.y+(o.last.y-s.last.y)/2};this.options.center||(h=this.parent.toLocal(u));let l=Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2));l=l===0?l=1e-10:l;const f=(1-a/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 yv={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class xv extends At{constructor(e,t,i,n={}){super(e),this.options=Object.assign({},yv,n),this.ease=nr(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 o=this.startX,a=this.startY,h=this.deltaX,u=this.deltaY;if(t.time>this.options.time)i=!0,n=o+h,s=a+u;else{const l=this.ease(t.time,0,1,this.options.time);n=o+h*l,s=a+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 bv={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class Tv extends At{constructor(e,t={}){super(e),this.options=Object.assign({},bv,t),this.ease=nr(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,o=this.ease(s.time,s.startX,s.deltaX,this.options.time),a=this.ease(s.time,s.startY,s.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}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 Ev={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class wv extends At{constructor(e,t={}){super(e),this.options=Object.assign({},Ev,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 o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(s);this.parent.x+=t.x-a.x,this.parent.y+=t.y-a.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 o={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+o.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+o.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=t}else{let o;this.options.center||(o=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 a=this.parent.plugins.get("clamp-zoom",!0);if(a&&a.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const h=this.parent.toGlobal(o);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 Sv{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 j;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 or(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((...o)=>t.call(e,...o)),e=void 0)}return t}const di=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class Pv{constructor(e){this.viewport=e,this.list=[],this.plugins={}}add(e,t,i=di.length){const n=this.plugins[e];n&&n.destroy(),this.plugins[e]=t;const s=di.indexOf(e);s!==-1&&di.splice(s,1),di.splice(i,0,e),this.sort()}get(e,t){return t&&or([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]&&(or([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){or([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.pause,"call",t=>t()])}resume(e){or([this,"access",t=>t.plugins,"access",t=>t[e],"optionalAccess",t=>t.resume,"call",t=>t()])}sort(){this.list=[];for(const e of di)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 Cv={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:yt.shared};class Fn extends Et{__init(){this._disableOnContextMenu=e=>e.preventDefault()}constructor(e={}){super(),Fn.prototype.__init.call(this),this.options=Object.assign({},{divWheel:document.body},Cv,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 Sv(this),this.plugins=new Pv(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 j(e,t)):this.toLocal(e)}toScreen(e,t){return arguments.length===2?this.toGlobal(new j(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 j(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 j(-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 o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.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 o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.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 Tv(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 j(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 Dn(this,e)),this}clamp(e){return this.plugins.add("clamp",new hv(this,e)),this}decelerate(e){return this.plugins.add("decelerate",new cv(this,e)),this}bounce(e){return this.plugins.add("bounce",new ov(this,e)),this}pinch(e){return this.plugins.add("pinch",new ci(this,e)),this}snap(e,t,i){return this.plugins.add("snap",new xv(this,e,t,i)),this}follow(e,t){return this.plugins.add("follow",new vv(this,e,t)),this}wheel(e){return this.plugins.add("wheel",new wv(this,e)),this}animate(e){return this.plugins.add("animate",new ee(this,e)),this}clampZoom(e){return this.plugins.add("clamp-zoom",new lv(this,e)),this}mouseEdges(e){return this.plugins.add("mouse-edges",new mv(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 o=!1;e<this.left?(this.left=e,o=!0):e+i>this.right&&(this.right=e+i,o=!0),t<this.top?(this.top=t,o=!0):t+n>this.bottom&&(this.bottom=t+n,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Av(r,e){const t=r.clientWidth,i=r.clientHeight,n=new Fn({screenWidth:t,screenHeight:i,passiveWheel:!1,interaction:e.renderer.plugins.interaction,divWheel:r});return n.drag({wheel:!1,pressDrag:!0}).wheel({trackpadPinch:!0,wheelZoom:!1}).clampZoom({minWidth:t/2,maxWidth:t*20}).decelerate({friction:.9}),e.stage.addChild(n),n}let zt={};const Rv=80,Iv=260;let Wo=10,Pe=1e3*30;const Nn=4e3,Z={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},jo=[{ceiling:Z.second*4,span:Z.second},{ceiling:Z.second*8,span:Z.second*5},{ceiling:Z.second*13,span:Z.second*10},{ceiling:Z.second*20,span:Z.second*15},{ceiling:Z.second*45,span:Z.second*30},{ceiling:Z.minute*4,span:Z.minute},{ceiling:Z.minute*8,span:Z.minute*5},{ceiling:Z.minute*13,span:Z.minute*10},{ceiling:Z.minute*28,span:Z.minute*15},{ceiling:Z.hour*1.24,span:Z.minute*30},{ceiling:Z.hour*3,span:Z.hour},{ceiling:Z.hour*8,span:Z.hour*5},{ceiling:Z.hour*13,span:Z.hour*10},{ceiling:Z.hour*22,span:Z.hour*12},{ceiling:Z.day*4,span:Z.day},{ceiling:Z.week*2,span:Z.week},{ceiling:1/0,span:Z.week*4}];function Ov(r){if(!r.stage){console.error("TimelineGuides: stage is undefined");return}const{stage:e,app:t,viewport:i,isRunning:n}=r;Vo(r),Wo=Math.ceil(e.clientWidth/(Iv-Rv/2)),n?t.ticker.add(()=>{zo(r)}):i.on("moved",()=>{zo(r)})}function zo(r){const{isRunning:e,xScale:t}=r,i=Pe;Vo(r);const n=Object.keys(zt)[Object.keys(zt).length-1];i!==Pe||e&&zt[n].x+Pe<t(new Date)+Nn?(Object.keys(zt).length>0&&(Object.keys(zt).forEach(s=>{zt[s].destroy()}),zt={}),Mv(r)):Fv(r)}function Mv(r){const{timelineGuidesContainer:e,dateScale:t,overallGraphWidth:i}=r;let n;const s=t(i+Nn);for(n=new Date(Math.ceil(t(-Nn)/Pe)*Pe);n.getTime()<s;){const a=Dv(n,r);zt[n.getTime()]=a,e.addChild(a),n=new Date(n.getTime()+Pe)}}function Dv(r,e){const{app:t,textStyles:i}=e,n=new Et;n.position.set(Yo(r,e),0);const s=new Se;s.beginFill(13227490),s.drawRect(0,0,1,t.renderer.height),s.endFill();const o=new wn(r.toLocaleTimeString(),i.timeMarkerLabel);return o.position.set(4,4),n.addChild(s),n.addChild(o),n}function Fv(r){Object.keys(zt).forEach(e=>{zt[e].position.set(Yo(new Date(Number(e)),r),0)})}function Yo(r,e){const{viewport:t,xScale:i}=e;return i(r)*t.scale._x+t.worldTransform.tx}function Vo(r){var o;const{viewport:e,dateScale:t,minimumStartDate:i}=r,n=Math.ceil((e.right-e.left)/Wo),s=t(n)-i.getTime();Pe=((o=jo.find(a=>a.ceiling>s))==null?void 0:o.span)??jo[0].span}function Nv(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 Bv=St.defineComponent({__name:"FlowRunTimeline",props:{graphData:null,isRunning:{type:Boolean}},setup(r){const e=r,t=St.ref(),i=window.devicePixelRatio||2,n={defaultViewportPadding:40,playheadBg:5145342,playheadWidth:2,playheadGlowPadding:8};let s=St.ref(!0),o,a,h,u=new na,l=!1,f,c=St.ref(),d;const p=new Et;let v,_={};St.onMounted(()=>{if(!t.value){console.error("Stage reference not found in initPixiApp");return}m(),o=tv(t.value),b(),a=Av(t.value,o),Jp(i).then(A=>{h=A,Ov({app:o,viewport:a,stage:t.value,timelineGuidesContainer:p,minimumStartDate:f,overallGraphWidth:d,isRunning:e.isRunning,dateScale:H,xScale:I,textStyles:h}),T(),g(),x(),s.value=!1})}),St.onBeforeUnmount(()=>{o.destroy(!0)});function m(){var w;const A=Array.from(e.graphData).filter(B=>B.end).flatMap(({start:B,end:V})=>({start:B,end:V}));e.isRunning===!0&&A.push({start:new Date,end:new Date});const{min:N,max:C}=Nv(A);f=N,c.value=C,d=(w=t.value)!=null&&w.clientWidth?t.value.clientWidth*2:2e3}const y=St.computed(()=>{if(!c.value)return 0;const A=1e3*60,N=c.value.getTime()-f.getTime();return N<A?A:N});function g(){if(!e.isRunning)return;const A=new Se;A.beginFill(n.playheadBg,.1),A.drawRect(0,0,n.playheadWidth+n.playheadGlowPadding*2,v.height),A.endFill(),A.beginFill(n.playheadBg),A.drawRect(n.playheadGlowPadding,0,n.playheadWidth,v.height),A.endFill(),o.stage.addChild(A),o.ticker.add(()=>{e.isRunning?(A.x=I(new Date)*a.scale._x+a.worldTransform.tx-n.playheadGlowPadding-n.playheadWidth/2,c.value=new Date):A.destroyed||A.destroy()})}function b(){o.stage.addChild(p)}function x(){u.addAll(a.children),a.on("frame-end",()=>{(a.dirty||l)&&(u.cull(o.renderer.screen),a.dirty=!1,l=!1)})}function T(){v=E(),a.ensureVisible(v.x-n.defaultViewportPadding,v.y-n.defaultViewportPadding,v.width+n.defaultViewportPadding*2,v.height+n.defaultViewportPadding*2,!0),a.moveCenter(v.x+v.width/2,v.y+v.height/2)}function E(){const A=new Et;return e.graphData.forEach((N,C)=>{const{nodeContainer:w}=D(N,C);A.addChild(w)}),a.addChild(A),A}St.watchEffect(()=>{s.value||e.graphData.forEach(A=>{if(A.id in _)(_[A.id].end!==A.end||_[A.id].state!==A.state)&&M(A);else{const{nodeContainer:N}=D(A,Object.keys(_).length-1);v.addChild(N),O(),l=!0}})});function O(){const A=e.graphData.map(N=>N.id);Object.keys(_).forEach(N=>{A.includes(N)||(_[N].node.destroy(),delete _[N])})}const P={completed:42557,running:43247,scheduled:6321549,pending:6321549,failed:15728657,cancelled:15728657,crashed:15728657,paused:16035840},S={padding:16,gap:4};function D(A,N){const C=new Et,w=k(A),B=new Se;return Y({box:B,state:A.state,start:A.start,end:A.end??new Date,height:w.height}),C.addChild(B),C.addChild(w),C.position.set(I(A.start),N*120),_[A.id]={node:C,end:A.end,state:A.state},e.isRunning&&o.ticker.add(()=>{e.isRunning&&M(A)}),{nodeContainer:C}}function L(A,N){return A&&N?I(N)-I(A):4}function k(A){const N=L(A.start,A.end);let C=!0,w=new wn(A.label,h.nodeTextInverse);return w.width>=N&&(C=!1,w.destroy(),w=new wn(A.label,h.nodeTextDefault)),w.position.set(C?S.padding:N+S.gap,S.padding),w}function Y({box:A,state:N,start:C,end:w,height:B}){const V=N?P[N]:10134448;A.beginFill(V),A.drawRoundedRect(0,0,L(C,w),B+S.padding*2,12),A.endFill()}function M(A){const N=_[A.id],C=N.node.children[0];let w=N.node.children[1];C.clear(),Y({box:C,state:A.state,start:A.start,end:A.end??new Date,height:w.height}),N.node.position.x=I(A.start),N.end=A.end,N.state=A.state}function I(A){return Math.ceil((A.getTime()-f.getTime())*(d/y.value))}function H(A){return Math.ceil(f.getTime()+A*(y.value/d))}return(A,N)=>(St.openBlock(),St.createElementBlock("div",{ref_key:"stage",ref:t,class:"prefect-dag"},null,512))}}),Lv="";he.FlowRunTimeline=Bv,Object.defineProperty(he,Symbol.toStringTag,{value:"Module"})});
1057
+ //# sourceMappingURL=graphs.umd.js.map