pages/ludwig/assets/@pixi.1eac1889.js

552 lines
226 KiB
JavaScript

import{i as Ti}from"./ismobilejs.5c6954b9.js";import{E as Wt}from"./eventemitter3.dc5195d7.js";import"./earcut.b6f90e68.js";import{p as bi,f as Ii,r as Ri}from"./url.e51cb87b.js";/*!
* @pixi/settings - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/settings is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var ut=Ti(globalThis.navigator);function Ei(r){var t=!0;if(ut.tablet||ut.phone){if(ut.apple.device){var e=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(e){var i=parseInt(e[1],10);i<11&&(t=!1)}}if(ut.android.device){var e=navigator.userAgent.match(/Android\s([0-9.]*)/);if(e){var i=parseInt(e[1],10);i<7&&(t=!1)}}}return t?r:4}function wi(){return!ut.apple.device}/*!
* @pixi/constants - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/constants is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var nr;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(nr||(nr={}));var sr;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(sr||(sr={}));var ar;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(ar||(ar={}));var or;(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"})(or||(or={}));var hr;(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"})(hr||(hr={}));var ur;(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"})(ur||(ur={}));var lr;(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"})(lr||(lr={}));var fr;(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"})(fr||(fr={}));var cr;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(cr||(cr={}));var le;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(le||(le={}));var fe;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(fe||(fe={}));var ce;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(ce||(ce={}));var dr;(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"})(dr||(dr={}));var pr;(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"})(pr||(pr={}));var de;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(de||(de={}));var xt;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(xt||(xt={}));var vr;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE"})(vr||(vr={}));var pe;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(pe||(pe={}));var mr;(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"})(mr||(mr={}));var x={MIPMAP_TEXTURES:ce.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:pe.NONE,SPRITE_MAX_TEXTURES:Ei(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:de.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:fe.CLAMP,SCALE_MODE:le.LINEAR,PRECISION_VERTEX:xt.HIGH,PRECISION_FRAGMENT:ut.apple.device?xt.HIGH:xt.MEDIUM,CAN_UPLOAD_SAME_BUFFER:wi(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};/*!
* @pixi/constants - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/constants is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var J;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(J||(J={}));var Tt;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Tt||(Tt={}));var Ht;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(Ht||(Ht={}));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 bt;(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"})(bt||(bt={}));var _;(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"})(_||(_={}));var lt;(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"})(lt||(lt={}));var I;(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"})(I||(I={}));var Vt;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(Vt||(Vt={}));var Y;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Y||(Y={}));var ve;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(ve||(ve={}));var ft;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(ft||(ft={}));var tt;(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"})(tt||(tt={}));var Q;(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"})(Q||(Q={}));var me;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(me||(me={}));var D;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(D||(D={}));var O;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE"})(O||(O={}));var F;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(F||(F={}));var W;(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"})(W||(W={}));/*!
* @pixi/utils - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/utils is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var Ni={parse:bi,format:Ii,resolve:Ri};x.RETINA_PREFIX=/@([0-9\.]+)x/;x.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var _r=!1,yr="6.3.2";function Ci(r){var t;if(!_r){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var e=[`
%c %c %c PixiJS `+yr+" - \u2730 "+r+` \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665
`,"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;"];(t=globalThis.console).log.apply(t,e)}else globalThis.console&&globalThis.console.log("PixiJS "+yr+" - "+r+" - http://www.pixijs.com/");_r=!0}}var Yt;function Ai(){return typeof Yt=="undefined"&&(Yt=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:x.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!globalThis.WebGLRenderingContext)return!1;var e=document.createElement("canvas"),i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),n=!!(i&&i.getContextAttributes().stencil);if(i){var s=i.getExtension("WEBGL_lose_context");s&&s.loseContext()}return i=null,n}catch{return!1}}()),Yt}function Pi(r,t){return t===void 0&&(t=[]),t[0]=(r>>16&255)/255,t[1]=(r>>8&255)/255,t[2]=(r&255)/255,t}function Ui(r){var t=r.toString(16);return t="000000".substring(0,6-t.length)+t,"#"+t}function Fi(){for(var r=[],t=[],e=0;e<32;e++)r[e]=e,t[e]=e;r[g.NORMAL_NPM]=g.NORMAL,r[g.ADD_NPM]=g.ADD,r[g.SCREEN_NPM]=g.SCREEN,t[g.NORMAL]=g.NORMAL_NPM,t[g.ADD]=g.ADD_NPM,t[g.SCREEN]=g.SCREEN_NPM;var i=[];return i.push(t),i.push(r),i}var Li=Fi();function Oi(r,t){if(t===1)return(t*255<<24)+r;if(t===0)return 0;var e=r>>16&255,i=r>>8&255,n=r&255;return e=e*t+.5|0,i=i*t+.5|0,n=n*t+.5|0,(t*255<<24)+(e<<16)+(i<<8)+n}function ti(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 jt(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 gr(r){return!(r&r-1)&&!!r}function xr(r){var t=(r>65535?1:0)<<4;r>>>=t;var e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Xt(r,t,e){var i=r.length,n;if(!(t>=i||e===0)){e=t+e>i?i-t:e;var s=i-e;for(n=t;n<s;++n)r[n]=r[n+e];r.length=s}}function At(r){return r===0?0:r<0?-1:1}var Si=0;function It(){return++Si}var Tr={};function Rt(r,t,e){if(e===void 0&&(e=3),!Tr[t]){var i=new Error().stack;typeof i=="undefined"?console.warn("PixiJS Deprecation Warning: ",t+`
Deprecated since v`+r):(i=i.split(`
`).splice(e).join(`
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",t+`
Deprecated since v`+r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",t+`
Deprecated since v`+r),console.warn(i))),Tr[t]=!0}}var br={},$=Object.create(null),rt=Object.create(null);(function(){function r(t,e,i){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.resolution=i||x.RESOLUTION,this.resize(t,e)}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(t,e){this.canvas.width=Math.round(t*this.resolution),this.canvas.height=Math.round(e*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(t){this.canvas.width=Math.round(t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=Math.round(t)},enumerable:!1,configurable:!0}),r})();var Pt;function Gi(r,t){if(t===void 0&&(t=globalThis.location),r.indexOf("data:")===0)return"";t=t||globalThis.location,Pt||(Pt=document.createElement("a")),Pt.href=r;var e=Ni.parse(Pt.href),i=!e.port&&t.port===""||e.port===t.port;return e.hostname!==t.hostname||!i||e.protocol!==t.protocol?"anonymous":""}function Ir(r,t){var e=x.RETINA_PREFIX.exec(r);return e?parseFloat(e[1]):t!==void 0?t:1}/*!
* @pixi/runner - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/runner is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var S=function(){function r(t){this.items=[],this._name=t,this._aliasCount=0}return r.prototype.emit=function(t,e,i,n,s,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");var u=this,l=u.name,f=u.items;this._aliasCount++;for(var c=0,d=f.length;c<d;c++)f[c][l](t,e,i,n,s,a,o,h);return f===this.items&&this._aliasCount--,this},r.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},r.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},r.prototype.remove=function(t){var e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},r.prototype.contains=function(t){return this.items.indexOf(t)!==-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(S.prototype,{dispatch:{value:S.prototype.emit},run:{value:S.prototype.emit}});/*!
* @pixi/ticker - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/ticker is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/x.TARGET_FPMS=.06;var Et;(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"})(Et||(Et={}));var Kt=function(){function r(t,e,i,n){e===void 0&&(e=null),i===void 0&&(i=0),n===void 0&&(n=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=n}return r.prototype.match=function(t,e){return e===void 0&&(e=null),this.fn===t&&this.context===e},r.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},r.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},r.prototype.destroy=function(t){t===void 0&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},r}(),q=function(){function r(){var t=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 Kt(null,null,1/0),this.deltaMS=1/x.TARGET_FPMS,this.elapsedMS=1/x.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&t._requestId===null&&t._head.next&&(t._requestId=requestAnimationFrame(t._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(t,e,i){return i===void 0&&(i=Et.NORMAL),this._addListener(new Kt(t,e,i))},r.prototype.addOnce=function(t,e,i){return i===void 0&&(i=Et.NORMAL),this._addListener(new Kt(t,e,i,!0))},r.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this},r.prototype.remove=function(t,e){for(var i=this._head.next;i;)i.match(t,e)?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 t=0,e=this._head;e=e.next;)t++;return t},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 t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(t){t===void 0&&(t=performance.now());var e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var i=t-this._lastFrame|0;if(i<this._minElapsedMS)return;this._lastFrame=t-i%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*x.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=t},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(t){var e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,x.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(t){if(t===0)this._minElapsedMS=0;else{var e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(r,"shared",{get:function(){if(!r._shared){var t=r._shared=new r;t.autoStart=!0,t._protected=!0}return r._shared},enumerable:!1,configurable:!0}),Object.defineProperty(r,"system",{get:function(){if(!r._system){var t=r._system=new r;t.autoStart=!0,t._protected=!0}return r._system},enumerable:!1,configurable:!0}),r}(),Vs=function(){function r(){}return r.init=function(t){var e=this;t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set:function(i){this._ticker&&this._ticker.remove(this.render,this),this._ticker=i,i&&i.add(this.render,this,Et.LOW)},get:function(){return this._ticker}}),this.stop=function(){e._ticker.stop()},this.start=function(){e._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?q.shared:new q,t.autoStart&&this.start()},r.destroy=function(){if(this._ticker){var t=this._ticker;this.ticker=null,t.destroy()}},r}();/*!
* @pixi/math - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/math is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var Bi=Math.PI*2,Mi=180/Math.PI,ki=Math.PI/180,_e;(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"})(_e||(_e={}));var P=function(){function r(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},r.prototype.copyTo=function(t){return t.set(this.x,this.y),t},r.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},r.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x=t,this.y=e,this},r.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},r}(),Ut=[new P,new P,new P,new P],U=function(){function r(t,e,i,n){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(n),this.type=_e.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(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},r.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},r.prototype.contains=function(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height},r.prototype.intersects=function(t,e){if(!e){var i=this.x<t.x?t.x:this.x,n=this.right>t.right?t.right:this.right;if(n<=i)return!1;var s=this.y<t.y?t.y:this.y,a=this.bottom>t.bottom?t.bottom:this.bottom;return a>s}var o=this.left,h=this.right,u=this.top,l=this.bottom;if(h<=o||l<=u)return!1;var f=Ut[0].set(t.left,t.top),c=Ut[1].set(t.left,t.bottom),d=Ut[2].set(t.right,t.top),p=Ut[3].set(t.right,t.bottom);if(d.x<=f.x||c.y<=f.y)return!1;var m=Math.sign(e.a*e.d-e.b*e.c);if(m===0||(e.apply(f,f),e.apply(c,c),e.apply(d,d),e.apply(p,p),Math.max(f.x,c.x,d.x,p.x)<=o||Math.min(f.x,c.x,d.x,p.x)>=h||Math.max(f.y,c.y,d.y,p.y)<=u||Math.min(f.y,c.y,d.y,p.y)>=l))return!1;var v=m*(c.y-f.y),y=m*(f.x-c.x),R=v*o+y*u,C=v*h+y*u,M=v*o+y*l,k=v*h+y*l;if(Math.max(R,C,M,k)<=v*f.x+y*f.y||Math.min(R,C,M,k)>=v*p.x+y*p.y)return!1;var B=m*(f.y-d.y),T=m*(d.x-f.x),b=B*o+T*u,G=B*h+T*u,rr=B*o+T*l,ir=B*h+T*l;return!(Math.max(b,G,rr,ir)<=B*f.x+T*f.y||Math.min(b,G,rr,ir)>=B*p.x+T*p.y)},r.prototype.pad=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this},r.prototype.fit=function(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=n,this.height=Math.max(s-n,0),this},r.prototype.ceil=function(t,e){t===void 0&&(t=1),e===void 0&&(e=.001);var i=Math.ceil((this.x+this.width-e)*t)/t,n=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=n-this.y,this},r.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,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}(),gt=function(){function r(t,e,i,n){i===void 0&&(i=0),n===void 0&&(n=0),this._x=i,this._y=n,this.cb=t,this.scope=e}return r.prototype.clone=function(t,e){return t===void 0&&(t=this.cb),e===void 0&&(e=this.scope),new r(t,e,this._x,this._y)},r.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(t){return t.set(this._x,this._y),t},r.prototype.equals=function(t){return t.x===this._x&&t.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(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),H=function(){function r(t,e,i,n,s,a){t===void 0&&(t=1),e===void 0&&(e=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=0),a===void 0&&(a=0),this.array=null,this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=a}return r.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},r.prototype.set=function(t,e,i,n,s,a){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=a,this},r.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var i=e||this.array;return t?(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(t,e){e=e||new P;var i=t.x,n=t.y;return e.x=this.a*i+this.c*n+this.tx,e.y=this.b*i+this.d*n+this.ty,e},r.prototype.applyInverse=function(t,e){e=e||new P;var i=1/(this.a*this.d+this.c*-this.b),n=t.x,s=t.y;return e.x=this.d*i*n+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*s+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,e},r.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},r.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},r.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.a,s=this.c,a=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=a*e-this.ty*i,this.ty=a*i+this.ty*e,this},r.prototype.append=function(t){var e=this.a,i=this.b,n=this.c,s=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*s,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*s,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this},r.prototype.setTransform=function(t,e,i,n,s,a,o,h,u){return this.a=Math.cos(o+u)*s,this.b=Math.sin(o+u)*s,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(i*this.a+n*this.c),this.ty=e-(i*this.b+n*this.d),this},r.prototype.prepend=function(t){var e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){var i=this.a,n=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},r.prototype.decompose=function(t){var e=this.a,i=this.b,n=this.c,s=this.d,a=t.pivot,o=-Math.atan2(-n,s),h=Math.atan2(i,e),u=Math.abs(o+h);return u<1e-5||Math.abs(Bi-u)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(n*n+s*s),t.position.x=this.tx+(a.x*e+a.y*n),t.position.y=this.ty+(a.x*i+a.y*s),t},r.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,n=this.d,s=this.tx,a=t*n-e*i;return this.a=n/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(t*this.ty-e*s)/a,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},r.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},r.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},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}(),st=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],at=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ot=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ht=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ye=[],ei=[],Ft=Math.sign;function Xi(){for(var r=0;r<16;r++){var t=[];ye.push(t);for(var e=0;e<16;e++)for(var i=Ft(st[r]*st[e]+ot[r]*at[e]),n=Ft(at[r]*st[e]+ht[r]*at[e]),s=Ft(st[r]*ot[e]+ot[r]*ht[e]),a=Ft(at[r]*ot[e]+ht[r]*ht[e]),o=0;o<16;o++)if(st[o]===i&&at[o]===n&&ot[o]===s&&ht[o]===a){t.push(o);break}}for(var r=0;r<16;r++){var h=new H;h.set(st[r],at[r],ot[r],ht[r],0,0),ei.push(h)}}Xi();var A={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 st[r]},uY:function(r){return at[r]},vX:function(r){return ot[r]},vY:function(r){return ht[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,t){return ye[r][t]},sub:function(r,t){return ye[r][A.inv(t)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,t){return Math.abs(r)*2<=Math.abs(t)?t>=0?A.S:A.N:Math.abs(t)*2<=Math.abs(r)?r>0?A.E:A.W:t>0?r>0?A.SE:A.SW:r>0?A.NE:A.NW},matrixAppendRotationInv:function(r,t,e,i){e===void 0&&(e=0),i===void 0&&(i=0);var n=ei[A.inv(t)];n.tx=e,n.ty=i,r.append(n)}},Hi=function(){function r(){this.worldTransform=new H,this.localTransform=new H,this.position=new gt(this.onChange,this,0,0),this.scale=new gt(this.onChange,this,1,1),this.pivot=new gt(this.onChange,this,0,0),this.skew=new gt(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 t=this.localTransform;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)},r.prototype.updateTransform=function(t){var e=this.localTransform;if(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),this._parentID!==t._worldID){var i=t.worldTransform,n=this.worldTransform;n.a=e.a*i.a+e.b*i.c,n.b=e.a*i.b+e.b*i.d,n.c=e.c*i.a+e.d*i.c,n.d=e.c*i.b+e.d*i.d,n.tx=e.tx*i.a+e.ty*i.c+i.tx,n.ty=e.tx*i.b+e.ty*i.d+i.ty,this._parentID=t._worldID,this._worldID++}},r.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();/*!
* @pixi/core - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/core is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/x.PREFER_ENV=ut.any?J.WEBGL:J.WEBGL2;x.STRICT_TEXTURE_CACHE=!1;var ge=[];function ri(r,t){if(!r)return null;var e="";if(typeof r=="string"){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(var n=ge.length-1;n>=0;--n){var s=ge[n];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var xe=function(r,t){return xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n])},xe(r,t)};function N(r,t){xe(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Te=function(){return Te=Object.assign||function(t){for(var e=arguments,i,n=1,s=arguments.length;n<s;n++){i=e[n];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t},Te.apply(this,arguments)};function Vi(r,t){var e={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)t.indexOf(i[n])<0&&(e[i[n]]=r[i[n]]);return e}var wt=function(){function r(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new S("setRealSize"),this.onUpdate=new S("update"),this.onError=new S("onError")}return r.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},r.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},r.prototype.resize=function(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))},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(t,e,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(t,e){return!1},r}(),Ne=function(r){N(t,r);function t(e,i){var n=this,s=i||{},a=s.width,o=s.height;if(!a||!o)throw new Error("BufferResource width or height invalid");return n=r.call(this,a,o)||this,n.data=e,n}return t.prototype.upload=function(e,i,n){var s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===tt.UNPACK);var a=i.realWidth,o=i.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(i.target,0,0,0,a,o,i.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(i.target,0,n.internalFormat,a,o,0,i.format,n.type,this.data)),!0},t.prototype.dispose=function(){this.data=null},t.test=function(e){return e instanceof Float32Array||e instanceof Uint8Array||e instanceof Uint32Array},t}(wt),ji={scaleMode:Y.NEAREST,format:_.RGBA,alphaMode:tt.NPM},L=function(r){N(t,r);function t(e,i){e===void 0&&(e=null),i===void 0&&(i=null);var n=r.call(this)||this;i=i||{};var s=i.alphaMode,a=i.mipmap,o=i.anisotropicLevel,h=i.scaleMode,u=i.width,l=i.height,f=i.wrapMode,c=i.format,d=i.type,p=i.target,m=i.resolution,v=i.resourceOptions;return e&&!(e instanceof wt)&&(e=ri(e,v),e.internal=!0),n.resolution=m||x.RESOLUTION,n.width=Math.round((u||0)*n.resolution)/n.resolution,n.height=Math.round((l||0)*n.resolution)/n.resolution,n._mipmap=a!==void 0?a:x.MIPMAP_TEXTURES,n.anisotropicLevel=o!==void 0?o:x.ANISOTROPIC_LEVEL,n._wrapMode=f||x.WRAP_MODE,n._scaleMode=h!==void 0?h:x.SCALE_MODE,n.format=c||_.RGBA,n.type=d||I.UNSIGNED_BYTE,n.target=p||lt.TEXTURE_2D,n.alphaMode=s!==void 0?s:tt.UNPACK,n.uid=It(),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(e),n}return Object.defineProperty(t.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),t.prototype.setStyle=function(e,i){var n;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,n=!0),i!==void 0&&i!==this.mipmap&&(this.mipmap=i,n=!0),n&&this.dirtyStyleId++,this},t.prototype.setSize=function(e,i,n){return n=n||this.resolution,this.setRealSize(e*n,i*n,n)},t.prototype.setRealSize=function(e,i,n){return this.resolution=n||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(i)/this.resolution,this._refreshPOT(),this.update(),this},t.prototype._refreshPOT=function(){this.isPowerOfTwo=gr(this.realWidth)&&gr(this.realHeight)},t.prototype.setResolution=function(e){var i=this.resolution;return i===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*i)/e,this.height=Math.round(this.height*i)/e,this.emit("update",this)),this._refreshPOT(),this)},t.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},t.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))},t.prototype.onError=function(e){this.emit("error",this,e)},t.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete rt[this.cacheId],delete $[this.cacheId],this.cacheId=null),this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},t.prototype.dispose=function(){this.emit("dispose",this)},t.prototype.castToBaseTexture=function(){return this},t.from=function(e,i,n){n===void 0&&(n=x.STRICT_TEXTURE_CACHE);var s=typeof e=="string",a=null;if(s)a=e;else{if(!e._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";e._pixiId=o+"_"+It()}a=e._pixiId}var h=rt[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return h||(h=new t(e,i),h.cacheId=a,t.addToCache(h,a)),h},t.fromBuffer=function(e,i,n,s){e=e||new Float32Array(i*n*4);var a=new Ne(e,{width:i,height:n}),o=e instanceof Float32Array?I.FLOAT:I.UNSIGNED_BYTE;return new t(a,Object.assign(ji,s||{width:i,height:n,type:o}))},t.addToCache=function(e,i){i&&(e.textureCacheIds.indexOf(i)===-1&&e.textureCacheIds.push(i),rt[i]&&console.warn("BaseTexture added to the cache with an id ["+i+"] that already had an entry"),rt[i]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var i=rt[e];if(i){var n=i.textureCacheIds.indexOf(e);return n>-1&&i.textureCacheIds.splice(n,1),delete rt[e],i}}else if(e&&e.textureCacheIds){for(var s=0;s<e.textureCacheIds.length;++s)delete rt[e.textureCacheIds[s]];return e.textureCacheIds.length=0,e}return null},t._globalBatch=0,t}(Wt),ii=function(r){N(t,r);function t(e,i){var n=this,s=i||{},a=s.width,o=s.height;n=r.call(this,a,o)||this,n.items=[],n.itemDirtyIds=[];for(var h=0;h<e;h++){var u=new L;n.items.push(u),n.itemDirtyIds.push(-2)}return n.length=e,n._load=null,n.baseTexture=null,n}return t.prototype.initFromArray=function(e,i){for(var n=0;n<this.length;n++)!e[n]||(e[n].castToBaseTexture?this.addBaseTextureAt(e[n].castToBaseTexture(),n):e[n]instanceof wt?this.addResourceAt(e[n],n):this.addResourceAt(ri(e[n],i),n))},t.prototype.dispose=function(){for(var e=0,i=this.length;e<i;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},t.prototype.addResourceAt=function(e,i){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[i].setResource(e),this},t.prototype.bind=function(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");r.prototype.bind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=e,this.items[i].on("update",e.update,e)},t.prototype.unbind=function(e){r.prototype.unbind.call(this,e);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",e.update,e)},t.prototype.load=function(){var e=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=e.items[0],a=s.realWidth,o=s.realHeight;return e.resize(a,o),Promise.resolve(e)}),this._load},t}(wt),Di=function(r){N(t,r);function t(e,i){var n=this,s=i||{},a=s.width,o=s.height,h,u;return Array.isArray(e)?(h=e,u=e.length):u=e,n=r.call(this,u,{width:a,height:o})||this,h&&n.initFromArray(h,i),n}return t.prototype.addBaseTextureAt=function(e,i){if(e.resource)this.addResourceAt(e.resource,i);else throw new Error("ArrayResource does not support RenderTexture");return this},t.prototype.bind=function(e){r.prototype.bind.call(this,e),e.target=lt.TEXTURE_2D_ARRAY},t.prototype.upload=function(e,i,n){var s=this,a=s.length,o=s.itemDirtyIds,h=s.items,u=e.gl;n.dirtyId<0&&u.texImage3D(u.TEXTURE_2D_ARRAY,0,n.internalFormat,this._width,this._height,a,0,i.format,n.type,null);for(var l=0;l<a;l++){var f=h[l];o[l]<f.dirtyId&&(o[l]=f.dirtyId,f.valid&&u.texSubImage3D(u.TEXTURE_2D_ARRAY,0,0,0,l,f.resource.width,f.resource.height,1,i.format,n.type,f.resource.source))}return!0},t}(ii),et=function(r){N(t,r);function t(e){var i=this,n=e,s=n.naturalWidth||n.videoWidth||n.width,a=n.naturalHeight||n.videoHeight||n.height;return i=r.call(this,s,a)||this,i.source=e,i.noSubImage=!1,i}return t.crossOrigin=function(e,i,n){n===void 0&&i.indexOf("data:")!==0?e.crossOrigin=Gi(i):n!==!1&&(e.crossOrigin=typeof n=="string"?n:"anonymous")},t.prototype.upload=function(e,i,n,s){var a=e.gl,o=i.realWidth,h=i.realHeight;if(s=s||this.source,s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===tt.UNPACK),!this.noSubImage&&i.target===a.TEXTURE_2D&&n.width===o&&n.height===h?a.texSubImage2D(a.TEXTURE_2D,0,0,0,i.format,n.type,s):(n.width=o,n.height=h,a.texImage2D(i.target,0,n.internalFormat,i.format,n.type,s)),!0},t.prototype.update=function(){if(!this.destroyed){var e=this.source,i=e.naturalWidth||e.videoWidth||e.width,n=e.naturalHeight||e.videoHeight||e.height;this.resize(i,n),r.prototype.update.call(this)}},t.prototype.dispose=function(){this.source=null},t}(wt),ni=function(r){N(t,r);function t(e){return r.call(this,e)||this}return t.test=function(e){var i=globalThis.OffscreenCanvas;return i&&e instanceof i?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement},t}(et),zi=function(r){N(t,r);function t(e,i){var n=this,s=i||{},a=s.width,o=s.height,h=s.autoLoad,u=s.linkBaseTexture;if(e&&e.length!==t.SIDES)throw new Error("Invalid length. Got "+e.length+", expected 6");n=r.call(this,6,{width:a,height:o})||this;for(var l=0;l<t.SIDES;l++)n.items[l].target=lt.TEXTURE_CUBE_MAP_POSITIVE_X+l;return n.linkBaseTexture=u!==!1,e&&n.initFromArray(e,i),h!==!1&&n.load(),n}return t.prototype.bind=function(e){r.prototype.bind.call(this,e),e.target=lt.TEXTURE_CUBE_MAP},t.prototype.addBaseTextureAt=function(e,i,n){if(!this.items[i])throw new Error("Index "+i+" is out of bounds");if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,i);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=lt.TEXTURE_CUBE_MAP_POSITIVE_X+i,e.parentTextureArray=this.baseTexture,this.items[i]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[i]=e,this},t.prototype.upload=function(e,i,n){for(var s=this.itemDirtyIds,a=0;a<t.SIDES;a++){var o=this.items[a];s[a]<o.dirtyId&&(o.valid&&o.resource?(o.resource.upload(e,o,n),s[a]=o.dirtyId):s[a]<-1&&(e.gl.texImage2D(o.target,0,n.internalFormat,i.realWidth,i.realHeight,0,i.format,n.type,null),s[a]=-1))}return!0},t.test=function(e){return Array.isArray(e)&&e.length===t.SIDES},t.SIDES=6,t}(ii),si=function(r){N(t,r);function t(e,i){var n=this;if(i=i||{},!(e instanceof HTMLImageElement)){var s=new Image;et.crossOrigin(s,e,i.crossorigin),s.src=e,e=s}return n=r.call(this,e)||this,!e.complete&&!!n._width&&!!n._height&&(n._width=0,n._height=0),n.url=e.src,n._process=null,n.preserveBitmap=!1,n.createBitmap=(i.createBitmap!==void 0?i.createBitmap:x.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 t.prototype.load=function(e){var i=this;return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise(function(n,s){var a=i.source;i.url=a.src;var o=function(){i.destroyed||(a.onload=null,a.onerror=null,i.resize(a.width,a.height),i._load=null,i.createBitmap?n(i.process()):n(i))};a.complete&&a.src?o():(a.onload=o,a.onerror=function(h){s(h),i.onError.emit(h)})}),this._load)},t.prototype.process=function(){var e=this,i=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);var n=globalThis.createImageBitmap,s=!i.crossOrigin||i.crossOrigin==="anonymous";return this._process=fetch(i.src,{mode:s?"cors":"no-cors"}).then(function(a){return a.blob()}).then(function(a){return n(a,0,0,i.width,i.height,{premultiplyAlpha:e.alphaMode===tt.UNPACK?"premultiply":"none"})}).then(function(a){return e.destroyed?Promise.reject():(e.bitmap=a,e.update(),e._process=null,Promise.resolve(e))}),this._process},t.prototype.upload=function(e,i,n){if(typeof this.alphaMode=="number"&&(i.alphaMode=this.alphaMode),!this.createBitmap)return r.prototype.upload.call(this,e,i,n);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(r.prototype.upload.call(this,e,i,n,this.bitmap),!this.preserveBitmap){var s=!0,a=i._glTextures;for(var o in a){var h=a[o];if(h!==n&&h.dirtyId!==i.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},t.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},t.test=function(e){return typeof e=="string"||e instanceof HTMLImageElement},t}(et),Wi=function(r){N(t,r);function t(e,i){var n=this;return i=i||{},n=r.call(this,document.createElement("canvas"))||this,n._width=0,n._height=0,n.svg=e,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 t.prototype.load=function(){var e=this;return this._load?this._load:(this._load=new Promise(function(i){if(e._resolve=function(){e.resize(e.source.width,e.source.height),i(e)},t.SVG_XML.test(e.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");e.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e.svg)))}e._loadSvg()}),this._load)},t.prototype._loadSvg=function(){var e=this,i=new Image;et.crossOrigin(i,this.svg,this._crossorigin),i.src=this.svg,i.onerror=function(n){!e._resolve||(i.onerror=null,e.onError.emit(n))},i.onload=function(){if(!!e._resolve){var n=i.width,s=i.height;if(!n||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var a=n*e.scale,o=s*e.scale;(e._overrideWidth||e._overrideHeight)&&(a=e._overrideWidth||e._overrideHeight/s*n,o=e._overrideHeight||e._overrideWidth/n*s),a=Math.round(a),o=Math.round(o);var h=e.source;h.width=a,h.height=o,h._pixiId="canvas_"+It(),h.getContext("2d").drawImage(i,0,0,n,s,0,0,a,o),e._resolve(),e._resolve=null}}},t.getSize=function(e){var i=t.SVG_SIZE.exec(e),n={};return i&&(n[i[1]]=Math.round(parseFloat(i[3])),n[i[5]]=Math.round(parseFloat(i[7]))),n},t.prototype.dispose=function(){r.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},t.test=function(e,i){return i==="svg"||typeof e=="string"&&/^data:image\/svg\+xml(;(charset=utf8|utf8))?;base64/.test(e)||typeof e=="string"&&t.SVG_XML.test(e)},t.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,t.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,t}(et),$i=function(r){N(t,r);function t(e,i){var n=this;if(i=i||{},!(e instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof e=="string"&&(e=[e]);var a=e[0].src||e[0];et.crossOrigin(s,a,i.crossorigin);for(var o=0;o<e.length;++o){var h=document.createElement("source"),u=e[o],l=u.src,f=u.mime;l=l||e[o];var c=l.split("?").shift().toLowerCase(),d=c.slice(c.lastIndexOf(".")+1);f=f||t.MIME_TYPES[d]||"video/"+d,h.src=l,h.type=f,s.appendChild(h)}e=s}return n=r.call(this,e)||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 t.prototype.update=function(e){if(!this.destroyed){var i=q.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)}},t.prototype.load=function(){var e=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){e.valid?n(e):(e._resolve=n,i.load())}),this._load},t.prototype._onError=function(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)},t.prototype._isSourcePlaying=function(){var e=this.source;return e.currentTime>0&&e.paused===!1&&e.ended===!1&&e.readyState>2},t.prototype._isSourceReady=function(){var e=this.source;return e.readyState===3||e.readyState===4},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(q.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(q.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var i=this.valid;this.resize(e.videoWidth,e.videoHeight),!i&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(q.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),r.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(q.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(q.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,i){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(i)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(et),qi=function(r){N(t,r);function t(e){return r.call(this,e)||this}return t.test=function(e){return!!globalThis.createImageBitmap&&e instanceof ImageBitmap},t}(et);ge.push(si,qi,ni,$i,Wi,Ne,zi,Di);var Yi=function(r){N(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.upload=function(e,i,n){var s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.alphaMode===tt.UNPACK);var a=i.realWidth,o=i.realHeight;return n.width===a&&n.height===o?s.texSubImage2D(i.target,0,0,0,a,o,i.format,n.type,this.data):(n.width=a,n.height=o,s.texImage2D(i.target,0,n.internalFormat,a,o,0,i.format,n.type,this.data)),!0},t}(Ne),be=function(){function r(t,e){this.width=Math.round(t||100),this.height=Math.round(e||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 S("disposeFramebuffer"),this.multisample=F.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(t,e){return t===void 0&&(t=0),this.colorTextures[t]=e||new L(null,{scaleMode:Y.NEAREST,resolution:1,mipmap:ft.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(t){return this.depthTexture=t||new L(new Yi(null,{width:this.width,height:this.height}),{scaleMode:Y.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:ft.OFF,format:_.DEPTH_COMPONENT,type:I.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(t,e){if(t=Math.round(t),e=Math.round(e),!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var n=this.colorTextures[i],s=n.resolution;n.setSize(t/s,e/s)}if(this.depthTexture){var s=this.depthTexture.resolution;this.depthTexture.setSize(t/s,e/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}(),ai=function(r){N(t,r);function t(e){e===void 0&&(e={});var i=this;if(typeof e=="number"){var n=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3];e={width:n,height:s,scaleMode:a,resolution:o}}return e.width=e.width||100,e.height=e.height||100,e.multisample=e.multisample!==void 0?e.multisample:F.NONE,i=r.call(this,null,e)||this,i.mipmap=ft.OFF,i.valid=!0,i.clearColor=[0,0,0,0],i.framebuffer=new be(i.realWidth,i.realHeight).addColorTexture(0,i),i.framebuffer.multisample=e.multisample,i.maskStack=[],i.filterStack=[{}],i}return t.prototype.resize=function(e,i){this.framebuffer.resize(e*this.resolution,i*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},t.prototype.dispose=function(){this.framebuffer.dispose(),r.prototype.dispose.call(this)},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},t}(L),oi=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(t,e,i){var n=e.width,s=e.height;if(i){var a=t.width/2/n,o=t.height/2/s,h=t.x/n+a,u=t.y/s+o;i=A.add(i,A.NW),this.x0=h+a*A.uX(i),this.y0=u+o*A.uY(i),i=A.add(i,2),this.x1=h+a*A.uX(i),this.y1=u+o*A.uY(i),i=A.add(i,2),this.x2=h+a*A.uX(i),this.y2=u+o*A.uY(i),i=A.add(i,2),this.x3=h+a*A.uX(i),this.y3=u+o*A.uY(i)}else this.x0=t.x/n,this.y0=t.y/s,this.x1=(t.x+t.width)/n,this.y1=t.y/s,this.x2=(t.x+t.width)/n,this.y2=(t.y+t.height)/s,this.x3=t.x/n,this.y3=(t.y+t.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}(),Rr=new oi;function Lt(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var K=function(r){N(t,r);function t(e,i,n,s,a,o){var h=r.call(this)||this;if(h.noFrame=!1,i||(h.noFrame=!0,i=new U(0,0,1,1)),e instanceof t&&(e=e.baseTexture),h.baseTexture=e,h._frame=i,h.trim=s,h.valid=!1,h._uvs=Rr,h.uvMatrix=null,h.orig=n||i,h._rotate=Number(a||0),a===!0)h._rotate=2;else if(h._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return h.defaultAnchor=o?new P(o.x,o.y):new P(0,0),h._updateID=0,h.textureCacheIds=[],e.valid?h.noFrame?e.valid&&h.onBaseTextureUpdated(e):h.frame=i:e.once("loaded",h.onBaseTextureUpdated,h),h.noFrame&&e.on("update",h.onBaseTextureUpdated,h),h}return t.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},t.prototype.onBaseTextureUpdated=function(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},t.prototype.destroy=function(e){if(this.baseTexture){if(e){var i=this.baseTexture.resource;i&&i.url&&$[i.url]&&t.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,t.removeFromCache(this),this.textureCacheIds=null},t.prototype.clone=function(){var e=this._frame.clone(),i=this._frame===this.orig?e:this.orig.clone(),n=new t(this.baseTexture,!this.noFrame&&e,i,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(n._frame=e),n},t.prototype.updateUvs=function(){this._uvs===Rr&&(this._uvs=new oi),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},t.from=function(e,i,n){i===void 0&&(i={}),n===void 0&&(n=x.STRICT_TEXTURE_CACHE);var s=typeof e=="string",a=null;if(s)a=e;else if(e instanceof L){if(!e.cacheId){var o=i&&i.pixiIdPrefix||"pixiid";e.cacheId=o+"-"+It(),L.addToCache(e,e.cacheId)}a=e.cacheId}else{if(!e._pixiId){var o=i&&i.pixiIdPrefix||"pixiid";e._pixiId=o+"_"+It()}a=e._pixiId}var h=$[a];if(s&&n&&!h)throw new Error('The cacheId "'+a+'" does not exist in TextureCache.');return!h&&!(e instanceof L)?(i.resolution||(i.resolution=Ir(e)),h=new t(new L(e,i)),h.baseTexture.cacheId=a,L.addToCache(h.baseTexture,a),t.addToCache(h,a)):!h&&e instanceof L&&(h=new t(e),t.addToCache(h,a)),h},t.fromURL=function(e,i){var n=Object.assign({autoLoad:!1},i==null?void 0:i.resourceOptions),s=t.from(e,Object.assign({resourceOptions:n},i),!1),a=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):a.load().then(function(){return Promise.resolve(s)})},t.fromBuffer=function(e,i,n,s){return new t(L.fromBuffer(e,i,n,s))},t.fromLoader=function(e,i,n,s){var a=new L(e,Object.assign({scaleMode:x.SCALE_MODE,resolution:Ir(i)},s)),o=a.resource;o instanceof si&&(o.url=i);var h=new t(a);return n||(n=i),L.addToCache(h.baseTexture,n),t.addToCache(h,n),n!==i&&(L.addToCache(h.baseTexture,i),t.addToCache(h,i)),h.baseTexture.valid?Promise.resolve(h):new Promise(function(u){h.baseTexture.once("loaded",function(){return u(h)})})},t.addToCache=function(e,i){i&&(e.textureCacheIds.indexOf(i)===-1&&e.textureCacheIds.push(i),$[i]&&console.warn("Texture added to the cache with an id ["+i+"] that already had an entry"),$[i]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var i=$[e];if(i){var n=i.textureCacheIds.indexOf(e);return n>-1&&i.textureCacheIds.splice(n,1),delete $[e],i}}else if(e&&e.textureCacheIds){for(var s=0;s<e.textureCacheIds.length;++s)$[e.textureCacheIds[s]]===e&&delete $[e.textureCacheIds[s]];return e.textureCacheIds.length=0,e}return null},Object.defineProperty(t.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frame",{get:function(){return this._frame},set:function(e){this._frame=e,this.noFrame=!1;var i=e.x,n=e.y,s=e.width,a=e.height,o=i+s>this.baseTexture.width,h=n+a>this.baseTexture.height;if(o||h){var u=o&&h?"and":"or",l="X: "+i+" + "+s+" = "+(i+s)+" > "+this.baseTexture.width,f="Y: "+n+" + "+a+" = "+(n+a)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(l+" "+u+" "+f))}this.valid=s&&a&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),t.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(t,"EMPTY",{get:function(){return t._EMPTY||(t._EMPTY=new t(new L),Lt(t._EMPTY),Lt(t._EMPTY.baseTexture)),t._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(t,"WHITE",{get:function(){if(!t._WHITE){var e=document.createElement("canvas"),i=e.getContext("2d");e.width=16,e.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),t._WHITE=new t(new L(new ni(e))),Lt(t._WHITE),Lt(t._WHITE.baseTexture)}return t._WHITE},enumerable:!1,configurable:!0}),t}(Wt),Ce=function(r){N(t,r);function t(e,i){var n=r.call(this,e,i)||this;return n.valid=!0,n.filterFrame=null,n.filterPoolKey=null,n.updateUvs(),n}return Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,i,n){n===void 0&&(n=!0);var s=this.baseTexture.resolution,a=Math.round(e*s)/s,o=Math.round(i*s)/s;this.valid=a>0&&o>0,this._frame.width=this.orig.width=a,this._frame.height=this.orig.height=o,n&&this.baseTexture.resize(a,o),this.updateUvs()},t.prototype.setResolution=function(e){var i=this.baseTexture;i.resolution!==e&&(i.setResolution(e),this.resize(i.width,i.height,!1))},t.create=function(e){for(var i=arguments,n=[],s=1;s<arguments.length;s++)n[s-1]=i[s];return typeof e=="number"&&(Rt("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),e={width:e,height:n[0],scaleMode:n[1],resolution:n[2]}),new t(new ai(e))},t}(K),Ki=function(){function r(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return r.prototype.createTexture=function(t,e,i){i===void 0&&(i=F.NONE);var n=new ai(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Ce(n)},r.prototype.getOptimalTexture=function(t,e,i,n){i===void 0&&(i=1),n===void 0&&(n=F.NONE);var s;t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=jt(t),e=jt(e),s=((t&65535)<<16|e&65535)>>>0,n>1&&(s+=n*4294967296)):s=n>1?-n:-1,this.texturePool[s]||(this.texturePool[s]=[]);var a=this.texturePool[s].pop();return a||(a=this.createTexture(t,e,n)),a.filterPoolKey=s,a.setResolution(i),a},r.prototype.getFilterTexture=function(t,e,i){var n=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||F.NONE);return n.filterFrame=t.filterFrame,n},r.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},r.prototype.returnFilterTexture=function(t){this.returnTexture(t)},r.prototype.clear=function(t){if(t=t!==!1,t)for(var e in this.texturePool){var i=this.texturePool[e];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0)}this.texturePool={}},r.prototype.setScreenSize=function(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(var e in this.texturePool)if(Number(e)<0){var i=this.texturePool[e];if(i)for(var n=0;n<i.length;n++)i[n].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}},r.SCREEN_KEY=-1,r}(),Er=function(){function r(t,e,i,n,s,a,o){e===void 0&&(e=0),i===void 0&&(i=!1),n===void 0&&(n=I.FLOAT),this.buffer=t,this.size=e,this.normalized=i,this.type=n,this.stride=s,this.start=a,this.instance=o}return r.prototype.destroy=function(){this.buffer=null},r.from=function(t,e,i,n,s){return new r(t,e,i,n,s)},r}(),Zi=0,X=function(){function r(t,e,i){e===void 0&&(e=!0),i===void 0&&(i=!1),this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=Zi++,this.disposeRunner=new S("disposeBuffer")}return r.prototype.update=function(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||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===W.ELEMENT_ARRAY_BUFFER},set:function(t){this.type=t?W.ELEMENT_ARRAY_BUFFER:W.ARRAY_BUFFER},enumerable:!1,configurable:!0}),r.from=function(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)},r}(),Ji={Float32Array,Uint32Array,Int32Array,Uint8Array};function Qi(r,t){for(var e=0,i=0,n={},s=0;s<r.length;s++)i+=t[s],e+=r[s].length;for(var a=new ArrayBuffer(e*4),o=null,h=0,s=0;s<r.length;s++){var u=t[s],l=r[s],f=ti(l);n[f]||(n[f]=new Ji[f](a)),o=n[f];for(var c=0;c<l.length;c++){var d=(c/u|0)*i+h,p=c%u;o[d+p]=l[c]}h+=u}return new Float32Array(a)}var wr={5126:4,5123:2,5121:1},tn=0,en={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},Ae=function(){function r(t,e){t===void 0&&(t=[]),e===void 0&&(e={}),this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=tn++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new S("disposeGeometry"),this.refCount=0}return r.prototype.addAttribute=function(t,e,i,n,s,a,o,h){if(i===void 0&&(i=0),n===void 0&&(n=!1),h===void 0&&(h=!1),!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof X||(e instanceof Array&&(e=new Float32Array(e)),e=new X(e));var u=t.split("|");if(u.length>1){for(var l=0;l<u.length;l++)this.addAttribute(u[l],e,i,n,s);return this}var f=this.buffers.indexOf(e);return f===-1&&(this.buffers.push(e),f=this.buffers.length-1),this.attributes[t]=new Er(f,i,n,s,a,o,h),this.instanced=this.instanced||h,this},r.prototype.getAttribute=function(t){return this.attributes[t]},r.prototype.getBuffer=function(t){return this.buffers[this.getAttribute(t).buffer]},r.prototype.addIndex=function(t){return t instanceof X||(t instanceof Array&&(t=new Uint16Array(t)),t=new X(t)),t.type=W.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.indexOf(t)===-1&&this.buffers.push(t),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 t=[],e=[],i=new X,n;for(n in this.attributes){var s=this.attributes[n],a=this.buffers[s.buffer];t.push(a.data),e.push(s.size*wr[s.type]/4),s.buffer=0}for(i.data=Qi(t,e),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 t in this.attributes){var e=this.attributes[t],i=this.buffers[e.buffer];return i.data.length/(e.stride/4||e.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 t=new r,e=0;e<this.buffers.length;e++)t.buffers[e]=new X(this.buffers[e].data.slice(0));for(var e in this.attributes){var i=this.attributes[e];t.attributes[e]=new Er(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=W.ELEMENT_ARRAY_BUFFER),t},r.merge=function(t){for(var e=new r,i=[],n=[],s=[],a,o=0;o<t.length;o++){a=t[o];for(var h=0;h<a.buffers.length;h++)n[h]=n[h]||0,n[h]+=a.buffers[h].data.length,s[h]=0}for(var o=0;o<a.buffers.length;o++)i[o]=new en[ti(a.buffers[o].data)](n[o]),e.buffers[o]=new X(i[o]);for(var o=0;o<t.length;o++){a=t[o];for(var h=0;h<a.buffers.length;h++)i[h].set(a.buffers[h].data,s[h]),s[h]+=a.buffers[h].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=W.ELEMENT_ARRAY_BUFFER;for(var u=0,l=0,f=0,c=0,o=0;o<a.buffers.length;o++)if(a.buffers[o]!==a.indexBuffer){c=o;break}for(var o in a.attributes){var d=a.attributes[o];(d.buffer|0)===c&&(l+=d.size*wr[d.type]/4)}for(var o=0;o<t.length;o++){for(var p=t[o].indexBuffer.data,h=0;h<p.length;h++)e.indexBuffer.data[h+f]+=u;u+=t[o].buffers[c].data.length/l,f+=p.length}}return e},r}(),rn=function(r){N(t,r);function t(){var e=r.call(this)||this;return e.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),e}return t}(Ae),nn=function(r){N(t,r);function t(){var e=r.call(this)||this;return e.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.uvs=new Float32Array([0,0,1,0,1,1,0,1]),e.vertexBuffer=new X(e.vertices),e.uvBuffer=new X(e.uvs),e.addAttribute("aVertexPosition",e.vertexBuffer).addAttribute("aTextureCoord",e.uvBuffer).addIndex([0,1,2,0,2,3]),e}return t.prototype.map=function(e,i){var n=0,s=0;return this.uvs[0]=n,this.uvs[1]=s,this.uvs[2]=n+i.width/e.width,this.uvs[3]=s,this.uvs[4]=n+i.width/e.width,this.uvs[5]=s+i.height/e.height,this.uvs[6]=n,this.uvs[7]=s+i.height/e.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},t.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},t}(Ae),sn=0,dt=function(){function r(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=sn++,this.static=!!e,this.ubo=!!i,t instanceof X?(this.buffer=t,this.buffer.type=W.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new X(new Float32Array(1)),this.buffer.type=W.UNIFORM_BUFFER,this.autoManage=!0))}return r.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},r.prototype.add=function(t,e,i){if(!this.ubo)this.uniforms[t]=new r(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")},r.from=function(t,e,i){return new r(t,e,i)},r.uboFrom=function(t,e){return new r(t,e!=null?e:!0,!0)},r}(),an=function(){function r(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=F.NONE,this.sourceFrame=new U,this.destinationFrame=new U,this.bindingSourceFrame=new U,this.bindingDestinationFrame=new U,this.filters=[],this.transform=null}return r.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},r}(),Ot=[new P,new P,new P,new P],Zt=new H,on=function(){function r(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Ki,this.texturePool.setScreenSize(t.view),this.statePool=[],this.quad=new rn,this.quadUv=new nn,this.tempRect=new U,this.activeState={},this.globalUniforms=new dt({outputFrame:new U,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(t,e){for(var i,n,s=this.renderer,a=this.defaultFilterStack,o=this.statePool.pop()||new an,h=this.renderer.renderTexture,u=e[0].resolution,l=e[0].multisample,f=e[0].padding,c=e[0].autoFit,d=(i=e[0].legacy)!==null&&i!==void 0?i:!0,p=1;p<e.length;p++){var m=e[p];u=Math.min(u,m.resolution),l=Math.min(l,m.multisample),f=this.useMaxPadding?Math.max(f,m.padding):f+m.padding,c=c&&m.autoFit,d=d||((n=m.legacy)!==null&&n!==void 0?n:!0)}a.length===1&&(this.defaultFilterStack[0].renderTexture=h.current),a.push(o),o.resolution=u,o.multisample=l,o.legacy=d,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(f);var v=this.tempRect.copyFrom(h.sourceFrame);s.projection.transform&&this.transformAABB(Zt.copyFrom(s.projection.transform).invert(),v),c?(o.sourceFrame.fit(v),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(v)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,h.current?h.current.resolution:s.resolution,h.sourceFrame,h.destinationFrame,s.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,u,l),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;var y=this.tempRect;y.x=0,y.y=0,y.width=o.sourceFrame.width,y.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(h.sourceFrame),o.bindingDestinationFrame.copyFrom(h.destinationFrame),o.transform=s.projection.transform,s.projection.transform=null,h.bind(o.renderTexture,o.sourceFrame,y),s.framebuffer.clear(0,0,0,0)},r.prototype.pop=function(){var t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;var n=this.globalUniforms.uniforms;n.outputFrame=e.sourceFrame,n.resolution=e.resolution;var s=n.inputSize,a=n.inputPixel,o=n.inputClamp;if(s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],a[0]=Math.round(s[0]*e.resolution),a[1]=Math.round(s[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=e.sourceFrame.width*s[2]-.5*a[2],o[3]=e.sourceFrame.height*s[3]-.5*a[3],e.legacy){var h=n.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();var u=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,u.renderTexture,Q.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var l=e.renderTexture,f=this.getOptimalFilterTexture(l.width,l.height,e.resolution);f.filterFrame=l.filterFrame;var c=0;for(c=0;c<i.length-1;++c){c===1&&e.multisample>1&&(f=this.getOptimalFilterTexture(l.width,l.height,e.resolution),f.filterFrame=l.filterFrame),i[c].apply(this,l,f,Q.CLEAR,e);var d=l;l=f,f=d}i[c].apply(this,l,u.renderTexture,Q.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(f)}e.clear(),this.statePool.push(e)},r.prototype.bindAndClear=function(t,e){e===void 0&&(e=Q.CLEAR);var i=this.renderer,n=i.renderTexture,s=i.state;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t&&t.filterFrame){var a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,n.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var o=s.stateId&1||this.forceClear;(e===Q.CLEAR||e===Q.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(t,e,i,n){var s=this.renderer;s.state.set(t.state),this.bindAndClear(i,n),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(bt.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(bt.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(t,e){var i=this.activeState,n=i.sourceFrame,s=i.destinationFrame,a=e._texture.orig,o=t.set(s.width,0,0,s.height,n.x,n.y),h=e.worldTransform.copyTo(H.TEMP_MATRIX);return h.invert(),o.prepend(h),o.scale(1/a.width,1/a.height),o.translate(e.anchor.x,e.anchor.y),o},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(t,e,i,n){return i===void 0&&(i=1),n===void 0&&(n=F.NONE),this.texturePool.getOptimalTexture(t,e,i,n)},r.prototype.getFilterTexture=function(t,e,i){if(typeof t=="number"){var n=t;t=e,e=n}t=t||this.activeState.renderTexture;var s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||F.NONE);return s.filterFrame=t.filterFrame,s},r.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(t,e){var i=Ot[0],n=Ot[1],s=Ot[2],a=Ot[3];i.set(e.left,e.top),n.set(e.left,e.bottom),s.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(i,i),t.apply(n,n),t.apply(s,s),t.apply(a,a);var o=Math.min(i.x,n.x,s.x,a.x),h=Math.min(i.y,n.y,s.y,a.y),u=Math.max(i.x,n.x,s.x,a.x),l=Math.max(i.y,n.y,s.y,a.y);e.x=o,e.y=h,e.width=u-o,e.height=l-h},r.prototype.roundFrame=function(t,e,i,n,s){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(s){var a=s.a,o=s.b,h=s.c,u=s.d;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(u)>1e-4))return}s=s?Zt.copyFrom(s):Zt.identity(),s.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}},r}(),hi=function(){function r(t){this.renderer=t}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(t){},r}(),hn=function(){function r(t){this.renderer=t,this.emptyRenderer=new hi(t),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(t,e){for(var i=this.renderer.texture.boundTextures,n=e-1;n>=0;--n)t[n]=i[n]||null,t[n]&&(t[n]._batchLocation=n)},r.prototype.boundArray=function(t,e,i,n){for(var s=t.elements,a=t.ids,o=t.count,h=0,u=0;u<o;u++){var l=s[u],f=l._batchLocation;if(f>=0&&f<n&&e[f]===l){a[u]=f;continue}for(;h<n;){var c=e[h];if(c&&c._batchEnabled===i&&c._batchLocation===h){h++;continue}a[u]=h,l._batchLocation=h,e[h]=l;break}}},r.prototype.destroy=function(){this.renderer=null},r}(),Nr=0,un=function(){function r(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),t.view.addEventListener("webglcontextlost",this.handleContextLost,!1),t.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(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=Nr++,t.isContextLost()&&t.getExtension("WEBGL_lose_context")&&t.getExtension("WEBGL_lose_context").restoreContext()},r.prototype.initFromContext=function(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=Nr++,this.renderer.runners.contextChange.emit(t)},r.prototype.initFromOptions=function(t){var e=this.createContext(this.renderer.view,t);this.initFromContext(e)},r.prototype.createContext=function(t,e){var i;if(x.PREFER_ENV>=J.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!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 t=this.gl,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(t){t.preventDefault()},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.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(t){var e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e.stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var n=i||!!t.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}(),ln=function(){function r(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=F.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),fn=new U,cn=function(){function r(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new be(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new U,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),this.renderer.context.webGLVersion===1){var e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;x.PREFER_ENV===J.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=function(n){return e.drawBuffersWEBGL(n)}:(this.hasMRT=!1,t.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},r.prototype.bind=function(t,e,i){i===void 0&&(i=0);var n=this.gl;if(t){var s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=i),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var a=0;a<t.colorTextures.length;a++){var o=t.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){var h=e.width>>i,u=e.height>>i,l=h/e.width;this.setViewport(e.x*l,e.y*l,h,u)}else{var h=t.width>>i,u=t.height>>i;this.setViewport(0,0,h,u)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(t,e,i,n){var s=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),n=Math.round(n),(s.width!==i||s.height!==n||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=i,s.height=n,this.gl.viewport(t,e,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(t,e,i,n,s){s===void 0&&(s=Ht.COLOR|Ht.DEPTH);var a=this.gl;a.clearColor(t,e,i,n),a.clear(s)},r.prototype.initFramebuffer=function(t){var e=this.gl,i=new ln(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i},r.prototype.resizeFramebuffer=function(t){var e=this.gl,i=t.glFramebuffers[this.CONTEXT_UID];i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.RGBA8,t.width,t.height)),i.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,i.stencil),i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var n=t.colorTextures,s=n.length;e.drawBuffers||(s=Math.min(s,1));for(var a=0;a<s;a++){var o=n[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0)}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)},r.prototype.updateFramebuffer=function(t,e){var i=this.gl,n=t.glFramebuffers[this.CONTEXT_UID],s=t.colorTextures,a=s.length;i.drawBuffers||(a=Math.min(a,1)),n.multisample>1&&this.canMultisampleFramebuffer(t)?(n.msaaBuffer=n.msaaBuffer||i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,n.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,i.RGBA8,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,n.msaaBuffer)):n.msaaBuffer&&(i.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));for(var o=[],h=0;h<a;h++){var u=s[h],l=u.parentTextureArray||u;this.renderer.texture.bind(l,0),!(h===0&&n.msaaBuffer)&&(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,u.target,l._glTextures[this.CONTEXT_UID].texture,e),o.push(i.COLOR_ATTACHMENT0+h))}if(o.length>1&&i.drawBuffers(o),t.depthTexture){var f=this.writeDepthTexture;if(f){var c=t.depthTexture;this.renderer.texture.bind(c,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,e)}}(t.stencil||t.depth)&&!(t.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,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,t.width,t.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(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture},r.prototype.detectSamples=function(t){var e=this.msaaSamples,i=F.NONE;if(t<=1||e===null)return i;for(var n=0;n<e.length;n++)if(e[n]<=t){i=e[n];break}return i===1&&(i=F.NONE),i},r.prototype.blit=function(t,e,i){var n=this,s=n.current,a=n.renderer,o=n.gl,h=n.CONTEXT_UID;if(a.context.webGLVersion===2&&!!s){var u=s.glFramebuffers[h];if(!!u){if(!t){if(!u.msaaBuffer)return;var l=s.colorTextures[0];if(!l)return;u.blitFramebuffer||(u.blitFramebuffer=new be(s.width,s.height),u.blitFramebuffer.addColorTexture(0,l)),t=u.blitFramebuffer,t.colorTextures[0]!==l&&(t.colorTextures[0]=l,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=fn,e.width=s.width,e.height=s.height),i||(i=e);var f=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,u.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,f?o.NEAREST:o.LINEAR)}}},r.prototype.disposeFramebuffer=function(t,e){var i=t.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(!!i){delete t.glFramebuffers[this.CONTEXT_UID];var s=this.managedFramebuffers.indexOf(t);s>=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(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(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)},r.prototype.forceStencil=function(){var t=this.current;if(!!t){var e=t.glFramebuffers[this.CONTEXT_UID];if(!(!e||e.stencil)){t.stencil=!0;var i=t.width,n=t.height,s=this.gl,a=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,a),e.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,e.multisample,s.DEPTH24_STENCIL8,i,n):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,i,n),e.stencil=a,s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)}}},r.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new U},r.prototype.destroy=function(){this.renderer=null},r}(),Jt={5126:4,5123:2,5121:1},dn=function(){function r(t){this.renderer=t,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 t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){var i=this.renderer.context.extensions.vertexArrayObject;x.PREFER_ENV===J.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=function(){return i.createVertexArrayOES()},t.bindVertexArray=function(s){return i.bindVertexArrayOES(s)},t.deleteVertexArray=function(s){return i.deleteVertexArrayOES(s)}):(this.hasVao=!1,t.createVertexArray=function(){return null},t.bindVertexArray=function(){return null},t.deleteVertexArray=function(){return null})}if(e.webGLVersion!==2){var n=t.getExtension("ANGLE_instanced_arrays");n?(t.vertexAttribDivisor=function(s,a){return n.vertexAttribDivisorANGLE(s,a)},t.drawElementsInstanced=function(s,a,o,h,u){return n.drawElementsInstancedANGLE(s,a,o,h,u)},t.drawArraysInstanced=function(s,a,o,h){return n.drawArraysInstancedANGLE(s,a,o,h)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex},r.prototype.bind=function(t,e){e=e||this.renderer.shader.shader;var i=this.gl,n=t.glVertexArrayObjects[this.CONTEXT_UID],s=!1;n||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=n={},s=!0);var a=n[e.program.id]||this.initGeometryVao(t,e,s);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?i.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()},r.prototype.reset=function(){this.unbind()},r.prototype.updateBuffers=function(){for(var t=this._activeGeometry,e=this.renderer.buffer,i=0;i<t.buffers.length;i++){var n=t.buffers[i];e.update(n)}},r.prototype.checkCompatibility=function(t,e){var i=t.attributes,n=e.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(t,e){var i=t.attributes,n=e.attributeData,s=["g",t.id];for(var a in i)n[a]&&s.push(a,n[a].location);return s.join("-")},r.prototype.initGeometryVao=function(t,e,i){i===void 0&&(i=!0);var n=this.gl,s=this.CONTEXT_UID,a=this.renderer.buffer,o=e.program;o.glPrograms[s]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);var h=this.getSignature(t,o),u=t.glVertexArrayObjects[this.CONTEXT_UID],l=u[h];if(l)return u[o.id]=l,l;var f=t.buffers,c=t.attributes,d={},p={};for(var m in f)d[m]=0,p[m]=0;for(var m in c)!c[m].size&&o.attributeData[m]?c[m].size=o.attributeData[m].size:c[m].size||console.warn("PIXI Geometry attribute '"+m+"' size cannot be determined (likely the bound shader does not have the attribute)"),d[c[m].buffer]+=c[m].size*Jt[c[m].type];for(var m in c){var v=c[m],y=v.size;v.stride===void 0&&(d[v.buffer]===y*Jt[v.type]?v.stride=0:v.stride=d[v.buffer]),v.start===void 0&&(v.start=p[v.buffer],p[v.buffer]+=y*Jt[v.type])}l=n.createVertexArray(),n.bindVertexArray(l);for(var R=0;R<f.length;R++){var C=f[R];a.bind(C),i&&C._glBuffers[s].refCount++}return this.activateVao(t,o),this._activeVao=l,u[o.id]=l,u[h]=l,l},r.prototype.disposeGeometry=function(t,e){var i;if(!!this.managedGeometries[t.id]){delete this.managedGeometries[t.id];var n=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,a=t.buffers,o=(i=this.renderer)===null||i===void 0?void 0:i.buffer;if(t.disposeRunner.remove(this),!!n){if(o)for(var h=0;h<a.length;h++){var u=a[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!e&&o.dispose(a[h],e))}if(!e){for(var l in n)if(l[0]==="g"){var f=n[l];this._activeVao===f&&this.unbind(),s.deleteVertexArray(f)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}},r.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedGeometries),i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)},r.prototype.activateVao=function(t,e){var i=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,a=t.buffers,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);var h=null;for(var u in o){var l=o[u],f=a[l.buffer],c=f._glBuffers[n];if(e.attributeData[u]){h!==c&&(s.bind(f),h=c);var d=e.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(t,e,i,n){var s=this.gl,a=this._activeGeometry;if(a.indexBuffer){var o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?s.drawElementsInstanced(t,e||a.indexBuffer.data.length,h,(i||0)*o,n||1):s.drawElements(t,e||a.indexBuffer.data.length,h,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?s.drawArraysInstanced(t,i,e||a.getSize(),n||1):s.drawArrays(t,i,e||a.getSize());return this},r.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},r.prototype.destroy=function(){this.renderer=null},r}(),pn=function(){function r(t){t===void 0&&(t=null),this.type=O.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=x.FILTER_MULTISAMPLE,this.enabled=!0,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._target=null}return Object.defineProperty(r.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null},enumerable:!1,configurable:!0}),r.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=O.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},r.prototype.copyCountersOrReset=function(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},r}();function Cr(r,t,e){var i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Ar(r,t){var e=r.getShaderSource(t).split(`
`).map(function(u,l){return l+": "+u}),i=r.getShaderInfoLog(t),n=i.split(`
`),s={},a=n.map(function(u){return parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(u){return u&&!s[u]?(s[u]=!0,!0):!1}),o=[""];a.forEach(function(u){e[u-1]="%c"+e[u-1]+"%c",o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var h=e.join(`
`);o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,o),console.groupEnd()}function vn(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Ar(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||Ar(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function Qt(r){for(var t=new Array(r),e=0;e<t.length;e++)t[e]=!1;return t}function ui(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Qt(2*t);case"bvec3":return Qt(3*t);case"bvec4":return Qt(4*t);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 li={},vt=li;function mn(){if(vt===li||vt&&vt.isContextLost()){var r=document.createElement("canvas"),t=void 0;x.PREFER_ENV>=J.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),vt=t}return vt}var St;function _n(){if(!St){St=D.MEDIUM;var r=mn();if(r&&r.getShaderPrecisionFormat){var t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);St=t.precision?D.HIGH:D.MEDIUM}}return St}function Pr(r,t,e){if(r.substring(0,9)!=="precision"){var i=t;return t===D.HIGH&&e!==D.HIGH&&(i=D.MEDIUM),"precision "+i+` float;
`+r}else if(e!==D.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var yn={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 fi(r){return yn[r]}var Gt=null,Ur={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 ci(r,t){if(!Gt){var e=Object.keys(Ur);Gt={};for(var i=0;i<e.length;++i){var n=e[i];Gt[r[n]]=Ur[n]}}return Gt[t]}var pt=[{test:function(r){return r.type==="float"&&r.size===1},code:function(r){return`
if(uv["`+r+'"] !== ud["'+r+`"].value)
{
ud["`+r+'"].value = uv["'+r+`"]
gl.uniform1f(ud["`+r+'"].location, uv["'+r+`"])
}
`}},{test:function(r){return(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray},code:function(r){return`t = syncData.textureCount++;
renderer.texture.bind(uv["`+r+`"], t);
if(ud["`+r+`"].value !== t)
{
ud["`+r+`"].value = t;
gl.uniform1i(ud["`+r+`"].location, t);
; // eslint-disable-line max-len
}`}},{test:function(r,t){return r.type==="mat3"&&r.size===1&&t.a!==void 0},code:function(r){return`
gl.uniformMatrix3fv(ud["`+r+'"].location, false, uv["'+r+`"].toArray(true));
`},codeUbo:function(r){return`
var `+r+"_matrix = uv."+r+`.toArray(true);
data[offset] = `+r+`_matrix[0];
data[offset+1] = `+r+`_matrix[1];
data[offset+2] = `+r+`_matrix[2];
data[offset + 4] = `+r+`_matrix[3];
data[offset + 5] = `+r+`_matrix[4];
data[offset + 6] = `+r+`_matrix[5];
data[offset + 8] = `+r+`_matrix[6];
data[offset + 9] = `+r+`_matrix[7];
data[offset + 10] = `+r+`_matrix[8];
`}},{test:function(r,t){return r.type==="vec2"&&r.size===1&&t.x!==void 0},code:function(r){return`
cv = ud["`+r+`"].value;
v = uv["`+r+`"];
if(cv[0] !== v.x || cv[1] !== v.y)
{
cv[0] = v.x;
cv[1] = v.y;
gl.uniform2f(ud["`+r+`"].location, v.x, v.y);
}`},codeUbo:function(r){return`
v = uv.`+r+`;
data[offset] = v.x;
data[offset+1] = v.y;
`}},{test:function(r){return r.type==="vec2"&&r.size===1},code:function(r){return`
cv = ud["`+r+`"].value;
v = uv["`+r+`"];
if(cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2f(ud["`+r+`"].location, v[0], v[1]);
}
`}},{test:function(r,t){return r.type==="vec4"&&r.size===1&&t.width!==void 0},code:function(r){return`
cv = ud["`+r+`"].value;
v = uv["`+r+`"];
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
{
cv[0] = v.x;
cv[1] = v.y;
cv[2] = v.width;
cv[3] = v.height;
gl.uniform4f(ud["`+r+`"].location, v.x, v.y, v.width, v.height)
}`},codeUbo:function(r){return`
v = uv.`+r+`;
data[offset] = v.x;
data[offset+1] = v.y;
data[offset+2] = v.width;
data[offset+3] = v.height;
`}},{test:function(r){return r.type==="vec4"&&r.size===1},code:function(r){return`
cv = ud["`+r+`"].value;
v = uv["`+r+`"];
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4f(ud["`+r+`"].location, v[0], v[1], v[2], v[3])
}`}}],gn={float:`
if (cv !== v)
{
cu.value = v;
gl.uniform1f(location, v);
}`,vec2:`
if (cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2f(location, v[0], v[1])
}`,vec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3f(location, v[0], v[1], v[2])
}`,vec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
}`,int:`
if (cv !== v)
{
cu.value = v;
gl.uniform1i(location, v);
}`,ivec2:`
if (cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,ivec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,ivec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,uint:`
if (cv !== v)
{
cu.value = v;
gl.uniform1ui(location, v);
}`,uvec2:`
if (cv[0] !== v[0] || cv[1] !== v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2ui(location, v[0], v[1]);
}`,uvec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3ui(location, v[0], v[1], v[2]);
}`,uvec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
}`,bool:`
if (cv !== v)
{
cu.value = v;
gl.uniform1i(location, v);
}`,bvec2:`
if (cv[0] != v[0] || cv[1] != v[1])
{
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,bvec3:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,bvec4:`
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
{
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"gl.uniform1i(location, v)",samplerCube:"gl.uniform1i(location, v)",sampler2DArray:"gl.uniform1i(location, v)"},xn={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 Tn(r,t){var e,i=[`
var v = null;
var cv = null;
var cu = null;
var t = 0;
var gl = renderer.gl;
`];for(var n in r.uniforms){var s=t[n];if(!s){!((e=r.uniforms[n])===null||e===void 0)&&e.group&&(r.uniforms[n].ubo?i.push(`
renderer.shader.syncUniformBufferGroup(uv.`+n+", '"+n+`');
`):i.push(`
renderer.shader.syncUniformGroup(uv.`+n+`, syncData);
`));continue}for(var a=r.uniforms[n],o=!1,h=0;h<pt.length;h++)if(pt[h].test(s,a)){i.push(pt[h].code(n,a)),o=!0;break}if(!o){var u=s.size===1?gn:xn,l=u[s.type].replace("location",'ud["'+n+'"].location');i.push(`
cu = ud["`+n+`"];
cv = cu.value;
v = uv["`+n+`"];
`+l+";")}}return new Function("ud","uv","renderer","syncData",i.join(`
`))}var bn=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
`);function In(r){for(var t="",e=0;e<r;++e)e>0&&(t+=`
else `),e<r-1&&(t+="if(test == "+e+".0){}");return t}function Rn(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var e=t.createShader(t.FRAGMENT_SHADER);;){var i=bn.replace(/%forloop%/gi,In(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var mt;function En(){if(typeof mt=="boolean")return mt;try{var r=new Function("param1","param2","param3","return param1[param2] === param3;");mt=r({a:"b"},"a","b")===!0}catch{mt=!1}return mt}var wn=`varying vec2 vTextureCoord;
uniform sampler2D uSampler;
void main(void){
gl_FragColor *= texture2D(uSampler, vTextureCoord);
}`,Nn=`attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
void main(void){
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
}
`,Cn=0,Bt={},Pe=function(){function r(t,e,i){i===void 0&&(i="pixi-shader"),this.id=Cn++,this.vertexSrc=t||r.defaultVertexSrc,this.fragmentSrc=e||r.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),Bt[i]?(Bt[i]++,i+="-"+Bt[i]):Bt[i]=1,this.vertexSrc="#define SHADER_NAME "+i+`
`+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+i+`
`+this.fragmentSrc,this.vertexSrc=Pr(this.vertexSrc,x.PRECISION_VERTEX,D.HIGH),this.fragmentSrc=Pr(this.fragmentSrc,x.PRECISION_FRAGMENT,_n())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(r,"defaultVertexSrc",{get:function(){return Nn},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentSrc",{get:function(){return wn},enumerable:!1,configurable:!0}),r.from=function(t,e,i){var n=t+e,s=br[n];return s||(br[n]=s=new r(t,e,i)),s},r}(),di=function(){function r(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof dt?this.uniformGroup=e:this.uniformGroup=new dt(e):this.uniformGroup=new dt({})}return r.prototype.checkUniformExists=function(t,e){if(e.uniforms[t])return!0;for(var i in e.uniforms){var n=e.uniforms[i];if(n.group&&this.checkUniformExists(t,n))return!0}return!1},r.prototype.destroy=function(){this.uniformGroup=null},Object.defineProperty(r.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),r.from=function(t,e,i){var n=Pe.from(t,e);return new r(n,i)},r}(),te=0,ee=1,re=2,ie=3,ne=4,se=5,Ue=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<<te)},set:function(t){!!(this.data&1<<te)!==t&&(this.data^=1<<te)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"offsets",{get:function(){return!!(this.data&1<<ee)},set:function(t){!!(this.data&1<<ee)!==t&&(this.data^=1<<ee)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return!!(this.data&1<<re)},set:function(t){!!(this.data&1<<re)!==t&&(this.data^=1<<re)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return!!(this.data&1<<ie)},set:function(t){!!(this.data&1<<ie)!==t&&(this.data^=1<<ie)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return!!(this.data&1<<se)},set:function(t){!!(this.data&1<<se)!==t&&(this.data^=1<<se)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"clockwiseFrontFace",{get:function(){return!!(this.data&1<<ne)},set:function(t){!!(this.data&1<<ne)!==t&&(this.data^=1<<ne)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this.blend=t!==g.NONE,this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(t){this.offsets=!!t,this._polygonOffset=t},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 t=new r;return t.depthTest=!1,t.blend=!0,t},r}(),An=`attribute vec2 aVertexPosition;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
uniform vec4 inputSize;
uniform vec4 outputFrame;
vec4 filterVertexPosition( void )
{
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aVertexPosition * (outputFrame.zw * inputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
}
`,Pn=`varying vec2 vTextureCoord;
uniform sampler2D uSampler;
void main(void){
gl_FragColor = texture2D(uSampler, vTextureCoord);
}
`,Un=function(r){N(t,r);function t(e,i,n){var s=this,a=Pe.from(e||t.defaultVertexSrc,i||t.defaultFragmentSrc);return s=r.call(this,a,n)||this,s.padding=0,s.resolution=x.FILTER_RESOLUTION,s.multisample=x.FILTER_MULTISAMPLE,s.enabled=!0,s.autoFit=!0,s.state=new Ue,s}return t.prototype.apply=function(e,i,n,s,a){e.applyFilter(this,i,n,s)},Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._resolution=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultVertexSrc",{get:function(){return An},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return Pn},enumerable:!1,configurable:!0}),t}(di),Fn=`attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 otherMatrix;
varying vec2 vMaskCoord;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
}
`,Ln=`varying vec2 vMaskCoord;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform sampler2D mask;
uniform float alpha;
uniform float npmAlpha;
uniform vec4 maskClamp;
void main(void)
{
float clip = step(3.5,
step(maskClamp.x, vMaskCoord.x) +
step(maskClamp.y, vMaskCoord.y) +
step(vMaskCoord.x, maskClamp.z) +
step(vMaskCoord.y, maskClamp.w));
vec4 original = texture2D(uSampler, vTextureCoord);
vec4 masky = texture2D(mask, vMaskCoord);
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
original *= (alphaMul * masky.r * alpha * clip);
gl_FragColor = original;
}
`,Fr=new H,On=function(){function r(t,e){this._texture=t,this.mapCoord=new H,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e=="undefined"?.5:e,this.isSimple=!1}return Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._textureID=-1},enumerable:!1,configurable:!0}),r.prototype.multiplyUvs=function(t,e){e===void 0&&(e=t);for(var i=this.mapCoord,n=0;n<t.length;n+=2){var s=t[n],a=t[n+1];e[n]=s*i.a+a*i.c+i.tx,e[n+1]=s*i.b+a*i.d+i.ty}return e},r.prototype.update=function(t){var e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;var i=e._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=e.orig,s=e.trim;s&&(Fr.set(n.width/s.width,0,0,n.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Fr));var a=e.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,u=this.clampOffset;return o[0]=(e._frame.x+h+u)/a.width,o[1]=(e._frame.y+h+u)/a.height,o[2]=(e._frame.x+e._frame.width-h+u)/a.width,o[3]=(e._frame.y+e._frame.height-h+u)/a.height,this.uClampOffset[0]=u/a.realWidth,this.uClampOffset[1]=u/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0},r}(),Sn=function(r){N(t,r);function t(e,i,n){var s=this,a=null;return typeof e!="string"&&i===void 0&&n===void 0&&(a=e,e=void 0,i=void 0,n=void 0),s=r.call(this,e||Fn,i||Ln,n)||this,s.maskSprite=a,s.maskMatrix=new H,s}return Object.defineProperty(t.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),t.prototype.apply=function(e,i,n,s){var a=this._maskSprite,o=a._texture;!o.valid||(o.uvMatrix||(o.uvMatrix=new On(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,a).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=a.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,e.applyFilter(this,i,n,s))},t}(Un),Gn=function(){function r(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return r.prototype.setMaskStack=function(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)},r.prototype.push=function(t,e){var i=e;if(!i.isMaskData){var n=this.maskDataPool.pop()||new pn;n.pooled=!0,n.maskObject=e,i=n}var s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i.autoDetect&&this.detect(i),i._target=t,i.type!==O.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case O.SCISSOR:this.renderer.scissor.push(i);break;case O.STENCIL:this.renderer.stencil.push(i);break;case O.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break}i.type===O.SPRITE&&this.maskStack.push(i)},r.prototype.pop=function(t){var e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case O.SCISSOR:this.renderer.scissor.pop();break;case O.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case O.SPRITE:this.popSpriteMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){var i=this.maskStack[this.maskStack.length-1];i.type===O.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}},r.prototype.detect=function(t){var e=t.maskObject;e.isSprite?t.type=O.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=O.SCISSOR:t.type=O.STENCIL},r.prototype.pushSpriteMask=function(t){var e,i,n=t.maskObject,s=t._target,a=t._filters;a||(a=this.alphaMaskPool[this.alphaMaskIndex],a||(a=this.alphaMaskPool[this.alphaMaskIndex]=[new Sn]));var o=this.renderer,h=o.renderTexture,u,l;if(h.current){var f=h.current;u=t.resolution||f.resolution,l=(e=t.multisample)!==null&&e!==void 0?e:f.multisample}else u=t.resolution||o.resolution,l=(i=t.multisample)!==null&&i!==void 0?i:o.multisample;a[0].resolution=u,a[0].multisample=l,a[0].maskSprite=n;var c=s.filterArea;s.filterArea=n.getBounds(!0),o.filter.push(s,a),s.filterArea=c,t._filters||this.alphaMaskIndex++},r.prototype.popSpriteMask=function(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},r.prototype.destroy=function(){this.renderer=null},r}(),pi=function(){function r(t){this.renderer=t,this.maskStack=[],this.glConst=0}return r.prototype.getStackLength=function(){return this.maskStack.length},r.prototype.setMaskStack=function(t){var e=this.renderer.gl,i=this.getStackLength();this.maskStack=t;var n=this.getStackLength();n!==i&&(n===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},r.prototype._useCurrent=function(){},r.prototype.destroy=function(){this.renderer=null,this.maskStack=null},r}(),Lr=new H,Bn=function(r){N(t,r);function t(e){var i=r.call(this,e)||this;return i.glConst=WebGLRenderingContext.SCISSOR_TEST,i}return t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0},t.prototype.calcScissorRect=function(e){if(!e._scissorRectLocal){var i=e._scissorRect,n=e.maskObject,s=this.renderer,a=s.renderTexture;n.renderable=!0;var o=n.getBounds();this.roundFrameToPixels(o,a.current?a.current.resolution:s.resolution,a.sourceFrame,a.destinationFrame,s.projection.transform),n.renderable=!1,i&&o.fit(i),e._scissorRectLocal=o}},t.isMatrixRotated=function(e){if(!e)return!1;var i=e.a,n=e.b,s=e.c,a=e.d;return(Math.abs(n)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(i)>1e-4||Math.abs(a)>1e-4)},t.prototype.testScissor=function(e){var i=e.maskObject;if(!i.isFastRect||!i.isFastRect()||t.isMatrixRotated(i.worldTransform)||t.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);var n=e._scissorRectLocal;return n.width>0&&n.height>0},t.prototype.roundFrameToPixels=function(e,i,n,s,a){t.isMatrixRotated(a)||(a=a?Lr.copyFrom(a):Lr.identity(),a.translate(-n.x,-n.y).scale(s.width/n.width,s.height/n.height).translate(s.x,s.y),this.renderer.filter.transformAABB(a,e),e.fit(s),e.x=Math.round(e.x*i),e.y=Math.round(e.y*i),e.width=Math.round(e.width*i),e.height=Math.round(e.height*i))},t.prototype.push=function(e){e._scissorRectLocal||this.calcScissorRect(e);var i=this.renderer.gl;e._scissorRect||i.enable(i.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()},t.prototype.pop=function(){var e=this.renderer.gl;this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)},t.prototype._useCurrent=function(){var e=this.maskStack[this.maskStack.length-1]._scissorRect,i;this.renderer.renderTexture.current?i=e.y:i=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,i,e.width,e.height)},t}(pi),Mn=function(r){N(t,r);function t(e){var i=r.call(this,e)||this;return i.glConst=WebGLRenderingContext.STENCIL_TEST,i}return t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0},t.prototype.push=function(e){var i=e.maskObject,n=this.renderer.gl,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),n.clearStencil(0),n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST)),e._stencilCounter++,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,this._useCurrent()},t.prototype.pop=function(e){var i=this.renderer.gl;this.getStackLength()===0?i.disable(i.STENCIL_TEST):(i.colorMask(!1,!1,!1,!1),i.stencilOp(i.KEEP,i.KEEP,i.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent())},t.prototype._useCurrent=function(){var e=this.renderer.gl;e.colorMask(!0,!0,!0,!0),e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)},t}(pi),kn=function(){function r(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new H,this.transform=null}return r.prototype.update=function(t,e,i,n){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,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(t,e,i,n){var s=this.projectionMatrix,a=n?-1:1;s.identity(),s.a=1/e.width*2,s.d=a*(1/e.height*2),s.tx=-1-e.x*s.a,s.ty=-a-e.y*s.d},r.prototype.setTransform=function(t){},r.prototype.destroy=function(){this.renderer=null},r}(),it=new U,_t=new U,Xn=function(){function r(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new U,this.destinationFrame=new U,this.viewportFrame=new U}return r.prototype.bind=function(t,e,i){t===void 0&&(t=null);var n=this.renderer;this.current=t;var s,a,o;t?(s=t.baseTexture,o=s.resolution,e||(it.width=t.frame.width,it.height=t.frame.height,e=it),i||(_t.x=t.frame.x,_t.y=t.frame.y,_t.width=e.width,_t.height=e.height,i=_t),a=s.framebuffer):(o=n.resolution,e||(it.width=n.screen.width,it.height=n.screen.height,e=it),i||(i=it,i.width=e.width,i.height=e.height));var h=this.viewportFrame;h.x=i.x*o,h.y=i.y*o,h.width=i.width*o,h.height=i.height*o,t||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(i,e,o,!a),t?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)},r.prototype.clear=function(t,e){this.current?t=t||this.current.baseTexture.clearColor:t=t||this.clearColor;var i=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer.screen,s=i.width!==n.width||i.height!==n.height;if(s){var a=this.viewportFrame,o=a.x,h=a.y,u=a.width,l=a.height;o=Math.round(o),h=Math.round(h),u=Math.round(u),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(o,h,u,l)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),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 Hn(r,t,e,i,n){e.buffer.update(n)}var Vn={float:`
data[offset] = v;
`,vec2:`
data[offset] = v[0];
data[offset+1] = v[1];
`,vec3:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+2] = v[2];
`,vec4:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+2] = v[2];
data[offset+3] = v[3];
`,mat2:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+4] = v[2];
data[offset+5] = v[3];
`,mat3:`
data[offset] = v[0];
data[offset+1] = v[1];
data[offset+2] = v[2];
data[offset + 4] = v[3];
data[offset + 5] = v[4];
data[offset + 6] = v[5];
data[offset + 8] = v[6];
data[offset + 9] = v[7];
data[offset + 10] = v[8];
`,mat4:`
for(var i = 0; i < 16; i++)
{
data[offset + i] = v[i];
}
`},vi={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 jn(r){for(var t=r.map(function(h){return{data:h,offset:0,dataLen:0,dirty:0}}),e=0,i=0,n=0,s=0;s<t.length;s++){var a=t[s];if(e=vi[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,i%e!==0&&i<16){var o=i%e%16;i+=o,n+=o}i+e>16?(n=Math.ceil(n/16)*16,a.offset=n,n+=e,i=e):(a.offset=n,i+=e,n+=e)}return n=Math.ceil(n/16)*16,{uboElements:t,size:n}}function Dn(r,t){var e=[];for(var i in r)t[i]&&e.push(t[i]);return e.sort(function(n,s){return n.index-s.index}),e}function zn(r,t){if(!r.autoManage)return{size:0,syncFunc:Hn};for(var e=Dn(r.uniforms,t),i=jn(e),n=i.uboElements,s=i.size,a=[`
var v = null;
var v2 = null;
var cv = null;
var t = 0;
var gl = renderer.gl
var index = 0;
var data = buffer.data;
`],o=0;o<n.length;o++){for(var h=n[o],u=r.uniforms[h.data.name],l=h.data.name,f=!1,c=0;c<pt.length;c++){var d=pt[c];if(d.codeUbo&&d.test(h.data,u)){a.push("offset = "+h.offset/4+";",pt[c].codeUbo(h.data.name,u)),f=!0;break}}if(!f)if(h.data.size>1){var p=fi(h.data.type),m=Math.max(vi[h.data.type]/16,1),v=p/m,y=(4-v%4)%4;a.push(`
cv = ud.`+l+`.value;
v = uv.`+l+`;
offset = `+h.offset/4+`;
t = 0;
for(var i=0; i < `+h.data.size*m+`; i++)
{
for(var j = 0; j < `+v+`; j++)
{
data[offset++] = v[t++];
}
offset += `+y+`;
}
`)}else{var R=Vn[h.data.type];a.push(`
cv = ud.`+l+`.value;
v = uv.`+l+`;
offset = `+h.offset/4+`;
`+R+`;
`)}}return a.push(`
renderer.buffer.update(buffer);
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",a.join(`
`))}}var Wn=function(){function r(t,e){this.program=t,this.uniformData=e,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 $n(r,t){for(var e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=t.getActiveAttrib(r,n);if(s.name.indexOf("gl_")!==0){var a=ci(t,s.type),o={type:a,name:s.name,size:fi(a),location:t.getAttribLocation(r,s.name)};e[s.name]=o}}return e}function qn(r,t){for(var e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS),n=0;n<i;n++){var s=t.getActiveUniform(r,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),h=ci(t,s.type);e[a]={name:a,index:n,type:h,size:s.size,isArray:o,value:ui(h,s.size)}}return e}function Yn(r,t){var e=Cr(r,r.VERTEX_SHADER,t.vertexSrc),i=Cr(r,r.FRAGMENT_SHADER,t.fragmentSrc),n=r.createProgram();if(r.attachShader(n,e),r.attachShader(n,i),r.linkProgram(n),r.getProgramParameter(n,r.LINK_STATUS)||vn(r,n,e,i),t.attributeData=$n(n,r),t.uniformData=qn(n,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){var s=Object.keys(t.attributeData);s.sort(function(l,f){return l>f?1:-1});for(var a=0;a<s.length;a++)t.attributeData[s[a]].location=a,r.bindAttribLocation(n,a,s[a]);r.linkProgram(n)}r.deleteShader(e),r.deleteShader(i);var o={};for(var a in t.uniformData){var h=t.uniformData[a];o[a]={location:r.getUniformLocation(n,a),value:ui(h.type,h.size)}}var u=new Wn(n,o);return u}var Kn=0,Mt={textureCount:0,uboCount:0},Zn=function(){function r(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Kn++}return r.prototype.systemCheck=function(){if(!En())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},r.prototype.contextChange=function(t){this.gl=t,this.reset()},r.prototype.bind=function(t,e){t.uniforms.globals=this.renderer.globalUniforms;var i=t.program,n=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(n.program)),e||(Mt.textureCount=0,Mt.uboCount=0,this.syncUniformGroup(t.uniformGroup,Mt)),n},r.prototype.setUniforms=function(t){var e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)},r.prototype.syncUniformGroup=function(t,e){var i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))},r.prototype.syncUniforms=function(t,e,i){var n=t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t);n(e.uniformData,t.uniforms,this.renderer,i)},r.prototype.createSyncGroups=function(t){var e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Tn(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]},r.prototype.syncUniformBufferGroup=function(t,e){var i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;var n=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),n(i.uniformData,t.uniforms,this.renderer,Mt,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])},r.prototype.createSyncBufferGroup=function(t,e,i){var n=this.renderer.gl;this.renderer.buffer.bind(t.buffer);var s=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,n.uniformBlockBinding(e.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;var a=this.getSignature(t,this.shader.program.uniformData,"ubo"),o=this._uboCache[a];if(o||(o=this._uboCache[a]=zn(t,this.shader.program.uniformData)),t.autoManage){var h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]},r.prototype.getSignature=function(t,e,i){var n=t.uniforms,s=[i+"-"];for(var a in n)s.push(a),e[a]&&s.push(e[a].type);return s.join("-")},r.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},r.prototype.generateProgram=function(t){var e=this.gl,i=t.program,n=Yn(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=n,n},r.prototype.reset=function(){this.program=null,this.shader=null},r.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},r}();function Jn(r,t){return t===void 0&&(t=[]),t[g.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.ADD]=[r.ONE,r.ONE],t[g.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.NONE]=[0,0],t[g.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[g.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[g.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[g.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[g.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[g.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[g.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[g.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[g.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[g.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[g.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var Qn=0,ts=1,es=2,rs=3,is=4,ns=5,ss=function(){function r(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=g.NONE,this._blendEq=!1,this.map=[],this.map[Qn]=this.setBlend,this.map[ts]=this.setOffset,this.map[es]=this.setCullFace,this.map[rs]=this.setDepthTest,this.map[is]=this.setFrontFace,this.map[ns]=this.setDepthMask,this.checks=[],this.defaultState=new Ue,this.defaultState.blend=!0}return r.prototype.contextChange=function(t){this.gl=t,this.blendModes=Jn(t),this.set(this.defaultState),this.reset()},r.prototype.set=function(t){if(t=t||this.defaultState,this.stateId!==t.data){for(var e=this.stateId^t.data,i=0;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(var i=0;i<this.checks.length;i++)this.checks[i](this,t)},r.prototype.forceState=function(t){t=t||this.defaultState;for(var e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(var e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data},r.prototype.setBlend=function(t){this.updateCheck(r.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)},r.prototype.setOffset=function(t){this.updateCheck(r.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},r.prototype.setDepthTest=function(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)},r.prototype.setDepthMask=function(t){this.gl.depthMask(t)},r.prototype.setCullFace=function(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)},r.prototype.setFrontFace=function(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])},r.prototype.setBlendMode=function(t){if(t!==this.blendMode){this.blendMode=t;var e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}},r.prototype.setPolygonOffset=function(t,e){this.gl.polygonOffset(t,e)},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(t,e){var i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)},r.checkBlendMode=function(t,e){t.setBlendMode(e.blendMode)},r.checkPolygonOffset=function(t,e){t.setPolygonOffset(1,e.polygonOffset)},r.prototype.destroy=function(){this.gl=null},r}(),as=function(){function r(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=x.GC_MAX_IDLE,this.checkCountMax=x.GC_MAX_CHECK_COUNT,this.mode=x.GC_MODE}return r.prototype.postrender=function(){!this.renderer.renderingToScreen||(this.count++,this.mode!==me.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,i=!1,n=0;n<e.length;n++){var s=e[n];!s.framebuffer&&this.count-s.touched>this.maxIdle&&(t.destroyTexture(s,!0),e[n]=null,i=!0)}if(i){for(var a=0,n=0;n<e.length;n++)e[n]!==null&&(e[a++]=e[n]);e.length=a}},r.prototype.unload=function(t){var e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(var n=t.children.length-1;n>=0;n--)this.unload(t.children[n])},r.prototype.destroy=function(){this.renderer=null},r}();function os(r){var t,e,i,n,s,a,o,h,u,l,f,c,d,p,m,v,y,R,C,M,k,B,T;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?T=(t={},t[I.UNSIGNED_BYTE]=(e={},e[_.RGBA]=r.RGBA8,e[_.RGB]=r.RGB8,e[_.RG]=r.RG8,e[_.RED]=r.R8,e[_.RGBA_INTEGER]=r.RGBA8UI,e[_.RGB_INTEGER]=r.RGB8UI,e[_.RG_INTEGER]=r.RG8UI,e[_.RED_INTEGER]=r.R8UI,e[_.ALPHA]=r.ALPHA,e[_.LUMINANCE]=r.LUMINANCE,e[_.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,e),t[I.BYTE]=(i={},i[_.RGBA]=r.RGBA8_SNORM,i[_.RGB]=r.RGB8_SNORM,i[_.RG]=r.RG8_SNORM,i[_.RED]=r.R8_SNORM,i[_.RGBA_INTEGER]=r.RGBA8I,i[_.RGB_INTEGER]=r.RGB8I,i[_.RG_INTEGER]=r.RG8I,i[_.RED_INTEGER]=r.R8I,i),t[I.UNSIGNED_SHORT]=(n={},n[_.RGBA_INTEGER]=r.RGBA16UI,n[_.RGB_INTEGER]=r.RGB16UI,n[_.RG_INTEGER]=r.RG16UI,n[_.RED_INTEGER]=r.R16UI,n[_.DEPTH_COMPONENT]=r.DEPTH_COMPONENT16,n),t[I.SHORT]=(s={},s[_.RGBA_INTEGER]=r.RGBA16I,s[_.RGB_INTEGER]=r.RGB16I,s[_.RG_INTEGER]=r.RG16I,s[_.RED_INTEGER]=r.R16I,s),t[I.UNSIGNED_INT]=(a={},a[_.RGBA_INTEGER]=r.RGBA32UI,a[_.RGB_INTEGER]=r.RGB32UI,a[_.RG_INTEGER]=r.RG32UI,a[_.RED_INTEGER]=r.R32UI,a[_.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,a),t[I.INT]=(o={},o[_.RGBA_INTEGER]=r.RGBA32I,o[_.RGB_INTEGER]=r.RGB32I,o[_.RG_INTEGER]=r.RG32I,o[_.RED_INTEGER]=r.R32I,o),t[I.FLOAT]=(h={},h[_.RGBA]=r.RGBA32F,h[_.RGB]=r.RGB32F,h[_.RG]=r.RG32F,h[_.RED]=r.R32F,h[_.DEPTH_COMPONENT]=r.DEPTH_COMPONENT32F,h),t[I.HALF_FLOAT]=(u={},u[_.RGBA]=r.RGBA16F,u[_.RGB]=r.RGB16F,u[_.RG]=r.RG16F,u[_.RED]=r.R16F,u),t[I.UNSIGNED_SHORT_5_6_5]=(l={},l[_.RGB]=r.RGB565,l),t[I.UNSIGNED_SHORT_4_4_4_4]=(f={},f[_.RGBA]=r.RGBA4,f),t[I.UNSIGNED_SHORT_5_5_5_1]=(c={},c[_.RGBA]=r.RGB5_A1,c),t[I.UNSIGNED_INT_2_10_10_10_REV]=(d={},d[_.RGBA]=r.RGB10_A2,d[_.RGBA_INTEGER]=r.RGB10_A2UI,d),t[I.UNSIGNED_INT_10F_11F_11F_REV]=(p={},p[_.RGB]=r.R11F_G11F_B10F,p),t[I.UNSIGNED_INT_5_9_9_9_REV]=(m={},m[_.RGB]=r.RGB9_E5,m),t[I.UNSIGNED_INT_24_8]=(v={},v[_.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,v),t[I.FLOAT_32_UNSIGNED_INT_24_8_REV]=(y={},y[_.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,y),t):T=(R={},R[I.UNSIGNED_BYTE]=(C={},C[_.RGBA]=r.RGBA,C[_.RGB]=r.RGB,C[_.ALPHA]=r.ALPHA,C[_.LUMINANCE]=r.LUMINANCE,C[_.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,C),R[I.UNSIGNED_SHORT_5_6_5]=(M={},M[_.RGB]=r.RGB,M),R[I.UNSIGNED_SHORT_4_4_4_4]=(k={},k[_.RGBA]=r.RGBA,k),R[I.UNSIGNED_SHORT_5_5_5_1]=(B={},B[_.RGBA]=r.RGBA,B),R),T}var ae=function(){function r(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=I.UNSIGNED_BYTE,this.internalFormat=_.RGBA,this.samplerType=0}return r}(),hs=function(){function r(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new L,this.hasIntegerTextures=!1}return r.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=os(t);var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};var n=new ae(t.createTexture());t.bindTexture(t.TEXTURE_2D,n.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=n,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new ae(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(var i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(var i=0;i<this.boundTextures.length;i++)this.bind(null,i)},r.prototype.bind=function(t,e){e===void 0&&(e=0);var i=this.gl;if(t=t==null?void 0:t.castToBaseTexture(),t&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;var n=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,n.texture)),n.dirtyId!==t.dirtyId&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null},r.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture},r.prototype.unbind=function(t){var e=this,i=e.gl,n=e.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]===t&&(this.currentLocation!==s&&(i.activeTexture(i.TEXTURE0+s),this.currentLocation=s),i.bindTexture(t.target,this.emptyTextures[t.target].texture),n[s]=null)},r.prototype.ensureSamplerType=function(t){var e=this,i=e.boundTextures,n=e.hasIntegerTextures,s=e.CONTEXT_UID;if(!!n)for(var a=t-1;a>=0;--a){var o=i[a];if(o){var h=o._glTextures[s];h.samplerType!==Vt.FLOAT&&this.renderer.texture.unbind(o)}}},r.prototype.initTexture=function(t){var e=new ae(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},r.prototype.initTextureType=function(t,e){var i,n;e.internalFormat=(n=(i=this.internalFormats[t.type])===null||i===void 0?void 0:i[t.format])!==null&&n!==void 0?n:t.format,this.webGLVersion===2&&t.type===I.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type},r.prototype.updateTexture=function(t){var e=t._glTextures[this.CONTEXT_UID];if(!!e){var i=this.renderer;if(this.initTextureType(t,e),t.resource&&t.resource.upload(i,t,e))e.samplerType!==Vt.FLOAT&&(this.hasIntegerTextures=!0);else{var n=t.realWidth,s=t.realHeight,a=i.gl;(e.width!==n||e.height!==s||e.dirtyId<0)&&(e.width=n,e.height=s,a.texImage2D(t.target,0,e.internalFormat,n,s,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}},r.prototype.destroyTexture=function(t,e){var i=this.gl;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){var n=this.managedTextures.indexOf(t);n!==-1&&Xt(this.managedTextures,n,1)}},r.prototype.updateTextureStyle=function(t){var e=t._glTextures[this.CONTEXT_UID];!e||((t.mipmap===ft.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ve.CLAMP:e.wrapMode=t.wrapMode,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},r.prototype.setStyle=function(t,e){var i=this.gl;if(e.mipmap&&t.mipmap!==ft.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Y.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&t.anisotropicLevel>0&&t.scaleMode===Y.LINEAR){var s=Math.min(t.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,n.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Y.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Y.LINEAR?i.LINEAR:i.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),oe=new H,us=function(r){N(t,r);function t(e,i){e===void 0&&(e=Tt.UNKNOWN);var n=r.call(this)||this;return i=Object.assign({},x.RENDER_OPTIONS,i),n.options=i,n.type=e,n.screen=new U(0,0,i.width,i.height),n.view=i.view||document.createElement("canvas"),n.resolution=i.resolution||x.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&&(Rt("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 t.prototype.initPlugins=function(e){for(var i in e)this.plugins[i]=new e[i](this)},Object.defineProperty(t.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,i){this.view.width=Math.round(e*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)},t.prototype.generateTexture=function(e,i,n,s){i===void 0&&(i={}),typeof i=="number"&&(Rt("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),i={scaleMode:i,resolution:n,region:s});var a=i.region,o=Vi(i,["region"]);s=a||e.getLocalBounds(null,!0),s.width===0&&(s.width=1),s.height===0&&(s.height=1);var h=Ce.create(Te({width:s.width,height:s.height},o));return oe.tx=-s.x,oe.ty=-s.y,this.render(e,{renderTexture:h,clear:!1,transform:oe,skipUpdateTransform:!!e.parent}),h},t.prototype.destroy=function(e){for(var i in this.plugins)this.plugins[i].destroy(),this.plugins[i]=null;e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var n=this;n.plugins=null,n.type=Tt.UNKNOWN,n.view=null,n.screen=null,n._tempDisplayObjectParent=null,n.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._backgroundColorString=Ui(e),Pi(e,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(e){this._backgroundColorRgba[3]=e},enumerable:!1,configurable:!0}),t}(Wt),ls=function(){function r(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),fs=function(){function r(t){this.renderer=t,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(t){var e=this,i=e.gl,n=e.CONTEXT_UID,s=t._glBuffers[n]||this.createGLBuffer(t);i.bindBuffer(t.type,s.buffer)},r.prototype.bindBufferBase=function(t,e){var i=this,n=i.gl,s=i.CONTEXT_UID;if(this.boundBufferBases[e]!==t){var a=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,n.bindBufferBase(n.UNIFORM_BUFFER,e,a.buffer)}},r.prototype.bindBufferRange=function(t,e,i){var n=this,s=n.gl,a=n.CONTEXT_UID;i=i||0;var o=t._glBuffers[a]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)},r.prototype.update=function(t){var e=this,i=e.gl,n=e.CONTEXT_UID,s=t._glBuffers[n];if(t._updateID!==s.updateID)if(s.updateID=t._updateID,i.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)i.bufferSubData(t.type,0,t.data);else{var a=t.static?i.STATIC_DRAW:i.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,i.bufferData(t.type,t.data,a)}},r.prototype.dispose=function(t,e){if(!!this.managedBuffers[t.id]){delete this.managedBuffers[t.id];var i=t._glBuffers[this.CONTEXT_UID],n=this.gl;t.disposeRunner.remove(this),i&&(e||n.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}},r.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedBuffers),i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)},r.prototype.createGLBuffer=function(t){var e=this,i=e.CONTEXT_UID,n=e.gl;return t._glBuffers[i]=new ls(n.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[i]},r}(),cs=function(r){N(t,r);function t(e){var i=r.call(this,Tt.WEBGL,e)||this;return e=i.options,i.gl=null,i.CONTEXT_UID=0,i.runners={destroy:new S("destroy"),contextChange:new S("contextChange"),reset:new S("reset"),update:new S("update"),postrender:new S("postrender"),prerender:new S("prerender"),resize:new S("resize")},i.runners.contextChange.add(i),i.globalUniforms=new dt({projectionMatrix:new H},!0),i.addSystem(Gn,"mask").addSystem(un,"context").addSystem(ss,"state").addSystem(Zn,"shader").addSystem(hs,"texture").addSystem(fs,"buffer").addSystem(dn,"geometry").addSystem(cn,"framebuffer").addSystem(Bn,"scissor").addSystem(Mn,"stencil").addSystem(kn,"projection").addSystem(as,"textureGC").addSystem(on,"filter").addSystem(Xn,"renderTexture").addSystem(hn,"batch"),i.initPlugins(t.__plugins),i.multisample=void 0,e.context?i.context.initFromContext(e.context):i.context.initFromOptions({alpha:!!i.useContextAlpha,antialias:e.antialias,premultipliedAlpha:i.useContextAlpha&&i.useContextAlpha!=="notMultiplied",stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:i.options.powerPreference}),i.renderingToScreen=!0,Ci(i.context.webGLVersion===2?"WebGL 2":"WebGL 1"),i.resize(i.options.width,i.options.height),i}return t.create=function(e){if(Ai())return new t(e);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},t.prototype.contextChange=function(){var e=this.gl,i;if(this.context.webGLVersion===1){var n=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),i=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,n)}else{var n=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),i=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,n)}i>=F.HIGH?this.multisample=F.HIGH:i>=F.MEDIUM?this.multisample=F.MEDIUM:i>=F.LOW?this.multisample=F.LOW:this.multisample=F.NONE},t.prototype.addSystem=function(e,i){var n=new e(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},t.prototype.render=function(e,i){var n,s,a,o;if(i&&(i instanceof Ce?(Rt("6.0.0","Renderer#render arguments changed, use options instead."),n=i,s=arguments[2],a=arguments[3],o=arguments[4]):(n=i.renderTexture,s=i.clear,a=i.transform,o=i.skipUpdateTransform)),this.renderingToScreen=!n,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=a,!this.context.isLost){if(n||(this._lastObjectRendered=e),!o){var h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}this.renderTexture.bind(n),this.batch.currentRenderer.start(),(s!==void 0?s:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),n&&n.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},t.prototype.generateTexture=function(e,i,n,s){i===void 0&&(i={});var a=r.prototype.generateTexture.call(this,e,i,n,s);return this.framebuffer.blit(),a},t.prototype.resize=function(e,i){r.prototype.resize.call(this,e,i),this.runners.resize.emit(this.screen.height,this.screen.width)},t.prototype.reset=function(){return this.runners.reset.emit(),this},t.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},t.prototype.destroy=function(e){this.runners.destroy.emit();for(var i in this.runners)this.runners[i].destroy();r.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(t.prototype,"extract",{get:function(){return Rt("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),t.registerPlugin=function(e,i){t.__plugins=t.__plugins||{},t.__plugins[e]=i},t}(us);function ds(r){return cs.create(r)}var ps=function(){function r(){this.texArray=null,this.blend=0,this.type=bt.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),vs=function(){function r(){this.elements=[],this.ids=[],this.count=0}return r.prototype.clear=function(){for(var t=0;t<this.count;t++)this.elements[t]=null;this.count=0},r}(),ms=function(){function r(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}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(t){return this[t+"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(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(t+" isn't a valid view type")}},r}(),_s=function(r){N(t,r);function t(e){var i=r.call(this,e)||this;return i.shaderGenerator=null,i.geometryClass=null,i.vertexSize=null,i.state=Ue.for2d(),i.size=x.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),e.runners.contextChange.add(i),i._dcIndex=0,i._aIndex=0,i._iIndex=0,i._attributeBuffer=null,i._indexBuffer=null,i._tempBoundTextures=[],i}return t.prototype.contextChange=function(){var e=this.renderer.gl;x.PREFER_ENV===J.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),x.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=Rn(this.MAX_TEXTURES,e)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]=new this.geometryClass;this.initFlushBuffers()},t.prototype.initFlushBuffers=function(){for(var e=t._drawCallPool,i=t._textureArrayPool,n=this.size/4,s=Math.floor(n/this.MAX_TEXTURES)+1;e.length<n;)e.push(new ps);for(;i.length<s;)i.push(new vs);for(var a=0;a<this.MAX_TEXTURES;a++)this._tempBoundTextures[a]=null},t.prototype.onPrerender=function(){this._flushId=0},t.prototype.render=function(e){!e._texture.valid||(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},t.prototype.buildTexturesAndDrawCalls=function(){var e=this,i=e._bufferedTextures,n=e.MAX_TEXTURES,s=t._textureArrayPool,a=this.renderer.batch,o=this._tempBoundTextures,h=this.renderer.textureGC.count,u=++L._globalBatch,l=0,f=s[0],c=0;a.copyBoundTextures(o,n);for(var d=0;d<this._bufferSize;++d){var p=i[d];i[d]=null,p._batchEnabled!==u&&(f.count>=n&&(a.boundArray(f,o,u,n),this.buildDrawCalls(f,c,d),c=d,f=s[++l],++u),p._batchEnabled=u,p.touched=h,f.elements[f.count++]=p)}f.count>0&&(a.boundArray(f,o,u,n),this.buildDrawCalls(f,c,this._bufferSize),++l,++u);for(var d=0;d<o.length;d++)o[d]=null;L._globalBatch=u},t.prototype.buildDrawCalls=function(e,i,n){var s=this,a=s._bufferedElements,o=s._attributeBuffer,h=s._indexBuffer,u=s.vertexSize,l=t._drawCallPool,f=this._dcIndex,c=this._aIndex,d=this._iIndex,p=l[f];p.start=this._iIndex,p.texArray=e;for(var m=i;m<n;++m){var v=a[m],y=v._texture.baseTexture,R=Li[y.alphaMode?1:0][v.blendMode];a[m]=null,i<m&&p.blend!==R&&(p.size=d-p.start,i=m,p=l[++f],p.texArray=e,p.start=d),this.packInterleavedGeometry(v,o,h,c,d),c+=v.vertexData.length/2*u,d+=v.indices.length,p.blend=R}i<n&&(p.size=d-p.start,++f),this._dcIndex=f,this._aIndex=c,this._iIndex=d},t.prototype.bindAndClearTexArray=function(e){for(var i=this.renderer.texture,n=0;n<e.count;n++)i.bind(e.elements[n],e.ids[n]),e.elements[n]=null;e.count=0},t.prototype.updateGeometry=function(){var e=this,i=e._packedGeometries,n=e._attributeBuffer,s=e._indexBuffer;x.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++)},t.prototype.drawBatches=function(){for(var e=this._dcIndex,i=this.renderer,n=i.gl,s=i.state,a=t._drawCallPool,o=null,h=0;h<e;h++){var u=a[h],l=u.texArray,f=u.type,c=u.size,d=u.start,p=u.blend;o!==l&&(o=l,this.bindAndClearTexArray(l)),this.state.blendMode=p,s.set(this.state),n.drawElements(f,c,n.UNSIGNED_SHORT,d*2)}},t.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)},t.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),x.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},t.prototype.stop=function(){this.flush()},t.prototype.destroy=function(){for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].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)},t.prototype.getAttributeBuffer=function(e){var i=jt(Math.ceil(e/8)),n=xr(i),s=i*8;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._aBuffers[s];return a||(this._aBuffers[s]=a=new ms(s*this.vertexSize*4)),a},t.prototype.getIndexBuffer=function(e){var i=jt(Math.ceil(e/12)),n=xr(i),s=i*12;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);var a=this._iBuffers[n];return a||(this._iBuffers[n]=a=new Uint16Array(s)),a},t.prototype.packInterleavedGeometry=function(e,i,n,s,a){for(var o=i.uint32View,h=i.float32View,u=s/this.vertexSize,l=e.uvs,f=e.indices,c=e.vertexData,d=e._texture.baseTexture._batchLocation,p=Math.min(e.worldAlpha,1),m=p<1&&e._texture.baseTexture.alphaMode?Oi(e._tintRGB,p):e._tintRGB+(p*255<<24),v=0;v<c.length;v+=2)h[s++]=c[v],h[s++]=c[v+1],h[s++]=l[v],h[s++]=l[v+1],o[s++]=m,h[s++]=d;for(var v=0;v<f.length;v++)n[a++]=u+f[v]},t._drawCallPool=[],t._textureArrayPool=[],t}(hi),ys=function(){function r(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},e.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(e.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return r.prototype.generateShader=function(t){if(!this.programCache[t]){for(var e=new Int32Array(t),i=0;i<t;i++)e[i]=i;this.defaultGroupCache[t]=dt.from({uSamplers:e},!0);var n=this.fragTemplate;n=n.replace(/%count%/gi,""+t),n=n.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new Pe(this.vertexSrc,n)}var s={tint:new Float32Array([1,1,1,1]),translationMatrix:new H,default:this.defaultGroupCache[t]};return new di(this.programCache[t],s)},r.prototype.generateSampleSrc=function(t){var e="";e+=`
`,e+=`
`;for(var i=0;i<t;i++)i>0&&(e+=`
else `),i<t-1&&(e+="if(vTextureId < "+i+".5)"),e+=`
{`,e+=`
color = texture2D(uSamplers[`+i+"], vTextureCoord);",e+=`
}`;return e+=`
`,e+=`
`,e},r}(),gs=function(r){N(t,r);function t(e){e===void 0&&(e=!1);var i=r.call(this)||this;return i._buffer=new X(null,e,!1),i._indexBuffer=new X(null,e,!0),i.addAttribute("aVertexPosition",i._buffer,2,!1,I.FLOAT).addAttribute("aTextureCoord",i._buffer,2,!1,I.FLOAT).addAttribute("aColor",i._buffer,4,!0,I.UNSIGNED_BYTE).addAttribute("aTextureId",i._buffer,1,!0,I.FLOAT).addIndex(i._indexBuffer),i}return t}(Ae),Or=`precision highp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
attribute vec4 aColor;
attribute float aTextureId;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform vec4 tint;
varying vec2 vTextureCoord;
varying vec4 vColor;
varying float vTextureId;
void main(void){
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vTextureId = aTextureId;
vColor = aColor * tint;
}
`,Sr=`varying vec2 vTextureCoord;
varying vec4 vColor;
varying float vTextureId;
uniform sampler2D uSamplers[%count%];
void main(void){
vec4 color;
%forloop%
gl_FragColor = color * vColor;
}
`,xs=function(){function r(){}return r.create=function(t){var e=Object.assign({vertex:Or,fragment:Sr,geometryClass:gs,vertexSize:6},t),i=e.vertex,n=e.fragment,s=e.vertexSize,a=e.geometryClass;return function(o){N(h,o);function h(u){var l=o.call(this,u)||this;return l.shaderGenerator=new ys(i,n),l.geometryClass=a,l.vertexSize=s,l}return h}(_s)},Object.defineProperty(r,"defaultVertexSrc",{get:function(){return Or},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentTemplate",{get:function(){return Sr},enumerable:!1,configurable:!0}),r}(),js=xs.create();/*!
* @pixi/display - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/display is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/x.SORTABLE_CHILDREN=!1;var Ie=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(t){return this.minX>this.maxX||this.minY>this.maxY?U.EMPTY:(t=t||new U(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},r.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},r.prototype.addPointMatrix=function(t,e){var i=t.a,n=t.b,s=t.c,a=t.d,o=t.tx,h=t.ty,u=i*e.x+s*e.y+o,l=n*e.x+a*e.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(t){var e=this.minX,i=this.minY,n=this.maxX,s=this.maxY,a=t[0],o=t[1];e=a<e?a:e,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=t[2],o=t[3],e=a<e?a:e,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=t[4],o=t[5],e=a<e?a:e,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,a=t[6],o=t[7],e=a<e?a:e,i=o<i?o:i,n=a>n?a:n,s=o>s?o:s,this.minX=e,this.minY=i,this.maxX=n,this.maxY=s},r.prototype.addFrame=function(t,e,i,n,s){this.addFrameMatrix(t.worldTransform,e,i,n,s)},r.prototype.addFrameMatrix=function(t,e,i,n,s){var a=t.a,o=t.b,h=t.c,u=t.d,l=t.tx,f=t.ty,c=this.minX,d=this.minY,p=this.maxX,m=this.maxY,v=a*e+h*i+l,y=o*e+u*i+f;c=v<c?v:c,d=y<d?y:d,p=v>p?v:p,m=y>m?y:m,v=a*n+h*i+l,y=o*n+u*i+f,c=v<c?v:c,d=y<d?y:d,p=v>p?v:p,m=y>m?y:m,v=a*e+h*s+l,y=o*e+u*s+f,c=v<c?v:c,d=y<d?y:d,p=v>p?v:p,m=y>m?y:m,v=a*n+h*s+l,y=o*n+u*s+f,c=v<c?v:c,d=y<d?y:d,p=v>p?v:p,m=y>m?y:m,this.minX=c,this.minY=d,this.maxX=p,this.maxY=m},r.prototype.addVertexData=function(t,e,i){for(var n=this.minX,s=this.minY,a=this.maxX,o=this.maxY,h=e;h<i;h+=2){var u=t[h],l=t[h+1];n=u<n?u:n,s=l<s?l:s,a=u>a?u:a,o=l>o?l:o}this.minX=n,this.minY=s,this.maxX=a,this.maxY=o},r.prototype.addVertices=function(t,e,i,n){this.addVerticesMatrix(t.worldTransform,e,i,n)},r.prototype.addVerticesMatrix=function(t,e,i,n,s,a){s===void 0&&(s=0),a===void 0&&(a=s);for(var o=t.a,h=t.b,u=t.c,l=t.d,f=t.tx,c=t.ty,d=this.minX,p=this.minY,m=this.maxX,v=this.maxY,y=i;y<n;y+=2){var R=e[y],C=e[y+1],M=o*R+u*C+f,k=l*C+h*R+c;d=Math.min(d,M-s),m=Math.max(m,M+s),p=Math.min(p,k-a),v=Math.max(v,k+a)}this.minX=d,this.minY=p,this.maxX=m,this.maxY=v},r.prototype.addBounds=function(t){var e=this.minX,i=this.minY,n=this.maxX,s=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>n?t.maxX:n,this.maxY=t.maxY>s?t.maxY:s},r.prototype.addBoundsMask=function(t,e){var i=t.minX>e.minX?t.minX:e.minX,n=t.minY>e.minY?t.minY:e.minY,s=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},r.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},r.prototype.addBoundsArea=function(t,e){var i=t.minX>e.x?t.minX:e.x,n=t.minY>e.y?t.minY:e.y,s=t.maxX<e.x+e.width?t.maxX:e.x+e.width,a=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=s&&n<=a){var o=this.minX,h=this.minY,u=this.maxX,l=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=s>u?s:u,this.maxY=a>l?a:l}},r.prototype.pad=function(t,e){t===void 0&&(t=0),e===void 0&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},r.prototype.addFramePad=function(t,e,i,n,s,a){t-=s,e-=a,i+=s,n+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>n?this.maxY:n},r}();/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var Re=function(r,t){return Re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n])},Re(r,t)};function Fe(r,t){Re(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Dt=function(r){Fe(t,r);function t(){var e=r.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Hi,e.alpha=1,e.visible=!0,e.renderable=!0,e.cullable=!1,e.cullArea=null,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new Ie,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._maskRefCount=0,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return t.mixin=function(e){for(var i=Object.keys(e),n=0;n<i.length;++n){var s=i[n];Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(e,s))}},Object.defineProperty(t.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),t.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},t.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},t.prototype.getBounds=function(e,i){return e||(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 U),i=this._boundsRect),this._bounds.getRectangle(i)},t.prototype.getLocalBounds=function(e){e||(this._localBoundsRect||(this._localBoundsRect=new U),e=this._localBoundsRect),this._localBounds||(this._localBounds=new Ie);var i=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var s=this._bounds,a=this._boundsID;this._bounds=this._localBounds;var o=this.getBounds(!1,e);return this.parent=n,this.transform=i,this._bounds=s,this._bounds.updateID+=this._boundsID-a,o},t.prototype.toGlobal=function(e,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(e,i)},t.prototype.toLocal=function(e,i,n,s){return i&&(e=i.toGlobal(e,n,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,n)},t.prototype.setParent=function(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e},t.prototype.setTransform=function(e,i,n,s,a,o,h,u,l){return e===void 0&&(e=0),i===void 0&&(i=0),n===void 0&&(n=1),s===void 0&&(s=1),a===void 0&&(a=0),o===void 0&&(o=0),h===void 0&&(h=0),u===void 0&&(u=0),l===void 0&&(l=0),this.position.x=e,this.position.y=i,this.scale.x=n||1,this.scale.y=s||1,this.rotation=a,this.skew.x=o,this.skew.y=h,this.pivot.x=u,this.pivot.y=l,this},t.prototype.destroy=function(e){this.parent&&this.parent.removeChild(this),this.emit("destroyed"),this.removeAllListeners(),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._destroyed=!0},Object.defineProperty(t.prototype,"_tempDisplayObjectParent",{get:function(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Ts),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),t.prototype.enableTempParent=function(){var e=this.parent;return this.parent=this._tempDisplayObjectParent,e},t.prototype.disableTempParent=function(e){this.parent=e},Object.defineProperty(t.prototype,"x",{get:function(){return this.position.x},set:function(e){this.transform.position.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.position.y},set:function(e){this.transform.position.y=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.transform.position},set:function(e){this.transform.position.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this.transform.scale},set:function(e){this.transform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(e){this.transform.pivot.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skew",{get:function(){return this.transform.skew},set:function(e){this.transform.skew.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(e){this.transform.rotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this.transform.rotation*Mi},set:function(e){this.transform.rotation=e*ki},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(e){this._zIndex=e,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldVisible",{get:function(){var e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mask",{get:function(){return this._mask},set:function(e){if(this._mask!==e){if(this._mask){var i=this._mask.maskObject||this._mask;i._maskRefCount--,i._maskRefCount===0&&(i.renderable=!0,i.isMask=!1)}if(this._mask=e,this._mask){var i=this._mask.maskObject||this._mask;i._maskRefCount===0&&(i.renderable=!1,i.isMask=!0),i._maskRefCount++}}},enumerable:!1,configurable:!0}),t}(Wt),Ts=function(r){Fe(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.sortDirty=null,e}return t}(Dt);Dt.prototype.displayObjectUpdateTransform=Dt.prototype.updateTransform;/*!
* @pixi/constants - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/constants is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var Gr;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(Gr||(Gr={}));var Br;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Br||(Br={}));var Mr;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(Mr||(Mr={}));var kr;(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"})(kr||(kr={}));var Xr;(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"})(Xr||(Xr={}));var Hr;(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"})(Hr||(Hr={}));var Vr;(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"})(Vr||(Vr={}));var jr;(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"})(jr||(jr={}));var Dr;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(Dr||(Dr={}));var zr;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(zr||(zr={}));var Wr;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(Wr||(Wr={}));var $r;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})($r||($r={}));var qr;(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"})(qr||(qr={}));var Yr;(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"})(Yr||(Yr={}));var Kr;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(Kr||(Kr={}));var Zr;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(Zr||(Zr={}));var Ee;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE"})(Ee||(Ee={}));var Jr;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(Jr||(Jr={}));var Qr;(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"})(Qr||(Qr={}));function bs(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}var zt=function(r){Fe(t,r);function t(){var e=r.call(this)||this;return e.children=[],e.sortableChildren=x.SORTABLE_CHILDREN,e.sortDirty=!1,e}return t.prototype.onChildrenChange=function(e){},t.prototype.addChild=function(){for(var e=arguments,i=[],n=0;n<arguments.length;n++)i[n]=e[n];if(i.length>1)for(var s=0;s<i.length;s++)this.addChild(i[s]);else{var a=i[0];a.parent&&a.parent.removeChild(a),a.parent=this,this.sortDirty=!0,a.transform._parentID=-1,this.children.push(a),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",a,this,this.children.length-1),a.emit("added",this)}return i[0]},t.prototype.addChildAt=function(e,i){if(i<0||i>this.children.length)throw new Error(e+"addChildAt: The index "+i+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(i,0,e),this._boundsID++,this.onChildrenChange(i),e.emit("added",this),this.emit("childAdded",e,this,i),e},t.prototype.swapChildren=function(e,i){if(e!==i){var n=this.getChildIndex(e),s=this.getChildIndex(i);this.children[n]=i,this.children[s]=e,this.onChildrenChange(n<s?n:s)}},t.prototype.getChildIndex=function(e){var i=this.children.indexOf(e);if(i===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return i},t.prototype.setChildIndex=function(e,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(e);Xt(this.children,n,1),this.children.splice(i,0,e),this.onChildrenChange(i)},t.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},t.prototype.removeChild=function(){for(var e=arguments,i=[],n=0;n<arguments.length;n++)i[n]=e[n];if(i.length>1)for(var s=0;s<i.length;s++)this.removeChild(i[s]);else{var a=i[0],o=this.children.indexOf(a);if(o===-1)return null;a.parent=null,a.transform._parentID=-1,Xt(this.children,o,1),this._boundsID++,this.onChildrenChange(o),a.emit("removed",this),this.emit("childRemoved",a,this,o)}return i[0]},t.prototype.removeChildAt=function(e){var i=this.getChildAt(e);return i.parent=null,i.transform._parentID=-1,Xt(this.children,e,1),this._boundsID++,this.onChildrenChange(e),i.emit("removed",this),this.emit("childRemoved",i,this,e),i},t.prototype.removeChildren=function(e,i){e===void 0&&(e=0),i===void 0&&(i=this.children.length);var n=e,s=i,a=s-n,o;if(a>0&&a<=s){o=this.children.splice(n,a);for(var h=0;h<o.length;++h)o[h].parent=null,o[h].transform&&(o[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(var h=0;h<o.length;++h)o[h].emit("removed",this),this.emit("childRemoved",o[h],this,h);return o}else if(a===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},t.prototype.sortChildren=function(){for(var e=!1,i=0,n=this.children.length;i<n;++i){var s=this.children[i];s._lastSortedIndex=i,!e&&s.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(bs),this.sortDirty=!1},t.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 e=0,i=this.children.length;e<i;++e){var n=this.children[e];n.visible&&n.updateTransform()}},t.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var e=0;e<this.children.length;e++){var i=this.children[e];if(!(!i.visible||!i.renderable))if(i.calculateBounds(),i._mask){var n=i._mask.maskObject||i._mask;n.calculateBounds(),this._bounds.addBoundsMask(i._bounds,n._bounds)}else i.filterArea?this._bounds.addBoundsArea(i._bounds,i.filterArea):this._bounds.addBounds(i._bounds)}this._bounds.updateID=this._boundsID},t.prototype.getLocalBounds=function(e,i){i===void 0&&(i=!1);var n=r.prototype.getLocalBounds.call(this,e);if(!i)for(var s=0,a=this.children.length;s<a;++s){var o=this.children[s];o.visible&&o.updateTransform()}return n},t.prototype._calculateBounds=function(){},t.prototype._renderWithCulling=function(e){var i=e.renderTexture.sourceFrame;if(i.width>0&&i.height>0){var n,s;if(this.cullArea?(n=this.cullArea,s=this.worldTransform):this._render!==t.prototype._render&&(n=this.getBounds(!0)),n&&i.intersects(n,s))this._render(e);else if(this.cullArea)return;for(var a=0,o=this.children.length;a<o;++a){var h=this.children[a],u=h.cullable;h.cullable=u||!this.cullArea,h.render(e),h.cullable=u}}},t.prototype.render=function(e){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(var i=0,n=this.children.length;i<n;++i)this.children[i].render(e)}},t.prototype.renderAdvanced=function(e){var i=this.filters,n=this._mask;if(i){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var s=0;s<i.length;s++)i[s].enabled&&this._enabledFilters.push(i[s])}var a=i&&this._enabledFilters&&this._enabledFilters.length||n&&(!n.isMaskData||n.enabled&&(n.autoDetect||n.type!==Ee.NONE));if(a&&e.batch.flush(),i&&this._enabledFilters&&this._enabledFilters.length&&e.filter.push(this,this._enabledFilters),n&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(var s=0,o=this.children.length;s<o;++s)this.children[s].render(e)}a&&e.batch.flush(),n&&e.mask.pop(this),i&&this._enabledFilters&&this._enabledFilters.length&&e.filter.pop()},t.prototype._render=function(e){},t.prototype.destroy=function(e){r.prototype.destroy.call(this),this.sortDirty=!1;var i=typeof e=="boolean"?e:e&&e.children,n=this.removeChildren(0,this.children.length);if(i)for(var s=0;s<n.length;++s)n[s].destroy(e)},Object.defineProperty(t.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(e){var i=this.getLocalBounds().width;i!==0?this.scale.x=e/i:this.scale.x=1,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(e){var i=this.getLocalBounds().height;i!==0?this.scale.y=e/i:this.scale.y=1,this._height=e},enumerable:!1,configurable:!0}),t}(Dt);zt.prototype.containerUpdateTransform=zt.prototype.updateTransform;/*!
* @pixi/sprite - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/sprite is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*//*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var we=function(r,t){return we=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n])},we(r,t)};function Is(r,t){we(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var yt=new P,Rs=new Uint16Array([0,1,2,0,2,3]),Es=function(r){Is(t,r);function t(e){var i=r.call(this)||this;return i._anchor=new gt(i._onAnchorUpdate,i,e?e.defaultAnchor.x:0,e?e.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=e||K.EMPTY,i.vertexData=new Float32Array(8),i.vertexTrimmedData=null,i._transformID=-1,i._textureID=-1,i._transformTrimmedID=-1,i._textureTrimmedID=-1,i.indices=Rs,i.pluginName="batch",i.isSprite=!0,i._roundPixels=x.ROUND_PIXELS,i}return t.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=At(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=At(this.scale.y)*this._height/this._texture.orig.height)},t.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},t.prototype.calculateVertices=function(){var e=this._texture;if(!(this._transformID===this.transform._worldID&&this._textureID===e._updateID)){this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;var i=this.transform.worldTransform,n=i.a,s=i.b,a=i.c,o=i.d,h=i.tx,u=i.ty,l=this.vertexData,f=e.trim,c=e.orig,d=this._anchor,p=0,m=0,v=0,y=0;if(f?(m=f.x-d._x*c.width,p=m+f.width,y=f.y-d._y*c.height,v=y+f.height):(m=-d._x*c.width,p=m+c.width,y=-d._y*c.height,v=y+c.height),l[0]=n*m+a*y+h,l[1]=o*y+s*m+u,l[2]=n*p+a*y+h,l[3]=o*y+s*p+u,l[4]=n*p+a*v+h,l[5]=o*v+s*p+u,l[6]=n*m+a*v+h,l[7]=o*v+s*m+u,this._roundPixels)for(var R=x.RESOLUTION,C=0;C<l.length;++C)l[C]=Math.round((l[C]*R|0)/R)}},t.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 e=this._texture,i=this.vertexTrimmedData,n=e.orig,s=this._anchor,a=this.transform.worldTransform,o=a.a,h=a.b,u=a.c,l=a.d,f=a.tx,c=a.ty,d=-s._x*n.width,p=d+n.width,m=-s._y*n.height,v=m+n.height;i[0]=o*d+u*m+f,i[1]=l*m+h*d+c,i[2]=o*p+u*m+f,i[3]=l*m+h*p+c,i[4]=o*p+u*v+f,i[5]=l*v+h*p+c,i[6]=o*d+u*v+f,i[7]=l*v+h*d+c},t.prototype._render=function(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)},t.prototype._calculateBounds=function(){var e=this._texture.trim,i=this._texture.orig;!e||e.width===i.width&&e.height===i.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},t.prototype.getLocalBounds=function(e){return this.children.length===0?(this._localBounds||(this._localBounds=new Ie),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),e||(this._localBoundsRect||(this._localBoundsRect=new U),e=this._localBoundsRect),this._localBounds.getRectangle(e)):r.prototype.getLocalBounds.call(this,e)},t.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,yt);var i=this._texture.orig.width,n=this._texture.orig.height,s=-i*this.anchor.x,a=0;return yt.x>=s&&yt.x<s+i&&(a=-n*this.anchor.y,yt.y>=a&&yt.y<a+n)},t.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null;var i=typeof e=="boolean"?e:e&&e.texture;if(i){var n=typeof e=="boolean"?e:e&&e.baseTexture;this._texture.destroy(!!n)}this._texture=null},t.from=function(e,i){var n=e instanceof K?e:K.from(e,i);return new t(n)},Object.defineProperty(t.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(e){var i=At(this.scale.x)||1;this.scale.x=i*e/this._texture.orig.width,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(e){var i=At(this.scale.y)||1;this.scale.y=i*e/this._texture.orig.height,this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"anchor",{get:function(){return this._anchor},set:function(e){this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e,this._tintRGB=(e>>16)+(e&65280)+((e&255)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||K.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),t}(zt);/*!
* @pixi/particle-emitter - v5.0.7
* Compiled Fri, 27 May 2022 02:00:12 UTC
*
* @pixi/particle-emitter is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/class z{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,i?this.ease=typeof i=="function"?i:yi(i):this.ease=null}static createList(t){if("list"in t){const i=t.list;let n;const{value:s,time:a}=i[0],o=n=new z(typeof s=="string"?kt(s):s,a,t.ease);if(i.length>2||i.length===2&&i[1].value!==s)for(let h=1;h<i.length;++h){const{value:u,time:l}=i[h];n.next=new z(typeof u=="string"?kt(u):u,l),n=n.next}return o.isStepped=!!t.isStepped,o}const e=new z(typeof t.start=="string"?kt(t.start):t.start,0);return t.end!==t.start&&(e.next=new z(typeof t.end=="string"?kt(t.end):t.end,1)),e}}let Nt=K.from;const j=Math.PI/180;function Z(r,t){if(!r)return;const e=Math.sin(r),i=Math.cos(r),n=t.x*i-t.y*e,s=t.x*e+t.y*i;t.x=n,t.y=s}function $t(r,t,e){return r<<16|t<<8|e}function mi(r){return Math.sqrt(r.x*r.x+r.y*r.y)}function ws(r){const t=1/mi(r);r.x*=t,r.y*=t}function _i(r,t){r.x*=t,r.y*=t}function kt(r,t){t||(t={}),r.charAt(0)==="#"?r=r.substr(1):r.indexOf("0x")===0&&(r=r.substr(2));let e;return r.length===8&&(e=r.substr(0,2),r=r.substr(2)),t.r=parseInt(r.substr(0,2),16),t.g=parseInt(r.substr(2,2),16),t.b=parseInt(r.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function yi(r){const t=r.length,e=1/t;return function(i){const n=t*i|0,s=(i-n*e)*t,a=r[n]||r[t-1];return a.s+s*(2*(1-s)*(a.cp-a.s)+s*(a.e-a.s))}}function Ns(r){return r?(r=r.toUpperCase().replace(/ /g,"_"),g[r]||g.NORMAL):g.NORMAL}class he extends Es{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}var w;(function(r){r[r.Spawn=0]="Spawn",r[r.Normal=2]="Normal",r[r.Late=5]="Late"})(w||(w={}));const ue=q.shared,nt=Symbol("Position particle per emitter position");class E{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new P,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new P,this._prevEmitterPos=new P,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){E.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:yi(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(i=>{const n=E.knownBehaviors[i.type];return n?new n(i.config):(console.error(`Unknown behavior: ${i.type}`),null)}).filter(i=>!!i);e.push(nt),e.sort((i,n)=>i===nt?n.order===w.Spawn?1:-1:n===nt?i.order===w.Spawn?-1:1:i.order-n.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(i=>i!==nt&&i.updateParticle),this.recycleBehaviors=e.filter(i=>i!==nt&&i.recycleParticle)}getBehavior(t){return E.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof E.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new he(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let i=0;i<this.recycleBehaviors.length;++i)this.recycleBehaviors[i].recycleParticle(t,!e);t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===this._activeParticlesLast&&(this._activeParticlesLast=t.prev),t===this._activeParticlesFirst&&(this._activeParticlesFirst=t.next),t.prev=null,t.next=this._poolFirst,this._poolFirst=t,t.parent&&t.parent.removeChild(t),--this.particleCount}rotate(t){if(this.rotation===t)return;const e=t-this.rotation;this.rotation=t,Z(e,this.spawnPos),this._posChanged=!0}updateSpawnPos(t,e){this._posChanged=!0,this.spawnPos.x=t,this.spawnPos.y=e}updateOwnerPos(t,e){this._posChanged=!0,this.ownerPos.x=t,this.ownerPos.y=e}resetPositionTracking(){this._prevPosIsValid=!1}get emit(){return this._emit}set emit(t){this._emit=!!t,this._emitterLife=this.emitterLifetime}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){this._autoUpdate&&!t?ue.remove(this.update,this):!this._autoUpdate&&t&&ue.add(this.update,this),this._autoUpdate=!!t}playOnceAndDestroy(t){this.autoUpdate=!0,this.emit=!0,this._destroyWhenComplete=!0,this._completeCallback=t}playOnce(t){this.emit=!0,this._completeCallback=t}update(t){if(this._autoUpdate&&(t=ue.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,o;a;a=o)if(o=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let h=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?h=this.customEase(h,0,1,1):h=this.customEase(h)),a.agePercent=h;for(let u=0;u<this.updateBehaviors.length;++u)if(this.updateBehaviors[u].updateParticle(a,t)){this.recycle(a);break}}let e,i;this._prevPosIsValid&&(e=this._prevEmitterPos.x,i=this._prevEmitterPos.y);const n=this.ownerPos.x+this.spawnPos.x,s=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,o;if(this._prevPosIsValid&&this._posChanged){const l=1+this._spawnTimer/t;a=(n-e)*l+e,o=(s-i)*l+i}else a=n,o=s;let h=null,u=null;for(let l=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),f=0;f<l;++f){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let c;if(this.minLifetime===this.maxLifetime?c=this.minLifetime:c=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=c)continue;let d;this._poolFirst?(d=this._poolFirst,this._poolFirst=this._poolFirst.next,d.next=null):d=new he(this),d.init(c),this.addAtBack?this._parent.addChildAt(d,0):this._parent.addChild(d),h?(u.next=d,d.prev=u,u=d):u=h=d,++this.particleCount}if(h){this._activeParticlesLast?(this._activeParticlesLast.next=h,h.prev=this._activeParticlesLast,this._activeParticlesLast=u):(this._activeParticlesFirst=h,this._activeParticlesLast=u);for(let l=0;l<this.initBehaviors.length;++l){const f=this.initBehaviors[l];if(f===nt)for(let c=h,d;c;c=d){d=c.next,this.rotation!==0&&(Z(this.rotation,c.position),c.rotation+=this.rotation),c.position.x+=a,c.position.y+=o,c.age+=-this._spawnTimer;let p=c.age*c.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),c.agePercent=p}else f.initParticles(h)}for(let l=h,f;l;l=f){f=l.next;for(let c=0;c<this.updateBehaviors.length;++c)if(this.updateBehaviors[c].updateParticle(l,-this._spawnTimer)){this.recycle(l);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=n,this._prevEmitterPos.y=s,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let i=null,n=null;for(let s=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<s;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let o;this._poolFirst?(o=this._poolFirst,this._poolFirst=this._poolFirst.next,o.next=null):o=new he(this);let h;this.minLifetime===this.maxLifetime?h=this.minLifetime:h=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,o.init(h),this.addAtBack?this._parent.addChildAt(o,0):this._parent.addChild(o),i?(n.next=o,o.prev=n,n=o):n=i=o,++this.particleCount}if(i){this._activeParticlesLast?(this._activeParticlesLast.next=i,i.prev=this._activeParticlesLast,this._activeParticlesLast=n):(this._activeParticlesFirst=i,this._activeParticlesLast=n);for(let s=0;s<this.initBehaviors.length;++s){const a=this.initBehaviors[s];if(a===nt)for(let o=i,h;o;o=h)h=o.next,this.rotation!==0&&(Z(this.rotation,o.position),o.rotation+=this.rotation),o.position.x+=t,o.position.y+=e;else a.initParticles(i)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}E.knownBehaviors={};class Le{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t){t.x=Math.random()*this.w+this.x,t.y=Math.random()*this.h+this.y}}Le.type="rect";Le.editorConfig=null;class qt{constructor(t){this.x=t.x||0,this.y=t.y||0,this.radius=t.radius,this.innerRadius=t.innerRadius||0,this.rotation=!!t.affectRotation}getRandPos(t){this.innerRadius!==this.radius?t.x=Math.random()*(this.radius-this.innerRadius)+this.innerRadius:t.x=this.radius,t.y=0;const e=Math.random()*Math.PI*2;this.rotation&&(t.rotation+=e),Z(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}qt.type="torus";qt.editorConfig=null;class Oe{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const i=t[e];let n=i[0];for(let s=1;s<i.length;++s){const a=i[s];this.segments.push({p1:n,p2:a,l:0}),n=a}}else{let e=t[0];for(let i=1;i<t.length;++i){const n=t[i];this.segments.push({p1:e,p2:n,l:0}),e=n}}for(let e=0;e<this.segments.length;++e){const{p1:i,p2:n}=this.segments[e],s=Math.sqrt((n.x-i.x)*(n.x-i.x)+(n.y-i.y)*(n.y-i.y));this.segments[e].l=s,this.totalLength+=s,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let i,n;if(this.segments.length===1)i=this.segments[0],n=e;else for(let o=0;o<this.countingLengths.length;++o)if(e<this.countingLengths[o]){i=this.segments[o],n=o===0?e:e-this.countingLengths[o-1];break}n/=i.l||1;const{p1:s,p2:a}=i;t.x=s.x+n*(a.x-s.x),t.y=s.y+n*(a.y-s.y)}}Oe.type="polygonalChain";Oe.editorConfig=null;class Se{constructor(t){var e;this.order=w.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new P(i,0),Z(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity,n=i.x,s=i.y;if(i.x+=this.accel.x*e,i.y+=this.accel.y*e,this.maxSpeed){const a=mi(i);a>this.maxSpeed&&_i(i,this.maxSpeed/a)}t.x+=(n+i.x)/2*e,t.y+=(s+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}}Se.type="moveAcceleration";Se.editorConfig=null;function Cs(r){return this.ease&&(r=this.ease(r)),(this.first.next.value-this.first.value)*r+this.first.value}function As(r){this.ease&&(r=this.ease(r));const t=this.first.value,e=this.first.next.value,i=(e.r-t.r)*r+t.r,n=(e.g-t.g)*r+t.g,s=(e.b-t.b)*r+t.b;return $t(i,n,s)}function Ps(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;return r=(r-t.time)/(e.time-t.time),(e.value-t.value)*r+t.value}function Us(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;r=(r-t.time)/(e.time-t.time);const i=t.value,n=e.value,s=(n.r-i.r)*r+i.r,a=(n.g-i.g)*r+i.g,o=(n.b-i.b)*r+i.b;return $t(s,a,o)}function Fs(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;return t.value}function Ls(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;const e=t.value;return $t(e.r,e.g,e.b)}class Ct{constructor(t=!1){this.first=null,this.isColor=!!t,this.interpolate=null,this.ease=null}reset(t){this.first=t,t.next&&t.next.time>=1?this.interpolate=this.isColor?As:Cs:t.isStepped?this.interpolate=this.isColor?Ls:Fs:this.interpolate=this.isColor?Us:Ps,this.ease=this.first.ease}}class Ge{constructor(t){this.order=w.Normal,this.list=new Ct(!1),this.list.reset(z.createList(t.alpha))}initParticles(t){let e=t;for(;e;)e.alpha=this.list.first.value,e=e.next}updateParticle(t){t.alpha=this.list.interpolate(t.agePercent)}}Ge.type="alpha";Ge.editorConfig=null;class Be{constructor(t){this.order=w.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}Be.type="alphaStatic";Be.editorConfig=null;function gi(r){const t=[];for(let e=0;e<r.length;++e){let i=r[e];if(typeof i=="string")t.push(Nt(i));else if(i instanceof K)t.push(i);else{let n=i.count||1;for(typeof i.texture=="string"?i=Nt(i.texture):i=i.texture;n>0;--n)t.push(i)}}return t}class Me{constructor(t){this.order=w.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const i=t.anims[e],n=gi(i.textures),s=i.framerate<0?-1:i.framerate>0?i.framerate:60,a={textures:n,duration:s>0?n.length/s:0,framerate:s,loop:s>0?!!i.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.anims.length),n=e.config.anim=this.anims[i];e.texture=n.textures[0],e.config.animElapsed=0,n.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=n.textures.length/e.maxLife):(e.config.animDuration=n.duration,e.config.animFramerate=n.framerate),e=e.next}}updateParticle(t,e){const i=t.config,n=i.anim;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(i.anim.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const s=i.animElapsed*i.animFramerate+1e-7|0;t.texture=n.textures[s]||n.textures[n.textures.length-1]||K.EMPTY}}Me.type="animatedRandom";Me.editorConfig=null;class ke{constructor(t){this.order=w.Normal;const e=t.anim,i=gi(e.textures),n=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:i,duration:n>0?i.length/n:0,framerate:n,loop:n>0?!!e.loop:!1}}initParticles(t){let e=t;const i=this.anim;for(;e;)e.texture=i.textures[0],e.config.animElapsed=0,i.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}updateParticle(t,e){const i=this.anim,n=t.config;n.animElapsed+=e,n.animElapsed>=n.animDuration&&(i.loop?n.animElapsed=n.animElapsed%n.animDuration:n.animElapsed=n.animDuration-1e-6);const s=n.animElapsed*n.animFramerate+1e-7|0;t.texture=i.textures[s]||i.textures[i.textures.length-1]||K.EMPTY}}ke.type="animatedSingle";ke.editorConfig=null;class Xe{constructor(t){this.order=w.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=Ns(this.value),e=e.next}}Xe.type="blendMode";Xe.editorConfig=null;class He{constructor(t){this.order=w.Spawn,this.spacing=t.spacing*j,this.start=t.start*j,this.distance=t.distance}initParticles(t){let e=0,i=t;for(;i;){let n;this.spacing?n=this.start+this.spacing*e:n=Math.random()*Math.PI*2,i.rotation=n,this.distance&&(i.position.x=this.distance,Z(n,i.position)),i=i.next,++e}}}He.type="spawnBurst";He.editorConfig=null;class Ve{constructor(t){this.order=w.Normal,this.list=new Ct(!0),this.list.reset(z.createList(t.color))}initParticles(t){let e=t;const i=this.list.first.value,n=$t(i.r,i.g,i.b);for(;e;)e.tint=n,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}Ve.type="color";Ve.editorConfig=null;class je{constructor(t){this.order=w.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}je.type="colorStatic";je.editorConfig=null;class De{constructor(t){this.order=w.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?Nt(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}De.type="textureOrdered";De.editorConfig=null;const ct=new P,xi=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2","abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","cos","cosh","exp","expm1","floor","fround","hypot","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh"],Os=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(xi).join("|"),"g");function Ss(r){const t=r.match(Os);for(let e=t.length-1;e>=0;--e)xi.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return r=t.join(""),new Function("x",`return ${r};`)}class ze{constructor(t){var e;if(this.order=w.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=Ss(t.path)}catch{this.path=null}else this.path=i=>i;this.list=new Ct(!1),this.list.reset(z.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new P(e.x,e.y),e.config.movement=0;const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=i*e,ct.x=t.config.movement,ct.y=this.path(ct.x),Z(t.config.initRotation,ct),t.position.x=t.config.initPosition.x+ct.x,t.position.y=t.config.initPosition.y+ct.y}}ze.type="movePath";ze.editorConfig=null;class We{constructor(){this.order=w.Spawn}initParticles(t){}}We.type="spawnPoint";We.editorConfig=null;class $e{constructor(t){this.order=w.Normal,this.textures=t.textures.map(e=>typeof e=="string"?Nt(e):e)}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[i],e=e.next}}}$e.type="textureRandom";$e.editorConfig=null;class qe{constructor(t){this.order=w.Normal,this.minStart=t.minStart*j,this.maxStart=t.maxStart*j,this.minSpeed=t.minSpeed*j,this.maxSpeed=t.maxSpeed*j,this.accel=t.accel*j}initParticles(t){let e=t;for(;e;)this.minStart===this.maxStart?e.rotation+=this.maxStart:e.rotation+=Math.random()*(this.maxStart-this.minStart)+this.minStart,e.config.rotSpeed=Math.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel){const i=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+i)/2*e}else t.rotation+=t.config.rotSpeed*e}}qe.type="rotation";qe.editorConfig=null;class Ye{constructor(t){this.order=w.Normal,this.min=t.min*j,this.max=t.max*j}initParticles(t){let e=t;for(;e;)this.min===this.max?e.rotation+=this.max:e.rotation+=Math.random()*(this.max-this.min)+this.min,e=e.next}}Ye.type="rotationStatic";Ye.editorConfig=null;class Ke{constructor(t){this.order=w.Late+1,this.rotation=(t.rotation||0)*j}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Ke.type="noRotation";Ke.editorConfig=null;class Ze{constructor(t){var e;this.order=w.Normal,this.list=new Ct(!1),this.list.reset(z.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=i,e.scale.x=e.scale.y=this.list.first.value*i,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Ze.type="scale";Ze.editorConfig=null;class Je{constructor(t){this.order=w.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=i,e=e.next}}}Je.type="scaleStatic";Je.editorConfig=null;class V{constructor(t){this.order=w.Spawn;const e=V.shapes[t.type];if(!e)throw new Error(`No shape found with type '${t.type}'`);this.shape=new e(t.data)}static registerShape(t,e){V.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}V.type="spawnShape";V.editorConfig=null;V.shapes={};V.registerShape(Oe);V.registerShape(Le);V.registerShape(qt);V.registerShape(qt,"circle");class Qe{constructor(t){this.order=w.Normal,this.texture=typeof t.texture=="string"?Nt(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Qe.type="textureSingle";Qe.editorConfig=null;class tr{constructor(t){var e;this.order=w.Late,this.list=new Ct(!1),this.list.reset(z.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e.config.velocity?e.config.velocity.set(this.list.first.value*i,0):e.config.velocity=new P(this.list.first.value*i,0),Z(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult,n=t.config.velocity;ws(n),_i(n,i),t.x+=n.x*e,t.y+=n.y*e}}tr.type="moveSpeed";tr.editorConfig=null;class er{constructor(t){this.order=w.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new P(i,0),Z(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity;t.x+=i.x*e,t.y+=i.y*e}}er.type="moveSpeedStatic";er.editorConfig=null;function Ds(r,t){var e,i,n,s,a,o,h,u,l,f,c,d,p,m,v,y,R,C,M,k,B;if("behaviors"in r)return r;const T={lifetime:r.lifetime,ease:r.ease,particlesPerWave:r.particlesPerWave,frequency:r.frequency,spawnChance:r.spawnChance,emitterLifetime:r.emitterLifetime,maxParticles:r.maxParticles,addAtBack:r.addAtBack,pos:r.pos,emit:r.emit,autoUpdate:r.autoUpdate,behaviors:[]};if(r.alpha)if("start"in r.alpha)if(r.alpha.start===r.alpha.end)r.alpha.start!==1&&T.behaviors.push({type:"alphaStatic",config:{alpha:r.alpha.start}});else{const b={list:[{time:0,value:r.alpha.start},{time:1,value:r.alpha.end}]};T.behaviors.push({type:"alpha",config:{alpha:b}})}else r.alpha.list.length===1?r.alpha.list[0].value!==1&&T.behaviors.push({type:"alphaStatic",config:{alpha:r.alpha.list[0].value}}):T.behaviors.push({type:"alpha",config:{alpha:r.alpha}});if(r.acceleration&&(r.acceleration.x||r.acceleration.y)){let b,G;"start"in r.speed?(b=r.speed.start*((e=r.speed.minimumSpeedMultiplier)!==null&&e!==void 0?e:1),G=r.speed.start):(b=r.speed.list[0].value*((i=r.minimumSpeedMultiplier)!==null&&i!==void 0?i:1),G=r.speed.list[0].value),T.behaviors.push({type:"moveAcceleration",config:{accel:r.acceleration,minStart:b,maxStart:G,rotate:!r.noRotation,maxSpeed:r.maxSpeed}})}else if(!((n=r.extraData)===null||n===void 0)&&n.path){let b,G;"start"in r.speed?(G=(s=r.speed.minimumSpeedMultiplier)!==null&&s!==void 0?s:1,r.speed.start===r.speed.end?b={list:[{time:0,value:r.speed.start}]}:b={list:[{time:0,value:r.speed.start},{time:1,value:r.speed.end}]}):(b=r.speed,G=(a=r.minimumSpeedMultiplier)!==null&&a!==void 0?a:1),T.behaviors.push({type:"movePath",config:{path:r.extraData.path,speed:b,minMult:G}})}else if(r.speed)if("start"in r.speed)if(r.speed.start===r.speed.end)T.behaviors.push({type:"moveSpeedStatic",config:{min:r.speed.start*((o=r.speed.minimumSpeedMultiplier)!==null&&o!==void 0?o:1),max:r.speed.start}});else{const b={list:[{time:0,value:r.speed.start},{time:1,value:r.speed.end}]};T.behaviors.push({type:"moveSpeed",config:{speed:b,minMult:r.speed.minimumSpeedMultiplier}})}else r.speed.list.length===1?T.behaviors.push({type:"moveSpeedStatic",config:{min:r.speed.list[0].value*((h=r.minimumSpeedMultiplier)!==null&&h!==void 0?h:1),max:r.speed.list[0].value}}):T.behaviors.push({type:"moveSpeed",config:{speed:r.speed,minMult:(u=r.minimumSpeedMultiplier)!==null&&u!==void 0?u:1}});if(r.scale)if("start"in r.scale){const b=(l=r.scale.minimumScaleMultiplier)!==null&&l!==void 0?l:1;if(r.scale.start===r.scale.end)T.behaviors.push({type:"scaleStatic",config:{min:r.scale.start*b,max:r.scale.start}});else{const G={list:[{time:0,value:r.scale.start},{time:1,value:r.scale.end}]};T.behaviors.push({type:"scale",config:{scale:G,minMult:b}})}}else if(r.scale.list.length===1){const b=(f=r.minimumScaleMultiplier)!==null&&f!==void 0?f:1,G=r.scale.list[0].value;T.behaviors.push({type:"scaleStatic",config:{min:G*b,max:G}})}else T.behaviors.push({type:"scale",config:{scale:r.scale,minMult:(c=r.minimumScaleMultiplier)!==null&&c!==void 0?c:1}});if(r.color)if("start"in r.color)if(r.color.start===r.color.end)r.color.start!=="ffffff"&&T.behaviors.push({type:"colorStatic",config:{color:r.color.start}});else{const b={list:[{time:0,value:r.color.start},{time:1,value:r.color.end}]};T.behaviors.push({type:"color",config:{color:b}})}else r.color.list.length===1?r.color.list[0].value!=="ffffff"&&T.behaviors.push({type:"colorStatic",config:{color:r.color.list[0].value}}):T.behaviors.push({type:"color",config:{color:r.color}});if(r.rotationAcceleration||((d=r.rotationSpeed)===null||d===void 0?void 0:d.min)||((p=r.rotationSpeed)===null||p===void 0?void 0:p.max)?T.behaviors.push({type:"rotation",config:{accel:r.rotationAcceleration||0,minSpeed:((m=r.rotationSpeed)===null||m===void 0?void 0:m.min)||0,maxSpeed:((v=r.rotationSpeed)===null||v===void 0?void 0:v.max)||0,minStart:((y=r.startRotation)===null||y===void 0?void 0:y.min)||0,maxStart:((R=r.startRotation)===null||R===void 0?void 0:R.max)||0}}):(((C=r.startRotation)===null||C===void 0?void 0:C.min)||((M=r.startRotation)===null||M===void 0?void 0:M.max))&&T.behaviors.push({type:"rotationStatic",config:{min:((k=r.startRotation)===null||k===void 0?void 0:k.min)||0,max:((B=r.startRotation)===null||B===void 0?void 0:B.max)||0}}),r.noRotation&&T.behaviors.push({type:"noRotation",config:{}}),r.blendMode&&r.blendMode!=="normal"&&T.behaviors.push({type:"blendMode",config:{blendMode:r.blendMode}}),Array.isArray(t)&&typeof t[0]!="string"&&"framerate"in t[0]){for(let b=0;b<t.length;++b)t[b].framerate==="matchLife"&&(t[b].framerate=-1);T.behaviors.push({type:"animatedRandom",config:{anims:t}})}else typeof t!="string"&&"framerate"in t?(t.framerate==="matchLife"&&(t.framerate=-1),T.behaviors.push({type:"animatedSingle",config:{anim:t}})):r.orderedArt&&Array.isArray(t)?T.behaviors.push({type:"textureOrdered",config:{textures:t}}):Array.isArray(t)?T.behaviors.push({type:"textureRandom",config:{textures:t}}):T.behaviors.push({type:"textureSingle",config:{texture:t}});if(r.spawnType==="burst")T.behaviors.push({type:"spawnBurst",config:{start:r.angleStart||0,spacing:r.particleSpacing,distance:0}});else if(r.spawnType==="point")T.behaviors.push({type:"spawnPoint",config:{}});else{let b;r.spawnType==="ring"?b={type:"torus",data:{x:r.spawnCircle.x,y:r.spawnCircle.y,radius:r.spawnCircle.r,innerRadius:r.spawnCircle.minR,affectRotation:!0}}:r.spawnType==="circle"?b={type:"torus",data:{x:r.spawnCircle.x,y:r.spawnCircle.y,radius:r.spawnCircle.r,innerRadius:0,affectRotation:!1}}:r.spawnType==="rect"?b={type:"rect",data:r.spawnRect}:r.spawnType==="polygonalChain"&&(b={type:"polygonalChain",data:r.spawnPolygon}),b&&T.behaviors.push({type:"spawnShape",config:b})}return T}E.registerBehavior(Se);E.registerBehavior(Ge);E.registerBehavior(Be);E.registerBehavior(Me);E.registerBehavior(ke);E.registerBehavior(Xe);E.registerBehavior(He);E.registerBehavior(Ve);E.registerBehavior(je);E.registerBehavior(De);E.registerBehavior(ze);E.registerBehavior(We);E.registerBehavior($e);E.registerBehavior(qe);E.registerBehavior(Ye);E.registerBehavior(Ke);E.registerBehavior(Ze);E.registerBehavior(Je);E.registerBehavior(V);E.registerBehavior(Qe);E.registerBehavior(tr);E.registerBehavior(er);/*!
* @pixi/app - v6.3.2
* Compiled Wed, 04 May 2022 17:49:13 UTC
*
* @pixi/app is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/var Gs=function(){function r(t){var e=this;this.stage=new zt,t=Object.assign({forceCanvas:!1},t),this.renderer=ds(t),r._plugins.forEach(function(i){i.init.call(e,t)})}return r.registerPlugin=function(t){r._plugins.push(t)},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(t,e){var i=this,n=r._plugins.slice(0);n.reverse(),n.forEach(function(s){s.destroy.call(i)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null},r._plugins=[],r}(),Bs=function(){function r(){}return r.init=function(t){var e=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(){!e._resizeTo||(e.cancelResize(),e._resizeId=requestAnimationFrame(function(){return e.resize()}))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(!!e._resizeTo){e.cancelResize();var i,n;if(e._resizeTo===globalThis.window)i=globalThis.innerWidth,n=globalThis.innerHeight;else{var s=e._resizeTo,a=s.clientWidth,o=s.clientHeight;i=a,n=o}e.renderer.resize(i,n)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.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}();Gs.registerPlugin(Bs);export{Gs as A,js as B,E,cs as R,Vs as T,Ds as u};