var qd=Object.defineProperty,Kd=Object.defineProperties,Zd=Object.getOwnPropertyDescriptors,ir=Object.getOwnPropertySymbols,$h=Object.prototype.hasOwnProperty,jh=Object.prototype.propertyIsEnumerable,Wh=(t,e,s)=>e in t?qd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,bt=(t,e)=>{for(var s in e||(e={}))$h.call(e,s)&&Wh(t,s,e[s]);if(ir)for(var s of ir(e))jh.call(e,s)&&Wh(t,s,e[s]);return t},Qi=(t,e)=>Kd(t,Zd(e)),zn=(t,e)=>{var s={};for(var i in t)$h.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&ir)for(var i of ir(t))e.indexOf(i)<0&&jh.call(t,i)&&(s[i]=t[i]);return s},PIXI=function(t){var e,s,i=((s=i||{})[s.WEBGL_LEGACY=0]="WEBGL_LEGACY",s[s.WEBGL=1]="WEBGL",s[s.WEBGL2=2]="WEBGL2",s),r=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS",t))(r||{}),n=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(n||{}),a=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR",t))(a||{}),o=(t=>(t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t))(o||{}),h=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(h||{}),l=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(l||{}),u=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(u||{}),d=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(d||{}),c=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(c||{}),p=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(p||{}),f=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(f||{}),m=(t=>(t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",t))(m||{}),_=(t=>(t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT",t))(_||{}),g=(t=>(t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL",t))(g||{}),x=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(x||{}),v=(t=>(t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR",t))(v||{}),y=(t=>(t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA",t))(y||{}),T=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(T||{}),b=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(b||{});const E={createCanvas:(t,e)=>{const s=document.createElement("canvas");return s.width=t,s.height=e,s},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var t;return null!=(t=document.baseURI)?t:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")},A={ADAPTER:E,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var R=/iPhone/i,S=/iPod/i,w=/iPad/i,I=/\biOS-universal(?:.+)Mac\b/i,M=/\bAndroid(?:.+)Mobile\b/i,C=/Android/i,D=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,P=/Silk/i,O=/Windows Phone/i,F=/\bWindows(?:.+)ARM\b/i,B=/BlackBerry/i,N=/BB10/i,L=/Opera Mini/i,G=/\b(CriOS|Chrome)(?:.+)Mobile/i,U=/Mobile(?:.+)Firefox\b/i,k=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};function X(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var s=e.userAgent,i=s.split("[FBAN");void 0!==i[1]&&(s=i[0]),void 0!==(i=s.split("Twitter"))[1]&&(s=i[0]);var r=function(t){return function(e){return e.test(t)}}(s),n={apple:{phone:r(R)&&!r(O),ipod:r(S),tablet:!r(R)&&(r(w)||k(e))&&!r(O),universal:r(I),device:(r(R)||r(S)||r(w)||r(I)||k(e))&&!r(O)},amazon:{phone:r(D),tablet:!r(D)&&r(P),device:r(D)||r(P)},android:{phone:!r(O)&&r(D)||!r(O)&&r(M),tablet:!r(O)&&!r(D)&&!r(M)&&(r(P)||r(C)),device:!r(O)&&(r(D)||r(P)||r(M)||r(C))||r(/\bokhttp\b/i)},windows:{phone:r(O),tablet:r(F),device:r(O)||r(F)},other:{blackberry:r(B),blackberry10:r(N),opera:r(L),firefox:r(U),chrome:r(G),device:r(B)||r(N)||r(L)||r(U)||r(G)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const H=(null!=(e=X.default)?e:X)(globalThis.navigator);A.RETINA_PREFIX=/@([0-9\.]+)x/,A.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var V="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function z(t,e,s){return t(s={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&s.path)}},s.exports),s.exports}var W=z((function(t){"use strict";var e=Object.prototype.hasOwnProperty,s="~";function i(){}function r(t,e,s){this.fn=t,this.context=e,this.once=s||!1}function n(t,e,i,n,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new r(i,n||t,a),h=s?s+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(s=!1)),o.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(s?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,a=new Array(n);r80*s){i=n=t[0],r=a=t[1];for(var f=s;fn&&(n=o),h>a&&(a=h);l=0!==(l=Math.max(n-i,a-r))?32767/l:0}return Z(c,p,s,i,r,l,0),p}function q(t,e,s,i,r){var n,a;if(r===vt(t,e,s,i)>0)for(n=e;n=e;n-=i)a=_t(n,t[n],t[n+1],a);return a&&ut(a,a.next)&&(gt(a),a=a.next),a}function K(t,e){if(!t)return t;e||(e=t);var s,i=t;do{if(s=!1,i.steiner||!ut(i,i.next)&&0!==lt(i.prev,i,i.next))i=i.next;else{if(gt(i),(i=e=i.prev)===i.next)break;s=!0}}while(s||i!==e);return e}function Z(t,e,s,i,r,n,a){if(t){!a&&n&&function(t,e,s,i){var r=t;do{0===r.z&&(r.z=nt(r.x,r.y,e,s,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,s,i,r,n,a,o,h,l=1;do{for(s=t,t=null,n=null,a=0;s;){for(a++,i=s,o=0,e=0;e0||h>0&&i;)0!==o&&(0===h||!i||s.z<=i.z)?(r=s,s=s.nextZ,o--):(r=i,i=i.nextZ,h--),n?n.nextZ=r:t=r,r.prevZ=n,n=r;s=i}n.nextZ=null,l*=2}while(a>1)}(r)}(t,i,r,n);for(var o,h,l=t;t.prev!==t.next;)if(o=t.prev,h=t.next,n?J(t,i,r,n):Q(t))e.push(o.i/s|0),e.push(t.i/s|0),e.push(h.i/s|0),gt(t),t=h.next,l=h.next;else if((t=h)===l){a?1===a?Z(t=tt(K(t),e,s),e,s,i,r,n,2):2===a&&et(t,e,s,i,r,n):Z(K(t),e,s,i,r,n,1);break}}}function Q(t){var e=t.prev,s=t,i=t.next;if(lt(e,s,i)>=0)return!1;for(var r=e.x,n=s.x,a=i.x,o=e.y,h=s.y,l=i.y,u=rn?r>a?r:a:n>a?n:a,p=o>h?o>l?o:l:h>l?h:l,f=i.next;f!==e;){if(f.x>=u&&f.x<=c&&f.y>=d&&f.y<=p&&ot(r,o,n,h,a,l,f.x,f.y)&<(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function J(t,e,s,i){var r=t.prev,n=t,a=t.next;if(lt(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,l=a.x,u=r.y,d=n.y,c=a.y,p=oh?o>l?o:l:h>l?h:l,_=u>d?u>c?u:c:d>c?d:c,g=nt(p,f,e,s,i),x=nt(m,_,e,s,i),v=t.prevZ,y=t.nextZ;v&&v.z>=g&&y&&y.z<=x;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==r&&v!==a&&ot(o,u,h,d,l,c,v.x,v.y)&<(v.prev,v,v.next)>=0||(v=v.prevZ,y.x>=p&&y.x<=m&&y.y>=f&&y.y<=_&&y!==r&&y!==a&&ot(o,u,h,d,l,c,y.x,y.y)&<(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;v&&v.z>=g;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==r&&v!==a&&ot(o,u,h,d,l,c,v.x,v.y)&<(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;y&&y.z<=x;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=_&&y!==r&&y!==a&&ot(o,u,h,d,l,c,y.x,y.y)&<(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function tt(t,e,s){var i=t;do{var r=i.prev,n=i.next.next;!ut(r,n)&&dt(r,i,i.next,n)&&ft(r,n)&&ft(n,r)&&(e.push(r.i/s|0),e.push(i.i/s|0),e.push(n.i/s|0),gt(i),gt(i.next),i=t=n),i=i.next}while(i!==t);return K(i)}function et(t,e,s,i,r,n){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&ht(a,o)){var h=mt(a,o);return a=K(a,a.next),h=K(h,h.next),Z(a,e,s,i,r,n,0),void Z(h,e,s,i,r,n,0)}o=o.next}a=a.next}while(a!==t)}function st(t,e){return t.x-e.x}function it(t,e){var s=function(t,e){var s,i=e,r=t.x,n=t.y,a=-1/0;do{if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){var o=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=r&&o>a&&(a=o,s=i.x=i.x&&i.x>=u&&r!==i.x&&ot(ns.x||i.x===s.x&&rt(s,i)))&&(s=i,c=h)),i=i.next}while(i!==l);return s}(t,e);if(!s)return e;var i=mt(s,t);return K(i,i.next),K(s,s.next)}function rt(t,e){return lt(t.prev,t,e.prev)<0&<(e.next,t,t.next)<0}function nt(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function at(t){var e=t,s=t;do{(e.x=(t-a)*(n-o)&&(t-a)*(i-o)>=(s-a)*(e-o)&&(s-a)*(n-o)>=(r-a)*(i-o)}function ht(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var s=t;do{if(s.i!==t.i&&s.next.i!==t.i&&s.i!==e.i&&s.next.i!==e.i&&dt(s,s.next,t,e))return!0;s=s.next}while(s!==t);return!1}(t,e)&&(ft(t,e)&&ft(e,t)&&function(t,e){var s=t,i=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{s.y>n!=s.next.y>n&&s.next.y!==s.y&&r<(s.next.x-s.x)*(n-s.y)/(s.next.y-s.y)+s.x&&(i=!i),s=s.next}while(s!==t);return i}(t,e)&&(lt(t.prev,t,e.prev)||lt(t,e.prev,e))||ut(t,e)&<(t.prev,t,t.next)>0&<(e.prev,e,e.next)>0)}function lt(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function ut(t,e){return t.x===e.x&&t.y===e.y}function dt(t,e,s,i){var r=pt(lt(t,e,s)),n=pt(lt(t,e,i)),a=pt(lt(s,i,t)),o=pt(lt(s,i,e));return!!(r!==n&&a!==o||0===r&&ct(t,s,e)||0===n&&ct(t,i,e)||0===a&&ct(s,t,i)||0===o&&ct(s,e,i))}function ct(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function pt(t){return t>0?1:t<0?-1:0}function ft(t,e){return lt(t.prev,t,t.next)<0?lt(t,e,t.next)>=0&<(t,t.prev,e)>=0:lt(t,e,t.prev)<0||lt(t,t.next,e)<0}function mt(t,e){var s=new xt(t.i,t.x,t.y),i=new xt(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}function _t(t,e,s,i){var r=new xt(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function gt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function xt(t,e,s){this.i=t,this.x=e,this.y=s,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function vt(t,e,s,i){for(var r=0,n=e,a=s-i;n0&&(i+=t[r-1].length,s.holes.push(i))}return s},Y.default=j;var yt=z((function(t,e){/*! https://mths.be/punycode v1.3.2 by @mathias */!function(s){var i=e&&!e.nodeType&&e,r=t&&!t.nodeType&&t,n="object"==typeof V&&V;(n.global===n||n.window===n||n.self===n)&&(s=n);var a,o,h=2147483647,l=36,u=1,d=26,c=38,p=700,f=72,m=128,_="-",g=/^xn--/,x=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=l-u,b=Math.floor,E=String.fromCharCode;function A(t){throw RangeError(y[t])}function R(t,e){for(var s=t.length,i=[];s--;)i[s]=e(t[s]);return i}function S(t,e){var s=t.split("@"),i="";return s.length>1&&(i=s[0]+"@",t=s[1]),i+R((t=t.replace(v,".")).split("."),e).join(".")}function w(t){for(var e,s,i=[],r=0,n=t.length;r=55296&&e<=56319&&r65535&&(e+=E((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=E(t)})).join("")}function M(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:l}function C(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function D(t,e,s){var i=0;for(t=s?b(t/p):t>>1,t+=b(t/e);t>T*d>>1;i+=l)t=b(t/T);return b(i+(T+1)*t/(t+c))}function P(t){var e,s,i,r,n,a,o,c,p,g,x=[],v=t.length,y=0,T=m,E=f;for((s=t.lastIndexOf(_))<0&&(s=0),i=0;i=128&&A("not-basic"),x.push(t.charCodeAt(i));for(r=s>0?s+1:0;r=v&&A("invalid-input"),((c=M(t.charCodeAt(r++)))>=l||c>b((h-y)/a))&&A("overflow"),y+=c*a,!(c<(p=o<=E?u:o>=E+d?d:o-E));o+=l)a>b(h/(g=l-p))&&A("overflow"),a*=g;E=D(y-n,e=x.length+1,0==n),b(y/e)>h-T&&A("overflow"),T+=b(y/e),y%=e,x.splice(y++,0,T)}return I(x)}function O(t){var e,s,i,r,n,a,o,c,p,g,x,v,y,T,R,S=[];for(v=(t=w(t)).length,e=m,s=0,n=f,a=0;a=e&&xb((h-s)/(y=i+1))&&A("overflow"),s+=(o-e)*y,e=o,a=0;ah&&A("overflow"),x==e){for(c=s,p=l;!(c<(g=p<=n?u:p>=n+d?d:p-n));p+=l)R=c-g,T=l-g,S.push(E(C(g+R%T,0))),c=b(R/T);S.push(E(C(c,0))),n=D(s,y,i==r),s=0,++i}++s,++e}return S.join("")}if(a={version:"1.3.2",ucs2:{decode:w,encode:I},decode:P,encode:O,toASCII:function(t){return S(t,(function(t){return x.test(t)?"xn--"+O(t):t}))},toUnicode:function(t){return S(t,(function(t){return g.test(t)?P(t.slice(4).toLowerCase()):t}))}},i&&r)if(t.exports==i)r.exports=a;else for(o in a)a.hasOwnProperty(o)&&(i[o]=a[o]);else s.punycode=a}(V)})),Tt={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}};function Et(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var At=function(t,e,s,i){e=e||"&",s=s||"=";var r={};if("string"!=typeof t||0===t.length)return r;var n=/\+/g;t=t.split(e);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var o=t.length;a>0&&o>a&&(o=a);for(var h=0;h=0?(l=p.substr(0,f),u=p.substr(f+1)):(l=p,u=""),d=decodeURIComponent(l),c=decodeURIComponent(u),Et(r,d)?Array.isArray(r[d])?r[d].push(c):r[d]=[r[d],c]:r[d]=c}return r},Rt=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},St=function(t,e,s,i){return e=e||"&",s=s||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(i){var r=encodeURIComponent(Rt(i))+s;return Array.isArray(t[i])?t[i].map((function(t){return r+encodeURIComponent(Rt(t))})).join(e):r+encodeURIComponent(Rt(t[i]))})).join(e):i?encodeURIComponent(Rt(i))+s+encodeURIComponent(Rt(t)):""},wt=z((function(t,e){"use strict";e.decode=e.parse=At,e.encode=e.stringify=St})),It=zt,Mt=function(t,e){return zt(t,!1,!0).resolve(e)},Ct=function(t){return Tt.isString(t)&&(t=zt(t)),t instanceof Dt?t.format():Dt.prototype.format.call(t)};function Dt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Pt=/^([a-z0-9.+-]+:)/i,Ot=/:[0-9]*$/,Ft=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Bt=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Nt=["'"].concat(Bt),Lt=["%","/","?",";","#"].concat(Nt),Gt=["/","?","#"],Ut=/^[+a-z0-9A-Z_-]{0,63}$/,kt=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Xt={javascript:!0,"javascript:":!0},Ht={javascript:!0,"javascript:":!0},Vt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function zt(t,e,s){if(t&&Tt.isObject(t)&&t instanceof Dt)return t;var i=new Dt;return i.parse(t,e,s),i}Dt.prototype.parse=function(t,e,s){if(!Tt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),r=-1!==i&&i127?y+="x":y+=v[T];if(!y.match(Ut)){var E=g.slice(0,c),A=g.slice(c+1),R=v.match(kt);R&&(E.push(R[1]),A.unshift(R[2])),A.length&&(a="/"+A.join(".")+a),this.hostname=E.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=yt.toASCII(this.hostname));var S=this.port?":"+this.port:"",w=this.hostname||"";this.host=w+S,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!Xt[l])for(c=0,x=Nt.length;c0)&&s.host.split("@"))&&(s.auth=R.shift(),s.host=s.hostname=R.shift());return s.search=t.search,s.query=t.query,(!Tt.isNull(s.pathname)||!Tt.isNull(s.search))&&(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=s.format(),s}if(!v.length)return s.pathname=null,s.search?s.path="/"+s.search:s.path=null,s.href=s.format(),s;for(var T=v.slice(-1)[0],b=(s.host||t.host||v.length>1)&&("."===T||".."===T)||""===T,E=0,A=v.length;A>=0;A--)"."===(T=v[A])?v.splice(A,1):".."===T?(v.splice(A,1),E++):E&&(v.splice(A,1),E--);if(!g&&!x)for(;E--;E)v.unshift("..");g&&""!==v[0]&&(!v[0]||"/"!==v[0].charAt(0))&&v.unshift(""),b&&"/"!==v.join("/").substr(-1)&&v.push("");var R,S=""===v[0]||v[0]&&"/"===v[0].charAt(0);y&&(s.hostname=s.host=S?"":v.length?v.shift():"",(R=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=R.shift(),s.host=s.hostname=R.shift()));return(g=g||s.host&&v.length)&&!S&&v.unshift(""),v.length?s.pathname=v.join("/"):(s.pathname=null,s.path=null),(!Tt.isNull(s.pathname)||!Tt.isNull(s.search))&&(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.auth=t.auth||s.auth,s.slashes=s.slashes||t.slashes,s.href=s.format(),s},Dt.prototype.parseHost=function(){var t=this.host,e=Ot.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const Wt={parse:It,format:Ct,resolve:Mt};function Yt(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function jt(t){return t.split("?")[0].split("#")[0]}const $t={toPosix:t=>function(t,e,s){return t.replace(new RegExp(function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(e),"g"),s)}(t,"\\","/"),isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),hasProtocol(t){return/^[^/:]+:\//.test(this.toPosix(t))},getProtocol(t){Yt(t),t=this.toPosix(t);let e="";const s=/^file:\/\/\//.exec(t),i=/^[^/:]+:\/\//.exec(t),r=/^[^/:]+:\//.exec(t);if(s||i||r){const n=(null==s?void 0:s[0])||(null==i?void 0:i[0])||(null==r?void 0:r[0]);e=n,t=t.slice(n.length)}return e},toAbsolute(t,e,s){if(this.isDataUrl(t))return t;const i=jt(this.toPosix(null!=e?e:A.ADAPTER.getBaseUrl())),r=jt(this.toPosix(null!=s?s:this.rootname(i)));return Yt(t),(t=this.toPosix(t)).startsWith("/")?$t.join(r,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(Yt(t=this.toPosix(t)),0===t.length)return".";let e="";const s=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const i=t.endsWith("/");return t=function(t,e){let s="",i=0,r=-1,n=0,a=-1;for(let o=0;o<=t.length;++o){if(o2){const t=s.lastIndexOf("/");if(t!==s.length-1){-1===t?(s="",i=0):(s=s.slice(0,t),i=s.length-1-s.lastIndexOf("/")),r=o,n=0;continue}}else if(2===s.length||1===s.length){s="",i=0,r=o,n=0;continue}e&&(s.length>0?s+="/..":s="..",i=2)}else s.length>0?s+=`/${t.slice(r+1,o)}`:s=t.slice(r+1,o),i=o-r-1;r=o,n=0}else 46===a&&-1!==n?++n:n=-1}return s}(t,!1),t.length>0&&i&&(t+="/"),s?`/${t}`:e+t},isAbsolute(t){return Yt(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){var e;if(0===t.length)return".";let s;for(let i=0;i0)if(void 0===s)s=r;else{const n=null!=(e=t[i-1])?e:"";this.extname(n)?s+=`/../${r}`:s+=`/${r}`}}return void 0===s?".":this.normalize(s)},dirname(t){if(Yt(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const s=47===e;let i=-1,r=!0;const n=this.getProtocol(t),a=t;for(let s=(t=t.slice(n.length)).length-1;s>=1;--s)if(e=t.charCodeAt(s),47===e){if(!r){i=s;break}}else r=!1;return-1===i?s?"/":this.isUrl(a)?n+t:n:s&&1===i?"//":n+t.slice(0,i)},rootname(t){Yt(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const s=t.indexOf("/",e.length);e=-1!==s?t.slice(0,s):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){Yt(t),e&&Yt(e),t=jt(this.toPosix(t));let s,i=0,r=-1,n=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(s=t.length-1;s>=0;--s){const h=t.charCodeAt(s);if(47===h){if(!n){i=s+1;break}}else-1===o&&(n=!1,o=s+1),a>=0&&(h===e.charCodeAt(a)?-1==--a&&(r=s):(a=-1,r=o))}return i===r?r=o:-1===r&&(r=t.length),t.slice(i,r)}for(s=t.length-1;s>=0;--s)if(47===t.charCodeAt(s)){if(!n){i=s+1;break}}else-1===r&&(n=!1,r=s+1);return-1===r?"":t.slice(i,r)},extname(t){Yt(t);let e=-1,s=0,i=-1,r=!0,n=0;for(let a=(t=jt(this.toPosix(t))).length-1;a>=0;--a){const o=t.charCodeAt(a);if(47!==o)-1===i&&(r=!1,i=a+1),46===o?-1===e?e=a:1!==n&&(n=1):-1!==e&&(n=-1);else if(!r){s=a+1;break}}return-1===e||-1===i||0===n||1===n&&e===i-1&&e===s+1?"":t.slice(e,i)},parse(t){Yt(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let s=(t=jt(this.toPosix(t))).charCodeAt(0);const i=this.isAbsolute(t);let r;e.root=this.rootname(t),r=i||this.hasProtocol(t)?1:0;let n=-1,a=0,o=-1,h=!0,l=t.length-1,u=0;for(;l>=r;--l)if(s=t.charCodeAt(l),47!==s)-1===o&&(h=!1,o=l+1),46===s?-1===n?n=l:1!==u&&(u=1):-1!==n&&(u=-1);else if(!h){a=l+1;break}return-1===n||-1===o||0===u||1===u&&n===o-1&&n===a+1?-1!==o&&(e.base=e.name=0===a&&i?t.slice(1,o):t.slice(a,o)):(0===a&&i?(e.name=t.slice(1,n),e.base=t.slice(1,o)):(e.name=t.slice(a,n),e.base=t.slice(a,o)),e.ext=t.slice(n,o)),e.dir=this.dirname(t),e},sep:"/",delimiter:":"},qt={};function Kt(t,e,s=3){if(qt[e])return;let i=(new Error).stack;void 0===i?console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`):(i=i.split("\n").splice(s).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}\nDeprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`),console.warn(i))),qt[e]=!0}let Zt;function Qt(){return void 0===Zt&&(Zt=function(){var t;const e={stencil:!0,failIfMajorPerformanceCaveat:A.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!A.ADAPTER.getWebGLRenderingContext())return!1;const s=A.ADAPTER.createCanvas();let i=s.getContext("webgl",e)||s.getContext("experimental-webgl",e);const r=!(null==(t=null==i?void 0:i.getContextAttributes())||!t.stencil);if(i){const t=i.getExtension("WEBGL_lose_context");t&&t.loseContext()}return i=null,r}catch(t){return!1}}()),Zt}var Jt={grad:.9,turn:360,rad:360/(2*Math.PI)},te=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},ee=function(t,e,s){return void 0===e&&(e=0),void 0===s&&(s=Math.pow(10,e)),Math.round(s*t)/s+0},se=function(t,e,s){return void 0===e&&(e=0),void 0===s&&(s=1),t>s?s:t>e?t:e},ie=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},re=function(t){return{r:se(t.r,0,255),g:se(t.g,0,255),b:se(t.b,0,255),a:se(t.a)}},ne=function(t){return{r:ee(t.r),g:ee(t.g),b:ee(t.b),a:ee(t.a,3)}},ae=/^#([0-9a-f]{3,8})$/i,oe=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},he=function(t){var e=t.r,s=t.g,i=t.b,r=t.a,n=Math.max(e,s,i),a=n-Math.min(e,s,i),o=a?n===e?(s-i)/a:n===s?2+(i-e)/a:4+(e-s)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},le=function(t){var e=t.h,s=t.s,i=t.v,r=t.a;e=e/360*6,s/=100,i/=100;var n=Math.floor(e),a=i*(1-s),o=i*(1-(e-n)*s),h=i*(1-(1-e+n)*s),l=n%6;return{r:255*[i,o,a,a,h,i][l],g:255*[h,i,i,o,a,a][l],b:255*[a,a,h,i,i,o][l],a:r}},ue=function(t){return{h:ie(t.h),s:se(t.s,0,100),l:se(t.l,0,100),a:se(t.a)}},de=function(t){return{h:ee(t.h),s:ee(t.s),l:ee(t.l),a:ee(t.a,3)}},ce=function(t){return le((s=(e=t).s,{h:e.h,s:(s*=((i=e.l)<50?i:100-i)/100)>0?2*s/(i+s)*100:0,v:i+s,a:e.a}));var e,s,i},pe=function(t){return{h:(e=he(t)).h,s:(r=(200-(s=e.s))*(i=e.v)/100)>0&&r<200?s*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:e.a};var e,s,i,r},fe=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,me=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_e=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ge=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xe={string:[[function(t){var e=ae.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?ee(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?ee(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=_e.exec(t)||ge.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:re({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=fe.exec(t)||me.exec(t);if(!e)return null;var s,i,r=ue({h:(s=e[1],i=e[2],void 0===i&&(i="deg"),Number(s)*(Jt[i]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return ce(r)},"hsl"]],object:[[function(t){var e=t.r,s=t.g,i=t.b,r=t.a,n=void 0===r?1:r;return te(e)&&te(s)&&te(i)?re({r:Number(e),g:Number(s),b:Number(i),a:Number(n)}):null},"rgb"],[function(t){var e=t.h,s=t.s,i=t.l,r=t.a,n=void 0===r?1:r;if(!te(e)||!te(s)||!te(i))return null;var a=ue({h:Number(e),s:Number(s),l:Number(i),a:Number(n)});return ce(a)},"hsl"],[function(t){var e=t.h,s=t.s,i=t.v,r=t.a,n=void 0===r?1:r;if(!te(e)||!te(s)||!te(i))return null;var a,o=(a={h:Number(e),s:Number(s),v:Number(i),a:Number(n)},{h:ie(a.h),s:se(a.s,0,100),v:se(a.v,0,100),a:se(a.a)});return le(o)},"hsv"]]},ve=function(t,e){for(var s=0;s=.5},t.prototype.toHex=function(){return e=(t=ne(this.rgba)).r,s=t.g,i=t.b,n=(r=t.a)<1?oe(ee(255*r)):"","#"+oe(e)+oe(s)+oe(i)+n;var t,e,s,i,r,n},t.prototype.toRgb=function(){return ne(this.rgba)},t.prototype.toRgbString=function(){return e=(t=ne(this.rgba)).r,s=t.g,i=t.b,(r=t.a)<1?"rgba("+e+", "+s+", "+i+", "+r+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,r},t.prototype.toHsl=function(){return de(pe(this.rgba))},t.prototype.toHslString=function(){return e=(t=de(pe(this.rgba))).h,s=t.s,i=t.l,(r=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+r+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,r},t.prototype.toHsv=function(){return t=he(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},t.prototype.invert=function(){return Re({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),Re(Te(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),Re(Te(this.rgba,-t))},t.prototype.grayscale=function(){return Re(Te(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),Re(Ee(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),Re(Ee(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?Re({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=pe(this.rgba);return"number"==typeof t?Re({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},t.prototype.isEqual=function(t){return this.toHex()===Re(t).toHex()},t}(),Re=function(t){return t instanceof Ae?t:new Ae(t)},Se=[];!function(t){t.forEach((function(t){Se.indexOf(t)<0&&(t(Ae,xe),Se.push(t))}))}([function(t,e){var s={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in s)i[s[r]]=r;var n={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var r,a,o=i[this.toHex()];if(o)return o;if(null!=e&&e.closest){var h=this.toRgb(),l=1/0,u="black";if(!n.length)for(var d in s)n[d]=new t(s[d]).toRgb();for(var c in s){var p=(r=h,a=n[c],Math.pow(r.r-a.r,2)+Math.pow(r.g-a.g,2)+Math.pow(r.b-a.b,2));pt===e[s]));if(null!==t&&null!==e){const s=Object.keys(t),i=Object.keys(e);return s.length===i.length&&s.every((s=>t[s]===e[s]))}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return(t=null!=t?t:[])[0]=Math.round(255*e),t[1]=Math.round(255*s),t[2]=Math.round(255*i),t}toRgbArray(t){t=null!=t?t:[];const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(t){const[e,s,i,r]=we.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,this._components[3]*=r,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let s=this._int>>16&255,i=this._int>>8&255,r=255&this._int;return e&&(s=s*t+.5|0,i=i*t+.5|0,r=r*t+.5|0),(255*t<<24)+(s<<16)+(i<<8)+r}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=null!=t?t:[];const[e,s,i,r]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=r,t}normalize(t){let e,s,i,r;if(("number"==typeof t||t instanceof Number)&&t>=0&&t<=16777215){e=(t>>16&255)/255,s=(t>>8&255)/255,i=(255&t)/255,r=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,r=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,i,r=255]=t,e/=255,s/=255,i/=255,r/=255;else if("string"==typeof t||"object"==typeof t){if("string"==typeof t){const e=we.HEX_PATTERN.exec(t);e&&(t=`#${e[2]}`)}const n=Re(t);n.isValid()&&(({r:e,g:s,b:i,a:r}=n.rgba),e/=255,s/=255,i/=255)}if(void 0===e)throw new Error(`Unable to convert color ${t}`);this._components[0]=e,this._components[1]=s,this._components[2]=i,this._components[3]=r,this.refreshInt()}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*s|0)}_clamp(t,e=0,s=1){return"number"==typeof t?Math.min(Math.max(t,e),s):(t.forEach(((i,r)=>{t[r]=Math.min(Math.max(i,e),s)})),t)}};let Ie=we;function Me(t){return Kt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ie.shared.setValue(t).toHex()}function Ce(t){return Kt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ie.shared.setValue(t).toNumber()}Ie.shared=new we,Ie.temp=new we,Ie.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;const De=function(){const t=[],e=[];for(let s=0;s<32;s++)t[s]=s,e[s]=s;t[a.NORMAL_NPM]=a.NORMAL,t[a.ADD_NPM]=a.ADD,t[a.SCREEN_NPM]=a.SCREEN,e[a.NORMAL]=a.NORMAL_NPM,e[a.ADD]=a.ADD_NPM,e[a.SCREEN]=a.SCREEN_NPM;const s=[];return s.push(e),s.push(t),s}();function Pe(t,e){return De[e?1:0][t]}const Oe=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function Fe(t,e=null){const s=6*t;if((e=e||new Uint16Array(s)).length!==s)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${s}`);for(let t=0,i=0;t>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function Ge(t){return!(t&t-1||!t)}function Ue(t){let e=(t>65535?1:0)<<4,s=((t>>>=e)>255?1:0)<<3;return e|=s,s=((t>>>=s)>15?1:0)<<2,e|=s,s=((t>>>=s)>3?1:0)<<1,e|=s,e|(t>>>=s)>>1}function ke(t,e,s){const i=t.length;let r;if(e>=i||0===s)return;const n=i-(s=e+s>i?i-e:s);for(r=e;r(t.Renderer="renderer",t.Application="application",t.RendererSystem="renderer-webgl-system",t.RendererPlugin="renderer-webgl-plugin",t.CanvasRendererSystem="renderer-canvas-system",t.CanvasRendererPlugin="renderer-canvas-plugin",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t))(rs||{});const ns=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");const e="object"!=typeof t.extension?{type:t.extension}:t.extension;t=Qi(bt({},e),{ref:t})}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t=bt({},t)).type&&(t.type=[t.type]),t},as=(t,e)=>{var s;return null!=(s=ns(t).priority)?s:e},os={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(ns).forEach((t=>{t.type.forEach((e=>{var s,i;return null==(i=(s=this._removeHandlers)[e])?void 0:i.call(s,t)}))})),this},add(...t){return t.map(ns).forEach((t=>{t.type.forEach((e=>{const s=this._addHandlers,i=this._queue;s[e]?s[e](t):(i[e]=i[e]||[],i[e].push(t))}))})),this},handle(t,e,s){const i=this._addHandlers,r=this._removeHandlers;if(i[t]||r[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,r[t]=s;const n=this._queue;return n[t]&&(n[t].forEach((t=>e(t))),delete n[t]),this},handleByMap(t,e){return this.handle(t,(t=>{e[t.name]=t.ref}),(t=>{delete e[t.name]}))},handleByList(t,e,s=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>as(e,s)-as(t,s))))}),(t=>{const s=e.indexOf(t.ref);-1!==s&&e.splice(s,1)}))}};class hs{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const ls=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function us(t){let e="";for(let s=0;s0&&(e+="\nelse "),s=0;--i){const r=ps[i];if(r.test&&r.test(t,s))return new r(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class ms{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,r,n,a,o){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:l}=this;this._aliasCount++;for(let u=0,d=l.length;u0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(ms.prototype,{dispatch:{value:ms.prototype.emit},run:{value:ms.prototype.emit}});class _s{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ms("setRealSize"),this.onUpdate=new ms("update"),this.onError=new ms("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class gs extends _s{constructor(t,e){const{width:s,height:i}=e||{};if(!s||!i)throw new Error("BufferResource width or height invalid");super(s,i),this.data=t}upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===m.UNPACK);const r=e.realWidth,n=e.realHeight;return s.width===r&&s.height===n?i.texSubImage2D(e.target,0,0,0,r,n,e.format,s.type,this.data):(s.width=r,s.height=n,i.texImage2D(e.target,0,s.internalFormat,r,n,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array}}const xs={scaleMode:c.NEAREST,format:h.RGBA,alphaMode:m.NPM},vs=class extends W{constructor(t=null,e=null){super(),e=Object.assign({},vs.defaultOptions,e);const{alphaMode:s,mipmap:i,anisotropicLevel:r,scaleMode:n,width:a,height:o,wrapMode:h,format:l,type:u,target:d,resolution:c,resourceOptions:p}=e;t&&!(t instanceof _s)&&((t=fs(t,p)).internal=!0),this.resolution=c||A.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=r,this._wrapMode=h,this._scaleMode=n,this.format=l,this.type=u,this.target=d,this.alphaMode=s,this.uid=Ve(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&o>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Ge(this.realWidth)&&Ge(this.realHeight)}setResolution(t){const e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete $e[this.cacheId],delete je[this.cacheId],this.cacheId=null),this.dispose(),vs.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=A.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let r=null;if(i)r=t;else{if(!t._pixiId){const s=(null==e?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${s}_${Ve()}`}r=t._pixiId}let n=$e[r];if(i&&s&&!n)throw new Error(`The cacheId "${r}" does not exist in BaseTextureCache.`);return n||(n=new vs(t,e),n.cacheId=r,vs.addToCache(n,r)),n}static fromBuffer(t,e,s,i){t=t||new Float32Array(e*s*4);const r=new gs(t,{width:e,height:s}),n=t instanceof Float32Array?u.FLOAT:u.UNSIGNED_BYTE;return new vs(r,Object.assign({},xs,{type:n},i))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),$e[e]&&$e[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),$e[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=$e[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete $e[t],e}}else if(null!=t&&t.textureCacheIds){for(let e=0;e1){for(let t=0;t(t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC",t))(Fs||{});class Bs{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new Bs(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`}}const Ns=[new Bs,new Bs,new Bs,new Bs];class Ls{constructor(t=0,e=0,s=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i),this.type=Fs.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new Ls(0,0,0,0)}clone(){return new Ls(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t=this.y&&et.right?t.right:this.right)<=e)return!1;const s=this.yt.bottom?t.bottom:this.bottom)>s}const s=this.left,i=this.right,r=this.top,n=this.bottom;if(i<=s||n<=r)return!1;const a=Ns[0].set(t.left,t.top),o=Ns[1].set(t.left,t.bottom),h=Ns[2].set(t.right,t.top),l=Ns[3].set(t.right,t.bottom);if(h.x<=a.x||o.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u||(e.apply(a,a),e.apply(o,o),e.apply(h,h),e.apply(l,l),Math.max(a.x,o.x,h.x,l.x)<=s||Math.min(a.x,o.x,h.x,l.x)>=i||Math.max(a.y,o.y,h.y,l.y)<=r||Math.min(a.y,o.y,h.y,l.y)>=n))return!1;const d=u*(o.y-a.y),c=u*(a.x-o.x),p=d*s+c*r,f=d*i+c*r,m=d*s+c*n,_=d*i+c*n;if(Math.max(p,f,m,_)<=d*a.x+c*a.y||Math.min(p,f,m,_)>=d*l.x+c*l.y)return!1;const g=u*(a.y-h.y),x=u*(h.x-a.x),v=g*s+x*r,y=g*i+x*r,T=g*s+x*n,b=g*i+x*n;return!(Math.max(v,y,T,b)<=g*a.x+x*a.y||Math.min(v,y,T,b)>=g*l.x+x*l.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),r=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(r-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=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=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),r=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=r-i,this}toString(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class Gs{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=Fs.CIRC}clone(){return new Gs(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,r=this.y-e;return i*=i,r*=r,i+r<=s}getBounds(){return new Ls(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}toString(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class Us{constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i,this.type=Fs.ELIP}clone(){return new Us(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,i=(e-this.y)/this.height;return s*=s,i*=i,s+i<=1}getBounds(){return new Ls(this.x-this.width,this.y-this.height,this.width,this.height)}toString(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class ks{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let s=0,i=e.length;se!=h>e&&t<(e-a)/(h-a)*(o-i)+i&&(s=!s)}return s}toString(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`}}class Xs{constructor(t=0,e=0,s=0,i=0,r=20){this.x=t,this.y=e,this.width=s,this.height=i,this.radius=r,this.type=Fs.RREC}clone(){return new Xs(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),r=e-(this.y+s);const n=s*s;if(i*i+r*r<=n||(i=t-(this.x+this.width-s),i*i+r*r<=n)||(r=e-(this.y+this.height-s),i*i+r*r<=n)||(i=t-(this.x+s),i*i+r*r<=n))return!0}return!1}toString(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}class Hs{constructor(t=1,e=0,s=0,i=1,r=0,n=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,r,n){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=r,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new Bs;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new Bs;const s=1/(this.a*this.d+this.c*-this.b),i=t.x,r=t.y;return e.x=this.d*s*i+-this.c*s*r+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*r+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,r=this.c,n=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=r*e-this.d*s,this.d=r*s+this.d*e,this.tx=n*e-this.ty*s,this.ty=n*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,r=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*r,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*r,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*r+this.ty,this}setTransform(t,e,s,i,r,n,a,o,h){return this.a=Math.cos(a+h)*r,this.b=Math.sin(a+h)*r,this.c=-Math.sin(a-o)*n,this.d=Math.cos(a-o)*n,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,s=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,r=this.d,n=t.pivot,a=-Math.atan2(-i,r),o=Math.atan2(s,e),h=Math.abs(a+o);return h<1e-5||Math.abs(Ds-h)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=o),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+r*r),t.position.x=this.tx+(n.x*e+n.y*i),t.position.y=this.ty+(n.x*s+n.y*r),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,r=this.tx,n=t*i-e*s;return this.a=i/n,this.b=-e/n,this.c=-s/n,this.d=t/n,this.tx=(s*this.ty-i*r)/n,this.ty=-(t*this.ty-e*r)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new Hs;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}toString(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return new Hs}static get TEMP_MATRIX(){return new Hs}}const Vs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],zs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ws=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ys=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],js=[],$s=[],qs=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];js.push(e);for(let s=0;s<16;s++){const i=qs(Vs[t]*Vs[s]+Ws[t]*zs[s]),r=qs(zs[t]*Vs[s]+Ys[t]*zs[s]),n=qs(Vs[t]*Ws[s]+Ws[t]*Ys[s]),a=qs(zs[t]*Ws[s]+Ys[t]*Ys[s]);for(let t=0;t<16;t++)if(Vs[t]===i&&zs[t]===r&&Ws[t]===n&&Ys[t]===a){e.push(t);break}}}for(let t=0;t<16;t++){const e=new Hs;e.set(Vs[t],zs[t],Ws[t],Ys[t],0,0),$s.push(e)}}();const Ks={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:t=>Vs[t],uY:t=>zs[t],vX:t=>Ws[t],vY:t=>Ys[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>js[t][e],sub:(t,e)=>js[t][Ks.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?Ks.S:Ks.N:2*Math.abs(e)<=Math.abs(t)?t>0?Ks.E:Ks.W:e>0?t>0?Ks.SE:Ks.SW:t>0?Ks.NE:Ks.NW,matrixAppendRotationInv:(t,e,s=0,i=0)=>{const r=$s[Ks.inv(e)];r.tx=s,r.ty=i,t.append(r)}};class Zs{constructor(t,e,s=0,i=0){this._x=s,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new Zs(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[@pixi/math:ObservablePoint x=0 y=0 scope=${this.scope}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const Qs=class{constructor(){this.worldTransform=new Hs,this.localTransform=new Hs,this.position=new Zs(this.onChange,this,0,0),this.scale=new Zs(this.onChange,this,1,1),this.pivot=new Zs(this.onChange,this,0,0),this.skew=new Zs(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}toString(){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}) ]`}updateLocalTransform(){const 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)}updateTransform(t){const 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){const s=t.worldTransform,i=this.worldTransform;i.a=e.a*s.a+e.b*s.c,i.b=e.a*s.b+e.b*s.d,i.c=e.c*s.a+e.d*s.c,i.d=e.c*s.b+e.d*s.d,i.tx=e.tx*s.a+e.ty*s.c+s.tx,i.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};let Js=Qs;Js.IDENTITY=new Qs;function ti(t,e,s){const i=t.createShader(e);return t.shaderSource(i,s),t.compileShader(i),i}function ei(t){const e=new Array(t);for(let t=0;t"float"===t.type&&1===t.size&&!t.isArray,code:t=>`\n if(uv["${t}"] !== ud["${t}"].value)\n {\n ud["${t}"].value = uv["${t}"]\n gl.uniform1f(ud["${t}"].location, uv["${t}"])\n }\n `},{test:(t,e)=>!("sampler2D"!==t.type&&"samplerCube"!==t.type&&"sampler2DArray"!==t.type||1!==t.size||t.isArray||null!=e&&void 0===e.castToBaseTexture),code:t=>`t = syncData.textureCount++;\n\n renderer.texture.bind(uv["${t}"], t);\n\n if(ud["${t}"].value !== t)\n {\n ud["${t}"].value = t;\n gl.uniform1i(ud["${t}"].location, t);\n; // eslint-disable-line max-len\n }`},{test:(t,e)=>"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a,code:t=>`\n gl.uniformMatrix3fv(ud["${t}"].location, false, uv["${t}"].toArray(true));\n `,codeUbo:t=>`\n var ${t}_matrix = uv.${t}.toArray(true);\n\n data[offset] = ${t}_matrix[0];\n data[offset+1] = ${t}_matrix[1];\n data[offset+2] = ${t}_matrix[2];\n \n data[offset + 4] = ${t}_matrix[3];\n data[offset + 5] = ${t}_matrix[4];\n data[offset + 6] = ${t}_matrix[5];\n \n data[offset + 8] = ${t}_matrix[6];\n data[offset + 9] = ${t}_matrix[7];\n data[offset + 10] = ${t}_matrix[8];\n `},{test:(t,e)=>"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["${t}"].location, v.x, v.y);\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `},{test:t=>"vec2"===t.type&&1===t.size&&!t.isArray,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["${t}"].location, v[0], v[1]);\n }\n `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["${t}"].location, v.x, v.y, v.width, v.height)\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud["${t}"].location, v.red, v.green, v.blue, v.alpha)\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n data[offset+3] = v.alpha;\n `},{test:(t,e)=>"vec3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)\n {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n \n gl.uniform3f(ud["${t}"].location, v.red, v.green, v.blue)\n }`,codeUbo:t=>`\n v = uv.${t};\n\n data[offset] = v.red;\n data[offset+1] = v.green;\n data[offset+2] = v.blue;\n `},{test:t=>"vec4"===t.type&&1===t.size&&!t.isArray,code:t=>`\n cv = ud["${t}"].value;\n v = uv["${t}"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["${t}"].location, v[0], v[1], v[2], v[3])\n }`}],ri={float:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }",vec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",int:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",ivec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",ivec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",ivec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",uint:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }",uvec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }",uvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }",uvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",bool:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }",bvec2:"\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",bvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",bvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",samplerCube:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",sampler2DArray:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }"},ni={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)"};const ai={};let oi,hi=ai;function li(){if(hi===ai||(null==hi?void 0:hi.isContextLost())){const t=A.ADAPTER.createCanvas();let e;A.PREFER_ENV>=i.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),hi=e}return hi}function ui(t,e){const s=t.getShaderSource(e).split("\n").map(((t,e)=>`${e}: ${t}`)),i=t.getShaderInfoLog(e),r=i.split("\n"),n={},a=r.map((t=>parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1")))).filter((t=>!(!t||n[t])&&(n[t]=!0,!0))),o=[""];a.forEach((t=>{s[t-1]=`%c${s[t-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));const h=s.join("\n");o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}const di={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 ci(t){return di[t]}let pi=null;const fi={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 mi(t,e){if(!pi){const e=Object.keys(fi);pi={};for(let s=0;s0&&(e+="\nelse "),sthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=Mi._textureArrayPool,i=this.renderer.batch,r=this._tempBoundTextures,n=this.renderer.textureGC.count;let a=++ys._globalBatch,o=0,h=s[0],l=0;i.copyBoundTextures(r,e);for(let u=0;u=e&&(i.boundArray(h,r,a,e),this.buildDrawCalls(h,l,u),l=u,h=s[++o],++a),d._batchEnabled=a,d.touched=n,h.elements[h.count++]=d)}h.count>0&&(i.boundArray(h,r,a,e),this.buildDrawCalls(h,l,this._bufferSize),++o,++a);for(let t=0;t0);for(let t=0;t=0;--i)t[i]=s[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,s,i){const{elements:r,ids:n,count:a}=t;let o=0;for(let t=0;t=0&&h=i.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout((()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()}),0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,void 0!==t.removeEventListener&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const i=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Ni.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ni.extension={type:rs.RendererSystem,name:"context"},os.add(Ni);class Li extends gs{upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===m.UNPACK);const r=e.realWidth,n=e.realHeight;return s.width===r&&s.height===n?i.texSubImage2D(e.target,0,0,0,r,n,e.format,s.type,this.data):(s.width=r,s.height=n,i.texImage2D(e.target,0,s.internalFormat,r,n,0,e.format,s.type,this.data)),!0}}class Gi{constructor(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 ms("disposeFramebuffer"),this.multisample=T.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ys(null,{scaleMode:c.NEAREST,resolution:1,mipmap:f.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ys(new Li(null,{width:this.width,height:this.height}),{scaleMode:c.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:f.OFF,format:h.DEPTH_COMPONENT,type:u.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s{const s=this.source;this.url=s.src;const i=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.resize(s.width,s.height),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?i():(s.onload=i,s.onerror=t=>{e(t),this.onError.emit(t)})}))),this._load}process(){const t=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then((t=>t.blob())).then((s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===m.UNPACK?"premultiply":"none"}))).then((t=>this.destroyed?Promise.reject():(this.bitmap=t,this.update(),this._process=null,Promise.resolve(this)))),this._process}upload(t,e,s){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let t=!0;const i=e._glTextures;for(const r in i){const n=i[r];if(n!==s&&n.dirtyId!==e.dirtyId){t=!1;break}}t&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return"undefined"!=typeof HTMLImageElement&&("string"==typeof t||t instanceof HTMLImageElement)}}class Hi{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const i=e.width,r=e.height;if(s){const e=t.width/2/i,n=t.height/2/r,a=t.x/i+e,o=t.y/r+n;s=Ks.add(s,Ks.NW),this.x0=a+e*Ks.uX(s),this.y0=o+n*Ks.uY(s),s=Ks.add(s,2),this.x1=a+e*Ks.uX(s),this.y1=o+n*Ks.uY(s),s=Ks.add(s,2),this.x2=a+e*Ks.uX(s),this.y2=o+n*Ks.uY(s),s=Ks.add(s,2),this.x3=a+e*Ks.uX(s),this.y3=o+n*Ks.uY(s)}else this.x0=t.x/i,this.y0=t.y/r,this.x1=(t.x+t.width)/i,this.y1=t.y/r,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/r,this.x3=t.x/i,this.y3=(t.y+t.height)/r;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}toString(){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}]`}}const Vi=new Hi;function zi(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}class Wi extends W{constructor(t,e,s,i,r,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new Ls(0,0,1,1)),t instanceof Wi&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this._uvs=Vi,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(r||0),!0===r)this._rotate=2;else if(this._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new Bs(n.x,n.y):new Bs(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:t}=this.baseTexture;(null==t?void 0:t.url)&&je[t.url]&&Wi.removeFromCache(t.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,Wi.removeFromCache(this),this.textureCacheIds=null}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),i=new Wi(this.baseTexture,!this.noFrame&&e,s,null==(t=this.trim)?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===Vi&&(this._uvs=new Hi),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=A.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let r=null;if(i)r=t;else if(t instanceof ys){if(!t.cacheId){const s=(null==e?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${s}-${Ve()}`,ys.addToCache(t,t.cacheId)}r=t.cacheId}else{if(!t._pixiId){const s=(null==e?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${s}_${Ve()}`}r=t._pixiId}let n=je[r];if(i&&s&&!n)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return n||t instanceof ys?!n&&t instanceof ys&&(n=new Wi(t),Wi.addToCache(n,r)):(e.resolution||(e.resolution=ss(t)),n=new Wi(new ys(t,e)),n.baseTexture.cacheId=r,ys.addToCache(n.baseTexture,r),Wi.addToCache(n,r)),n}static fromURL(t,e){const s=Object.assign({autoLoad:!1},null==e?void 0:e.resourceOptions),i=Wi.from(t,Object.assign({resourceOptions:s},e),!1),r=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):r.load().then((()=>Promise.resolve(i)))}static fromBuffer(t,e,s,i){return new Wi(ys.fromBuffer(t,e,s,i))}static fromLoader(t,e,s,i){const r=new ys(t,Object.assign({scaleMode:ys.defaultOptions.scaleMode,resolution:ss(e)},i)),{resource:n}=r;n instanceof Xi&&(n.url=e);const a=new Wi(r);return s||(s=e),ys.addToCache(a.baseTexture,s),Wi.addToCache(a,s),s!==e&&(ys.addToCache(a.baseTexture,e),Wi.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise((t=>{a.baseTexture.once("loaded",(()=>t(a)))}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),je[e]&&je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),je[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=je[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete je[t],e}}else if(null!=t&&t.textureCacheIds){for(let e=0;ethis.baseTexture.width,a=s+r>this.baseTexture.height;if(n||a){const t=n&&a?"and":"or",o=`X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width}`,h=`Y: ${s} + ${r} = ${s+r} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${o} ${t} ${h}`)}this.valid=i&&r&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return Wi._EMPTY||(Wi._EMPTY=new Wi(new ys),zi(Wi._EMPTY),zi(Wi._EMPTY.baseTexture)),Wi._EMPTY}static get WHITE(){if(!Wi._WHITE){const t=A.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),Wi._WHITE=new Wi(ys.from(t)),zi(Wi._WHITE),zi(Wi._WHITE.baseTexture)}return Wi._WHITE}}class Yi extends Wi{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const i=this.baseTexture.resolution,r=Math.round(t*i)/i,n=Math.round(e*i)/i;this.valid=r>0&&n>0,this._frame.width=this.orig.width=r,this._frame.height=this.orig.height=n,s&&this.baseTexture.resize(r,n),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Yi(new Ui(t))}}class ji{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=T.NONE){const i=new Ui(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Yi(i)}getOptimalTexture(t,e,s=1,i=T.NONE){let r;t=Math.ceil(t*s-1e-6),e=Math.ceil(e*s-1e-6),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?r=i>1?-i:-1:(r=((65535&(t=Le(t)))<<16|65535&(e=Le(e)))>>>0,i>1&&(r+=4294967296*i)),this.texturePool[r]||(this.texturePool[r]=[]);let n=this.texturePool[r].pop();return n||(n=this.createTexture(t,e,i)),n.filterPoolKey=r,n.setResolution(s),n}getFilterTexture(t,e,s){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||T.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=!1!==t)for(const t in this.texturePool){const e=this.texturePool[t];if(e)for(let t=0;t0&&t.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const e=this.texturePool[t];if(e)for(let t=0;t1&&(i=this.getOptimalFilterTexture(t.width,t.height,e.resolution),i.filterFrame=t.filterFrame),s[r].apply(this,t,i,_.CLEAR,e);const n=t;t=i,i=n}s[r].apply(this,t,o.renderTexture,_.BLEND,e),r>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(t),this.returnFilterTexture(i)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=_.CLEAR){const{renderTexture:s,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,null!=t&&t.filterFrame){const e=this.tempRect;e.x=0,e.y=0,e.width=t.filterFrame.width,e.height=t.filterFrame.height,s.bind(t,t.filterFrame,e)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const r=1&i.stateId||this.forceClear;(e===_.CLEAR||e===_.BLIT&&r)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,i){const r=this.renderer;r.state.set(t.state),this.bindAndClear(s,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,r.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),r.geometry.bind(this.quadUv),r.geometry.draw(o.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(o.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:i}=this.activeState,{orig:r}=e._texture,n=t.set(i.width,0,0,i.height,s.x,s.y),a=e.worldTransform.copyTo(Hs.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/r.width,1/r.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,i=T.NONE){return this.texturePool.getOptimalTexture(t,e,s,i)}getFilterTexture(t,e,s){if("number"==typeof t){const s=t;t=e,e=s}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||T.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Zi[0],i=Zi[1],r=Zi[2],n=Zi[3];s.set(e.left,e.top),i.set(e.left,e.bottom),r.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(s,s),t.apply(i,i),t.apply(r,r),t.apply(n,n);const a=Math.min(s.x,i.x,r.x,n.x),o=Math.min(s.y,i.y,r.y,n.y),h=Math.max(s.x,i.x,r.x,n.x),l=Math.max(s.y,i.y,r.y,n.y);e.x=a,e.y=o,e.width=h-a,e.height=l-o}roundFrame(t,e,s,i,r){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(r){const{a:t,b:e,c:s,d:i}=r;if((Math.abs(e)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(i)>1e-4))return}(r=r?Ji.copyFrom(r):Ji.identity()).translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.transformAABB(r,t),t.ceil(e),this.transformAABB(r.invert(),t)}}}tr.extension={type:rs.RendererSystem,name:"filter"},os.add(tr);class er{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=T.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const sr=new Ls;class ir{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Gi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Ls,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;A.PREFER_ENV===i.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:i}=this;if(t){const r=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,r.framebuffer)),r.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,r.mipLevel=s),r.dirtyId!==t.dirtyId&&(r.dirtyId=t.dirtyId,r.dirtyFormat!==t.dirtyFormat?(r.dirtyFormat=t.dirtyFormat,r.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):r.dirtySize!==t.dirtySize&&(r.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let e=0;e>s,i=e.height>>s,r=t/e.width;this.setViewport(e.x*r,e.y*r,t,i)}else{const e=t.width>>s,i=t.height>>s;this.setViewport(0,0,e,i)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,i){const r=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),(r.width!==s||r.height!==i||r.x!==t||r.y!==e)&&(r.x=t,r.y=e,r.width=s,r.height=i,this.gl.viewport(t,e,s,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,i,r=n.COLOR|n.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,i),a.clear(r)}initFramebuffer(t){const{gl:e}=this,s=new er(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];s.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,s.stencil),s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));const i=t.colorTextures;let r=i.length;e.drawBuffers||(r=Math.min(r,1));for(let n=0;n1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||s.createRenderbuffer():i.msaaBuffer&&(s.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const a=[];for(let o=0;o1&&s.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const i=t.depthTexture;this.renderer.texture.bind(i,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,i._glTextures[this.CONTEXT_UID].texture,e)}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?i.stencil&&(s.deleteRenderbuffer(i.stencil),i.stencil=null):(i.stencil=i.stencil||s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,i.stencil),i.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,s.DEPTH24_STENCIL8,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,i.stencil))}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=T.NONE;if(t<=1||null===e)return s;for(let i=0;i=0&&this.managedFramebuffers.splice(r,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&i.deleteRenderbuffer(s.msaaBuffer),s.stencil&&i.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;se.createVertexArrayOES(),t.bindVertexArray=t=>e.bindVertexArrayOES(t),t.deleteVertexArray=t=>e.deleteVertexArrayOES(t)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(2!==e.webGLVersion){const e=t.getExtension("ANGLE_instanced_arrays");e?(t.vertexAttribDivisor=(t,s)=>e.vertexAttribDivisorANGLE(t,s),t.drawElementsInstanced=(t,s,i,r,n)=>e.drawElementsInstancedANGLE(t,s,i,r,n),t.drawArraysInstanced=(t,s,i,r)=>e.drawArraysInstancedANGLE(t,s,i,r)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let i=t.glVertexArrayObjects[this.CONTEXT_UID],r=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},r=!0);const n=i[e.program.id]||this.initGeometryVao(t,e,r);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?s.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask(0!=(1&s),0!=(2&s),0!=(4&s),0!=(8&s))}destroy(){this.renderer=null}}ur.extension={type:rs.RendererSystem,name:"mask"},os.add(ur);class dr{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==s&&(0===i?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const cr=new Hs,pr=[],fr=class extends dr{constructor(t){super(t),this.glConst=A.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:i}=t,{renderer:r}=this,n=r.renderTexture,a=i.getBounds(!0,null!=(e=pr.pop())?e:new Ls);this.roundFrameToPixels(a,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),s&&a.fit(s),t._scissorRectLocal=a}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:i,d:r}=t;return(Math.abs(s)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(r)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||fr.isMatrixRotated(e.worldTransform)||fr.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,i,r){fr.isMatrixRotated(r)||((r=r?cr.copyFrom(r):cr.identity()).translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.renderer.filter.transformAABB(r,t),t.fit(i),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&pr.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};let mr=fr;mr.extension={type:rs.RendererSystem,name:"scissor"},os.add(mr);class _r extends dr{constructor(t){super(t),this.glConst=A.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const r=t._colorMask;0!==r&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,i,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==r&&(t._colorMask=r,s.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))),this._useCurrent()}pop(t){const e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{const s=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=s?s._colorMask:15;0!==i&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==i&&(s._colorMask=i,e.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}_r.extension={type:rs.RendererSystem,name:"stencil"},os.add(_r);class gr{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get:()=>(Kt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract)},prepare:{enumerable:!1,get:()=>(Kt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare)},interaction:{enumerable:!1,get:()=>(Kt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events)}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}gr.extension={type:[rs.RendererSystem,rs.CanvasRendererSystem],name:"_plugin"},os.add(gr);class xr{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Hs,this.transform=null}update(t,e,s,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,i),this.transform&&this.projectionMatrix.append(this.transform);const r=this.renderer;r.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,r.globalUniforms.update(),r.shader.shader&&r.shader.syncUniformGroup(r.shader.shader.uniforms.globals)}calculateProjection(t,e,s,i){const r=this.projectionMatrix,n=i?-1:1;r.identity(),r.a=1/e.width*2,r.d=n*(1/e.height*2),r.tx=-1-e.x*r.a,r.ty=-n-e.y*r.d}setTransform(t){}destroy(){this.renderer=null}}xr.extension={type:rs.RendererSystem,name:"projection"},os.add(xr);const vr=new Js;class yr{constructor(t){this.renderer=t,this._tempMatrix=new Hs}generateTexture(t,e){const s=e||{},{region:i}=s,r=zn(s,["region"]),n=i||t.getLocalBounds(null,!0);0===n.width&&(n.width=1),0===n.height&&(n.height=1);const a=Yi.create(bt({width:n.width,height:n.height},r));this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=t.transform;return t.transform=vr,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,a}destroy(){}}yr.extension={type:[rs.RendererSystem,rs.CanvasRendererSystem],name:"textureGenerator"},os.add(yr);const Tr=new Ls,br=new Ls;class Er{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Ls,this.destinationFrame=new Ls,this.viewportFrame=new Ls}contextChange(){var t;const e=null==(t=this.renderer)?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const i=this.renderer;let r,n,a;this.current=t,t?(r=t.baseTexture,a=r.resolution,e||(Tr.width=t.frame.width,Tr.height=t.frame.height,e=Tr),s||(br.x=t.frame.x,br.y=t.frame.y,br.width=e.width,br.height=e.height,s=br),n=r.framebuffer):(a=i.resolution,e||(Tr.width=i._view.screen.width,Tr.height=i._view.screen.height,e=Tr),s||((s=Tr).width=e.width,s.height=e.height));const o=this.viewportFrame;o.x=s.x*a,o.y=s.y*a,o.width=s.width*a,o.height=s.height*a,t||(o.y=i.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(n,o),this.renderer.projection.update(s,e,a,!n),t?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,i=Ie.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const r=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=r.width!==n.width||r.height!==n.height;if(a){let{x:t,y:e,width:s,height:i}=this.viewportFrame;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(t,e,s,i)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Er.extension={type:rs.RendererSystem,name:"renderTexture"},os.add(Er);class Ar{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Rr(t,e){var s;const i=ti(t,t.VERTEX_SHADER,e.vertexSrc),r=ti(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();t.attachShader(n,i),t.attachShader(n,r);const a=null==(s=e.extra)?void 0:s.transformFeedbackVaryings;if(a&&("function"!=typeof t.transformFeedbackVaryings?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(n,a.names,"separate"===a.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||function(t,e,s,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(s,t.COMPILE_STATUS)||ui(t,s),t.getShaderParameter(i,t.COMPILE_STATUS)||ui(t,i),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,n,i,r),e.attributeData=function(t,e){const s={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;rt>e?1:-1));for(let i=0;i({data:t,offset:0,dataLen:0,dirty:0})));let s=0,i=0,r=0;for(let t=0;t1&&(s=Math.max(s,16)*n.data.size),n.dataLen=s,i%s!=0&&i<16){const t=i%s%16;i+=t,r+=t}i+s>16?(r=16*Math.ceil(r/16),n.offset=r,r+=s,i=s):(n.offset=r,i+=s,r+=s)}return r=16*Math.ceil(r/16),{uboElements:e,size:r}}function Cr(t,e){const s=[];for(const i in t)e[i]&&s.push(e[i]);return s.sort(((t,e)=>t.index-e.index)),s}function Dr(t,e){if(!t.autoManage)return{size:0,syncFunc:Sr};const s=Cr(t.uniforms,e),{uboElements:i,size:r}=Mr(s),n=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "];for(let e=0;e1){const t=ci(s.data.type),e=Math.max(Ir[s.data.type]/16,1),i=t/e,r=(4-i%4)%4;n.push(`\n cv = ud.${a}.value;\n v = uv.${a};\n offset = ${s.offset/4};\n\n t = 0;\n\n for(var i=0; i < ${s.data.size*e}; i++)\n {\n for(var j = 0; j < ${i}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${r};\n }\n\n `)}else{const t=wr[s.data.type];n.push(`\n cv = ud.${a}.value;\n v = uv.${a};\n offset = ${s.offset/4};\n ${t};\n `)}}return n.push("\n renderer.buffer.update(buffer);\n "),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join("\n"))}}let Pr=0;const Or={textureCount:0,uboCount:0};class Fr{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Pr++}systemCheck(){if(!xi())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,i=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(i.program)),e||(Or.textureCount=0,Or.uboCount=0,this.syncUniformGroup(t.uniformGroup,Or)),i}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){var s;const i=["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "];for(const r in t.uniforms){const n=e[r];if(!n){null!=(s=t.uniforms[r])&&s.group&&(t.uniforms[r].ubo?i.push(`\n renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');\n `):i.push(`\n renderer.shader.syncUniformGroup(uv.${r}, syncData);\n `));continue}const a=t.uniforms[r];let o=!1;for(let t=0;t>=1,s++;this.stateId=t.data}for(let e=0;et.systems[e])),i=[...s,...Object.keys(t.systems).filter((t=>!s.includes(t)))];for(const e of i)this.addSystem(t.systems[e],e)}addRunners(...t){t.forEach((t=>{this.runners[t]=new ms(t)}))}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const t in this.runners)this.runners[t].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach((i=>{const r=s.find((t=>this._systemsHash[t]===i));i[t.name](e[r])}))}destroy(){Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash={}}}const Ur=class{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Ur.defaultMaxIdle,this.checkCountMax=Ur.defaultCheckCountMax,this.mode=Ur.defaultMode}postrender(){!this.renderer.objectRenderer.renderingToScreen||(this.count++,this.mode!==g.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let i=0;ithis.maxIdle&&(t.destroyTexture(r,!0),e[i]=null,s=!0)}if(s){let t=0;for(let s=0;s=0;e--)this.unload(t.children[e])}destroy(){this.renderer=null}};let kr=Ur;kr.defaultMode=g.AUTO,kr.defaultMaxIdle=3600,kr.defaultCheckCountMax=600,kr.extension={type:rs.RendererSystem,name:"textureGC"},os.add(kr);class Xr{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=u.UNSIGNED_BYTE,this.internalFormat=h.RGBA,this.samplerType=0}}class Hr{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ys,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(t){let e;return e="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[u.UNSIGNED_BYTE]:{[h.RGBA]:t.RGBA8,[h.RGB]:t.RGB8,[h.RG]:t.RG8,[h.RED]:t.R8,[h.RGBA_INTEGER]:t.RGBA8UI,[h.RGB_INTEGER]:t.RGB8UI,[h.RG_INTEGER]:t.RG8UI,[h.RED_INTEGER]:t.R8UI,[h.ALPHA]:t.ALPHA,[h.LUMINANCE]:t.LUMINANCE,[h.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[u.BYTE]:{[h.RGBA]:t.RGBA8_SNORM,[h.RGB]:t.RGB8_SNORM,[h.RG]:t.RG8_SNORM,[h.RED]:t.R8_SNORM,[h.RGBA_INTEGER]:t.RGBA8I,[h.RGB_INTEGER]:t.RGB8I,[h.RG_INTEGER]:t.RG8I,[h.RED_INTEGER]:t.R8I},[u.UNSIGNED_SHORT]:{[h.RGBA_INTEGER]:t.RGBA16UI,[h.RGB_INTEGER]:t.RGB16UI,[h.RG_INTEGER]:t.RG16UI,[h.RED_INTEGER]:t.R16UI,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[u.SHORT]:{[h.RGBA_INTEGER]:t.RGBA16I,[h.RGB_INTEGER]:t.RGB16I,[h.RG_INTEGER]:t.RG16I,[h.RED_INTEGER]:t.R16I},[u.UNSIGNED_INT]:{[h.RGBA_INTEGER]:t.RGBA32UI,[h.RGB_INTEGER]:t.RGB32UI,[h.RG_INTEGER]:t.RG32UI,[h.RED_INTEGER]:t.R32UI,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[u.INT]:{[h.RGBA_INTEGER]:t.RGBA32I,[h.RGB_INTEGER]:t.RGB32I,[h.RG_INTEGER]:t.RG32I,[h.RED_INTEGER]:t.R32I},[u.FLOAT]:{[h.RGBA]:t.RGBA32F,[h.RGB]:t.RGB32F,[h.RG]:t.RG32F,[h.RED]:t.R32F,[h.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[u.HALF_FLOAT]:{[h.RGBA]:t.RGBA16F,[h.RGB]:t.RGB16F,[h.RG]:t.RG16F,[h.RED]:t.R16F},[u.UNSIGNED_SHORT_5_6_5]:{[h.RGB]:t.RGB565},[u.UNSIGNED_SHORT_4_4_4_4]:{[h.RGBA]:t.RGBA4},[u.UNSIGNED_SHORT_5_5_5_1]:{[h.RGBA]:t.RGB5_A1},[u.UNSIGNED_INT_2_10_10_10_REV]:{[h.RGBA]:t.RGB10_A2,[h.RGBA_INTEGER]:t.RGB10_A2UI},[u.UNSIGNED_INT_10F_11F_11F_REV]:{[h.RGB]:t.R11F_G11F_B10F},[u.UNSIGNED_INT_5_9_9_9_REV]:{[h.RGB]:t.RGB9_E5},[u.UNSIGNED_INT_24_8]:{[h.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[u.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[h.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:{[u.UNSIGNED_BYTE]:{[h.RGBA]:t.RGBA,[h.RGB]:t.RGB,[h.ALPHA]:t.ALPHA,[h.LUMINANCE]:t.LUMINANCE,[h.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[u.UNSIGNED_SHORT_5_6_5]:{[h.RGB]:t.RGB},[u.UNSIGNED_SHORT_4_4_4_4]:{[h.RGBA]:t.RGBA},[u.UNSIGNED_SHORT_5_5_5_1]:{[h.RGBA]:t.RGBA}},e}(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let t=0;t=0;--s){const t=e[s];t&&t._glTextures[i].samplerType!==d.FLOAT&&this.renderer.texture.unbind(t)}}initTexture(t){const e=new Xr(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var s,i;e.internalFormat=null!=(i=null==(s=this.internalFormats[t.type])?void 0:s[t.format])?i:t.format,2===this.webGLVersion&&t.type===u.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const i=this.renderer;if(this.initTextureType(t,s),null!=(e=t.resource)&&e.upload(i,t,s))s.samplerType!==d.FLOAT&&(this.hasIntegerTextures=!0);else{const e=t.realWidth,r=t.realHeight,n=i.gl;(s.width!==e||s.height!==r||s.dirtyId<0)&&(s.width=e,s.height=r,n.texImage2D(t.target,0,s.internalFormat,e,r,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const e=this.managedTextures.indexOf(t);-1!==e&&ke(this.managedTextures,e,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];!s||(t.mipmap!==f.POW2&&2===this.webGLVersion||t.isPowerOfTwo?s.mipmap=t.mipmap>=1:s.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?s.wrapMode=t.wrapMode:s.wrapMode=p.CLAMP,null!=(e=t.resource)&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==f.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===c.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const e=this.renderer.context.extensions.anisotropicFiltering;if(e&&t.anisotropicLevel>0&&t.scaleMode===c.LINEAR){const i=Math.min(t.anisotropicLevel,s.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY_EXT,i)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===c.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===c.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Hr.extension={type:rs.RendererSystem,name:"texture"},os.add(Hr);class Vr{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:i}=this;e&&i.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:i}=this,r=e.createTransformFeedback();t._glTransformFeedbacks[i]=r,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r);for(let r=0;rys.defaultOptions.wrapMode,set(t){Kt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ys.defaultOptions.wrapMode=t}},SCALE_MODE:{get:()=>ys.defaultOptions.scaleMode,set(t){Kt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ys.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get:()=>ys.defaultOptions.mipmap,set(t){Kt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ys.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get:()=>ys.defaultOptions.anisotropicLevel,set(t){Kt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ys.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get:()=>(Kt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Pi.defaultResolution),set(t){Pi.defaultResolution=t}},FILTER_MULTISAMPLE:{get:()=>(Kt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Pi.defaultMultisample),set(t){Pi.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get:()=>Ci.defaultMaxTextures,set(t){Kt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Ci.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get:()=>Ci.defaultBatchSize,set(t){Kt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Ci.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get:()=>Ci.canUploadSameBuffer,set(t){Kt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Ci.canUploadSameBuffer=t}},GC_MODE:{get:()=>kr.defaultMode,set(t){Kt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),kr.defaultMode=t}},GC_MAX_IDLE:{get:()=>kr.defaultMaxIdle,set(t){Kt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),kr.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get:()=>kr.defaultCheckCountMax,set(t){Kt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),kr.defaultCheckCountMax=t}},PRECISION_VERTEX:{get:()=>bi.defaultVertexPrecision,set(t){Kt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),bi.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get:()=>bi.defaultFragmentPrecision,set(t){Kt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),bi.defaultFragmentPrecision=t}}});var Wr=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(Wr||{});class Yr{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const jr=class{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Yr(null,null,1/0),this.deltaMS=1/jr.targetFPMS,this.elapsedMS=1/jr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=Wr.NORMAL){return this._addListener(new Yr(t,e,s))}addOnce(t,e,s=Wr.NORMAL){return this._addListener(new Yr(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}else t.connect(s);return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s=s.match(t,e)?s.destroy():s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const e=t-this._lastFrame|0;if(e$r.targetFPMS,set(t){Kt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),$r.targetFPMS=t}}});class qr{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Wr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?$r.shared:new $r,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}qr.extension=rs.Application,os.add(qr);const Kr=[];function Zr(t){for(const e of Kr)if(e.test(t))return new e(t);throw new Error("Unable to auto-detect a suitable renderer.")}os.handleByList(rs.Renderer,Kr);const Qr="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",Jr="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n";class tn{constructor(t){this.renderer=t}contextChange(t){let e;if(1===this.renderer.context.webGLVersion){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=T.HIGH?this.multisample=T.HIGH:e>=T.MEDIUM?this.multisample=T.MEDIUM:e>=T.LOW?this.multisample=T.LOW:this.multisample=T.NONE}destroy(){}}tn.extension={type:rs.RendererSystem,name:"_multisample"},os.add(tn);class en{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class sn{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const r=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,r.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:r}=this;s=s||0;const n=t._glBuffers[r]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,n.buffer,256*s,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==i.updateID)if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const s=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,s)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),s&&(e||i.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;st.resource)).filter((t=>t)).map((t=>t.load()));return this._load=Promise.all(t).then((()=>{const{realWidth:t,realHeight:e}=this.items[0];return this.resize(t,e),Promise.resolve(this)})),this._load}}class hn extends on{constructor(t,e){const{width:s,height:i}=e||{};let r,n;Array.isArray(t)?(r=t,n=t.length):n=t,super(n,{width:s,height:i}),r&&this.initFromArray(r,e)}addBaseTextureAt(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this}bind(t){super.bind(t),t.target=l.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:i,itemDirtyIds:r,items:n}=this,{gl:a}=t;s.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,i,0,e.format,s.type,null);for(let t=0;t0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=l.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const i=this.itemDirtyIds;for(let r=0;r{if(null!==this.url)try{const e=await A.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await e.blob();if(this.destroyed)return;const i=await createImageBitmap(s,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===m.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=i,this.update(),t(this)}catch(t){if(this.destroyed)return;e(t),this.onError.emit(t)}else t(this)}))),this._load}upload(t,e,s){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){var t;return cn._EMPTY=null!=(t=cn._EMPTY)?t:A.ADAPTER.createCanvas(0,0),cn._EMPTY}}const pn=class extends ki{constructor(t,e){e=e||{},super(A.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((t=>{if(this._resolve=()=>{this.resize(this.source.width,this.source.height),t(this)},pn.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}))),this._load}_loadSvg(){const t=new Image;ki.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{!this._resolve||(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=e*this.scale,r=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*e,r=this._overrideHeight||this._overrideWidth/e*s),i=Math.round(i),r=Math.round(r);const n=this.source;n.width=i,n.height=r,n._pixiId=`canvas_${Ve()}`,n.getContext("2d").drawImage(t,0,0,e,s,0,0,i,r),this._resolve(),this._resolve=null}}static getSize(t){const e=pn.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return"svg"===e||"string"==typeof t&&t.startsWith("data:image/svg+xml")||"string"==typeof t&&pn.SVG_XML.test(t)}};let fn=pn;fn.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const mn=class extends ki{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),"string"==typeof t&&(t=[t]);const i=t[0].src||t[0];ki.crossOrigin(s,i,e.crossorigin);for(let e=0;e{this.valid?e(this):(this._resolve=e,t.load())})),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&($r.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&($r.shared.remove(this.update,this),this._isConnectedToTicker=!1)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._isConnectedToTicker&&($r.shared.remove(this.update,this),this._isConnectedToTicker=!1);const t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?($r.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&($r.shared.add(this.update,this),this._isConnectedToTicker=!0))}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t)}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||mn.TYPES.includes(e)}};let _n=mn;_n.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],_n.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},ps.push(cn,Xi,ln,_n,fn,gs,dn,hn);class gn{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?Ls.EMPTY:((t=t||new Ls(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(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)}addPointMatrix(t,e){const{a:s,b:i,c:r,d:n,tx:a,ty:o}=t,h=s*e.x+r*e.y+a,l=i*e.x+n*e.y+o;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)}addQuad(t){let e=this.minX,s=this.minY,i=this.maxX,r=this.maxY,n=t[0],a=t[1];e=ni?n:i,r=a>r?a:r,n=t[2],a=t[3],e=ni?n:i,r=a>r?a:r,n=t[4],a=t[5],e=ni?n:i,r=a>r?a:r,n=t[6],a=t[7],e=ni?n:i,r=a>r?a:r,this.minX=e,this.minY=s,this.maxX=i,this.maxY=r}addFrame(t,e,s,i,r){this.addFrameMatrix(t.worldTransform,e,s,i,r)}addFrameMatrix(t,e,s,i,r){const n=t.a,a=t.b,o=t.c,h=t.d,l=t.tx,u=t.ty;let d=this.minX,c=this.minY,p=this.maxX,f=this.maxY,m=n*e+o*s+l,_=a*e+h*s+u;d=mp?m:p,f=_>f?_:f,m=n*i+o*s+l,_=a*i+h*s+u,d=mp?m:p,f=_>f?_:f,m=n*e+o*r+l,_=a*e+h*r+u,d=mp?m:p,f=_>f?_:f,m=n*i+o*r+l,_=a*i+h*r+u,d=mp?m:p,f=_>f?_:f,this.minX=d,this.minY=c,this.maxX=p,this.maxY=f}addVertexData(t,e,s){let i=this.minX,r=this.minY,n=this.maxX,a=this.maxY;for(let o=e;on?e:n,a=s>a?s:a}this.minX=i,this.minY=r,this.maxX=n,this.maxY=a}addVertices(t,e,s,i){this.addVerticesMatrix(t.worldTransform,e,s,i)}addVerticesMatrix(t,e,s,i,r=0,n=r){const a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,d=t.ty;let c=this.minX,p=this.minY,f=this.maxX,m=this.maxY;for(let t=s;ti?t.maxX:i,this.maxY=t.maxY>r?t.maxY:r}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,r=t.maxXa?r:a,this.maxY=n>o?n:o}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,r=t.maxXa?r:a,this.maxY=n>o?n:o}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,i,r,n){t-=r,e-=n,s+=r,i+=n,this.minX=this.minXs?this.maxX:s,this.minY=this.minYi?this.maxY:i}}class xn extends W{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Js,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new gn,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s1)for(let e=0;ethis.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),i=this.getChildIndex(e);this.children[s]=e,this.children[i]=t,this.onChildrenChange(s=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);ke(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e0&&i<=e){r=this.children.splice(s,i);for(let t=0;t1&&this.children.sort(Tn),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t0&&e.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==bn.prototype._render&&(s=this.getBounds(!0));const r=t.projection.transform;if(r&&(i?(i=yn.copyFrom(i),i.prepend(r)):i=r),s&&e.intersects(s,i))this._render(t);else if(this.cullArea)return;for(let e=0,s=this.children.length;eEn.defaultSortableChildren,set(t){Kt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),En.defaultSortableChildren=t}}});const An=new Bs,Rn=new Uint16Array([0,1,2,0,2,3]);class Sn extends En{constructor(t){super(),this._anchor=new Zs(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Ie(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=a.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||Wi.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Rn,this.pluginName="batch",this.isSprite=!0,this._roundPixels=A.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Xe(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Xe(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,s=e.a,i=e.b,r=e.c,n=e.d,a=e.tx,o=e.ty,h=this.vertexData,l=t.trim,u=t.orig,d=this._anchor;let c=0,p=0,f=0,m=0;if(l?(p=l.x-d._x*u.width,c=p+l.width,m=l.y-d._y*u.height,f=m+l.height):(p=-d._x*u.width,c=p+u.width,m=-d._y*u.height,f=m+u.height),h[0]=s*p+r*m+a,h[1]=n*m+i*p+o,h[2]=s*c+r*m+a,h[3]=n*m+i*c+o,h[4]=s*c+r*f+a,h[5]=n*f+i*c+o,h[6]=s*p+r*f+a,h[7]=n*f+i*p+o,this._roundPixels){const t=A.RESOLUTION;for(let e=0;e=i&&An.x=r&&An.y=s&&(i=t-r-1),a=a.replace("%value%",e[i].toString()),n+=a,n+="\n"}return r=r.replace("%blur%",n),r=r.replace("%size%",t.toString()),r}(r);super(n,a),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,i){if(s?this.horizontal?this.uniforms.strength=1/s.width*(s.width/e.width):this.uniforms.strength=1/s.height*(s.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,s,i);else{const r=t.getFilterTexture(),n=t.renderer;let a=e,o=r;this.state.blend=!1,t.applyFilter(this,a,o,_.CLEAR);for(let e=1;e 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,i,r]=Ie.shared.setValue(t).toArray(),n=[s,0,0,0,0,0,i,0,0,0,0,0,r,0,0,0,0,0,1,0];this._loadMatrix(n,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),r=1/3,n=(0,Math.sqrt)(r),a=[s+(1-s)*r,r*(1-s)-n*i,r*(1-s)+n*i,0,0,r*(1-s)+n*i,s+r*(1-s),r*(1-s)-n*i,0,0,r*(1-s)-n*i,r*(1-s)+n*i,s+r*(1-s),0,0,0,0,0,1,0];this._loadMatrix(a,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),r=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(r,e)}saturate(t=0,e){const s=2*t/3+1,i=-.5*(s-1),r=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(r,e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,s,i,r){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const n=Ie.shared,[a,o,h]=n.setValue(s).toArray(),[l,u,d]=n.setValue(i).toArray(),c=[.3,.59,.11,0,0,a,o,h,t,0,l,u,d,e,0,a-l,o-u,h-d,0,0];this._loadMatrix(c,r)}night(t,e){const s=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(s,e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}Fn.prototype.grayscale=Fn.prototype.greyscale;class Bn extends Pi{constructor(t,e){const s=new Hs;t.renderable=!1,super("attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,null==e&&(e=20),this.scale=new Bs(e,e)}apply(t,e,s,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const r=this.maskSprite.worldTransform,n=Math.sqrt(r.a*r.a+r.b*r.b),a=Math.sqrt(r.c*r.c+r.d*r.d);0!==n&&0!==a&&(this.uniforms.rotation[0]=r.a/n,this.uniforms.rotation[1]=r.b/n,this.uniforms.rotation[2]=r.c/a,this.uniforms.rotation[3]=r.d/a),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}class Nn extends Pi{constructor(){super("\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')}}class Ln extends Pi{constructor(t=.5,e=Math.random()){super(Jr,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const Gn={AlphaFilter:Mn,BlurFilter:On,BlurFilterPass:Pn,ColorMatrixFilter:Fn,DisplacementFilter:Bn,FXAAFilter:Nn,NoiseFilter:Ln};Object.entries(Gn).forEach((([t,e])=>{Object.defineProperty(Gn,t,{get:()=>e})}));const Un=new class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||($r.system.add(this.tickerUpdate,this,Wr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){!this.tickerAdded||($r.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove)return void(this._didMove=!1);const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTimet.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,i=e.length;s=0;i--)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(0===s.length)return;t.eventPhase=t.BUBBLING_PHASE;const i=Array.isArray(e)?e:[e];for(let e=s.length-1;e>=0;e--)i.forEach((i=>{t.currentTarget=s[e],this.notifyTarget(t,i)}))}propagationPath(t){const e=[t];for(let s=0;s<2048&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,i,r,n=!1){let a=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(Un.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let h=o.length-1;h>=0;h--){const l=o[h],u=this.hitTestMoveRecursive(l,this._isInteractive(e)?e:l.eventMode,s,i,r,n||r(t,s));if(u){if(u.length>0&&!u[u.length-1].parent)continue;const e=t.isInteractive();(u.length>0||e)&&(e&&this._allInteractiveElements.push(t),u.push(t)),0===this._hitElements.length&&(this._hitElements=u),a=!0}}}const o=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:o&&!r(t,s)&&i(t,s)?h?[t]:[]:null}hitTestRecursive(t,e,s,i,r){if(this._interactivePrune(t)||r(t,s))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(Un.pauseUpdate=!1),t.interactiveChildren&&t.children){const n=t.children;for(let a=n.length-1;a>=0;a--){const o=n[a],h=this.hitTestRecursive(o,this._isInteractive(e)?e:o.eventMode,s,i,r);if(h){if(h.length>0&&!h[h.length-1].parent)continue;const e=t.isInteractive();return(h.length>0||e)&&h.push(t),h}}}const n=this._isInteractive(e),a=t.isInteractive();return n&&i(t,s)?a?[t]:[]:null}_isInteractive(t){return"static"===t||"dynamic"===t}_interactivePrune(t){return!(t&&!t.isMask&&t.visible&&t.renderable&&"none"!==t.eventMode&&("passive"!==t.eventMode||t.interactiveChildren)&&!t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,Yn),!t.hitArea.contains(Yn.x,Yn.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&(null==(s=i.containsPoint)||!s.call(i,e)))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){var s,i;const r=`on${e=null!=e?e:t.type}`;null==(i=(s=t.currentTarget)[r])||i.call(s,t);const n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Hn))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){const t=2===e.button;this.dispatchEvent(e,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,s,i;if(!(t instanceof Hn))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const r=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const n="mouse"===r.pointerType||"pen"===r.pointerType,a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if((null==(e=a.overTargets)?void 0:e.length)>0&&o!==r.target){const e="mousemove"===t.type?"mouseout":"pointerout",s=this.createPointerEvent(t,e,o);if(this.dispatchEvent(s,"pointerout"),n&&this.dispatchEvent(s,"mouseout"),!r.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o);for(e.eventPhase=e.AT_TARGET;e.target&&!r.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),n&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(s)}if(o!==r.target){const e="mousemove"===t.type?"mouseover":"pointerover",s=this.clonePointerEvent(r,e);this.dispatchEvent(s,"pointerover"),n&&this.dispatchEvent(s,"mouseover");let i=null==o?void 0:o.parent;for(;i&&i!==this.rootTarget.parent&&i!==r.target;)i=i.parent;if(!i||i===this.rootTarget.parent){const t=this.clonePointerEvent(r,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),n&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(s)}const h=[],l=null==(s=this.enableGlobalMoveEvents)||s;this.moveOnAll?h.push("pointermove"):this.dispatchEvent(r,"pointermove"),l&&h.push("globalpointermove"),"touch"===r.pointerType&&(this.moveOnAll?h.splice(1,0,"touchmove"):this.dispatchEvent(r,"touchmove"),l&&h.push("globaltouchmove")),n&&(this.moveOnAll?h.splice(1,0,"mousemove"):this.dispatchEvent(r,"mousemove"),l&&h.push("globalmousemove"),this.cursor=null==(i=r.target)?void 0:i.cursor),h.length>0&&this.all(r,h),this._allInteractiveElements.length=0,this._hitElements.length=0,a.overTargets=r.composedPath(),this.freeEvent(r)}mapPointerOver(t){var e;if(!(t instanceof Hn))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r="mouse"===i.pointerType||"pen"===i.pointerType;this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),"mouse"===i.pointerType&&(this.cursor=null==(e=i.target)?void 0:e.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;s.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Hn))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId);if(e.overTargets){const s="mouse"===t.pointerType||"pen"===t.pointerType,i=this.findMountedTarget(e.overTargets),r=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(r),s&&this.dispatchEvent(r,"mouseout");const n=this.createPointerEvent(t,"pointerleave",i);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(r),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Hn))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if("mouse"===s.pointerType||"pen"===s.pointerType){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]);let n=r;if(r&&!s.composedPath().includes(r)){let e=r;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if("mouse"===s.pointerType||"pen"===s.pointerType){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete i.pressTargetsByButton[t.button],n=e}if(n){const r=this.clonePointerEvent(s,"click");r.target=n,r.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:r.target,timeStamp:e});const a=i.clicksByButton[t.button];if(a.target===r.target&&e-a.timeStamp<200?++a.clickCount:a.clickCount=1,a.target=r.target,a.timeStamp=e,r.detail=a.clickCount,"mouse"===r.pointerType){const t=2===r.button;this.dispatchEvent(r,t?"rightclick":"click")}else"touch"===r.pointerType&&this.dispatchEvent(r,"tap");this.dispatchEvent(r,"pointertap"),this.freeEvent(r)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Hn))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(s){let r=s;for(;r;)i.currentTarget=r,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType?this.notifyTarget(i,"touchendoutside"):("mouse"===i.pointerType||"pen"===i.pointerType)&&this.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),r=r.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof Vn))return void console.warn("EventBoundary cannot map a non-wheel event as a wheel event");const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=s),t[e]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){var e,s;const{view:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,qn._defaultEventMode=null!=(e=t.eventMode)?e:"auto",Object.assign(this.features,null!=(s=t.eventFeatures)?s:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&"touch"===t.pointerType))return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,s=e.length;t0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,e=i.length;t{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()})),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){!this._hookDiv||(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null==(t=this.renderer.view.parentNode)||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null==(t=this.div.parentNode)||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let t=0;t title : ${t.title}
tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:(!t.accessibleHint||null===t.accessibleHint)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,i=this.renderer.events.rootBoundary,r=Object.assign(new kn(i),{target:s});i.rootTarget=this.renderer.lastObjectRendered,e.forEach((t=>i.dispatchEvent(r,t)))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}ta.extension={name:"accessibility",type:[rs.RendererPlugin,rs.CanvasRendererPlugin]},os.add(ta);const ea=class{constructor(t){this.stage=new En,t=Object.assign({forceCanvas:!1},t),this.renderer=Zr(t),ea._plugins.forEach((e=>{e.init.call(this,t)}))}render(){this.renderer.render(this.stage)}get view(){return this.renderer.view}get screen(){return this.renderer.screen}destroy(t,e){const s=ea._plugins.slice(0);s.reverse(),s.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};let sa=ea;sa._plugins=[],os.handleByList(rs.Application,sa._plugins);class ia{static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{!this._resizeTo||(this.cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this.cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:i}=this._resizeTo;t=s,e=i}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}ia.extension=rs.Application,os.add(ia);const ra={loader:rs.LoadParser,resolver:rs.ResolveParser,cache:rs.CacheParser,detection:rs.DetectionParser};os.handle(rs.Asset,(t=>{const e=t.ref;Object.entries(ra).filter((([t])=>!!e[t])).forEach((([t,s])=>{var i;return os.add(Object.assign(e[t],{extension:null!=(i=e[t].extension)?i:s}))}))}),(t=>{const e=t.ref;Object.keys(ra).filter((t=>!!e[t])).forEach((t=>os.remove(e[t])))}));class na{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach((t=>{this._assetList.push(t)})),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t?e(t):t)):t),la=(t,e)=>{const s=e.split("?")[1];return s&&(t+=`?${s}`),t};function ua(t,e,s,i,r){const n=e[s];for(let a=0;a{const e=t.substring(1,t.length-1).split(",");i.push(e)})),ua(t,i,0,e,s)}else s.push(t);return s}const ca=t=>!Array.isArray(t);const pa=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=ha(t);let i;for(let t=0;t{i[t]=e})));const r=Object.keys(i),n={cacheKeys:r,keys:s};if(s.forEach((t=>{this._cacheMap.set(t,n)})),r.forEach((t=>{this._cache.has(t)&&this._cache.get(t)!==e&&console.warn("[Cache] already has key:",t),this._cache.set(t,i[t])})),e instanceof Wi){const t=e;s.forEach((e=>{t.baseTexture!==Wi.EMPTY.baseTexture&&ys.addToCache(t.baseTexture,e),Wi.addToCache(t,e)}))}}remove(t){if(this._cacheMap.get(t),!this._cacheMap.has(t))return void console.warn(`[Assets] Asset id ${t} was not found in the Cache`);const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}};class fa{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var i,r;let n=null,a=null;if(e.loadParser&&(a=this._parserHash[e.loadParser],a||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!a){for(let s=0;s({src:t}))),a=n.length,o=n.map((async t=>{const r=$t.toAbsolute(t.src);if(!i[t.src])try{this.promiseCache[r]||(this.promiseCache[r]=this._getLoadPromiseAndParser(r,t)),i[t.src]=await this.promiseCache[r].promise,e&&e(++s/a)}catch(e){throw delete this.promiseCache[r],delete i[t.src],new Error(`[Loader.load] Failed to load ${r}.\n${e}`)}}));return await Promise.all(o),r?i[n[0].src]:i}async unload(t){const e=ha(t,(t=>({src:t}))).map((async t=>{var e,s;const i=$t.toAbsolute(t.src),r=this.promiseCache[i];if(r){const n=await r.promise;null==(s=null==(e=r.parser)?void 0:e.unload)||s.call(e,n,t,this),delete this.promiseCache[i]}}));await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter((t=>t.name)).reduce(((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),Qi(bt({},t),{[e.name]:e}))),{})}}var ma=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(ma||{});const _a={extension:{type:rs.LoadParser,priority:ma.Low},name:"loadJson",test:t=>aa(t,"application/json")||oa(t,".json"),load:async t=>await(await A.ADAPTER.fetch(t)).json()};os.add(_a);const ga={name:"loadTxt",extension:{type:rs.LoadParser,priority:ma.Low},test:t=>aa(t,"text/plain")||oa(t,".txt"),load:async t=>await(await A.ADAPTER.fetch(t)).text()};os.add(ga);const xa=["normal","bold","100","200","300","400","500","600","700","800","900"],va=[".ttf",".otf",".woff",".woff2"],ya=["font/ttf","font/otf","font/woff","font/woff2"],Ta=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ba(t){const e=$t.extname(t),s=$t.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map((t=>t.charAt(0).toUpperCase()+t.slice(1)));let i=s.length>0;for(const t of s)if(!t.match(Ta)){i=!1;break}let r=s.join(" ");return i||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const Ea={extension:{type:rs.LoadParser,priority:ma.Low},name:"loadWebFont",test:t=>aa(t,ya)||oa(t,va),async load(t,e){var s,i,r,n,a,o;const h=A.ADAPTER.getFontFaceSet();if(h){const l=[],u=null!=(i=null==(s=e.data)?void 0:s.family)?i:ba(t),d=null!=(a=null==(n=null==(r=e.data)?void 0:r.weights)?void 0:n.filter((t=>xa.includes(t))))?a:["normal"],c=null!=(o=e.data)?o:{};for(let e=0;eA.ADAPTER.getFontFaceSet().delete(t)))}};os.add(Ea);let Aa,Ra=0;const Sa={id:"checkImageBitmap",code:"\n async function checkImageBitmap()\n {\n try\n {\n if (typeof createImageBitmap !== 'function') return false;\n\n const response = await fetch('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=');\n const imageBlob = await response.blob();\n const imageBitmap = await createImageBitmap(imageBlob);\n\n return imageBitmap.width === 1 && imageBitmap.height === 1;\n }\n catch (e)\n {\n return false;\n }\n }\n checkImageBitmap().then((result) => { self.postMessage(result); });\n "},wa={id:"loadImageBitmap",code:"\n async function loadImageBitmap(url)\n {\n const response = await fetch(url);\n\n if (!response.ok)\n {\n throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: `\n + `${response.status} ${response.statusText}`);\n }\n\n const imageBlob = await response.blob();\n const imageBitmap = await createImageBitmap(imageBlob);\n\n return imageBitmap;\n }\n self.onmessage = async (event) =>\n {\n try\n {\n const imageBitmap = await loadImageBitmap(event.data.data[0]);\n\n self.postMessage({\n data: imageBitmap,\n uuid: event.data.uuid,\n id: event.data.id,\n }, [imageBitmap]);\n }\n catch(e)\n {\n self.postMessage({\n error: e,\n uuid: event.data.uuid,\n id: event.data.id,\n });\n }\n };"};let Ia;const Ma=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise((t=>{const e=URL.createObjectURL(new Blob([Sa.code],{type:"application/javascript"})),s=new Worker(e);s.addEventListener("message",(i=>{s.terminate(),URL.revokeObjectURL(e),t(i.data)}))}))),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===Aa&&(Aa=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers{this.complete(t.data),this.returnWorker(t.target),this.next()}))),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise(((s,i)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:i})}));return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[Ra]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Ra++,id:s})}};function Ca(t,e,s){const i=new Wi(t);return i.baseTexture.on("dispose",(()=>{delete e.promiseCache[s]})),i}const Da=[".jpeg",".jpg",".png",".webp",".avif"],Pa=["image/jpeg","image/png","image/webp","image/avif"];async function Oa(t){const e=await A.ADAPTER.fetch(t);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);const s=await e.blob();return await createImageBitmap(s)}const Fa={name:"loadTextures",extension:{type:rs.LoadParser,priority:ma.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>aa(t,Pa)||oa(t,Da),async load(t,e,s){let i=null;i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Ma.isImageBitmapSupported()?await Ma.loadImageBitmap(t):await Oa(t):await new Promise((e=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=t,i.complete?e(i):i.onload=()=>{e(i)}}));const r=new ys(i,bt({resolution:ss(t)},e.data));return r.resource.src=t,Ca(r,s,t)},unload(t){t.destroy(!0)}};os.add(Fa);const Ba={extension:{type:rs.LoadParser,priority:ma.High},name:"loadSVG",test:t=>aa(t,"image/svg+xml")||oa(t,".svg"),testParse:async t=>fn.test(t),async parse(t,e,s){var i;const r=new fn(t,null==(i=null==e?void 0:e.data)?void 0:i.resourceOptions);await r.load();const n=new ys(r,bt({resolution:ss(t)},null==e?void 0:e.data));return n.resource.src=t,Ca(n,s,t)},load:async(t,e)=>(await A.ADAPTER.fetch(t)).text(),unload:Fa.unload};os.add(Ba);class Na{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){var e,s,i;if(this._bundleIdConnector=null!=(e=t.connector)?e:this._bundleIdConnector,this._createBundleAssetId=null!=(s=t.createBundleAssetId)?s:this._createBundleAssetId,this._extractAssetIdFromBundle=null!=(i=t.extractAssetIdFromBundle)?i:this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))})),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach((e=>{if("string"==typeof e.name){const i=this._createBundleAssetId(t,e.name);s.push(i),this.add([e.name,i],e.srcs,e.data)}else{const i=e.name.map((e=>this._createBundleAssetId(t,e)));i.forEach((t=>{s.push(t)})),this.add([...e.name,...i],e.srcs)}})):Object.keys(e).forEach((i=>{s.push(this._createBundleAssetId(t,i)),this.add([i,this._createBundleAssetId(t,i)],e[i])})),this._bundles[t]=s}add(t,e,s){const i=ha(t);i.forEach((t=>{this.hasKey(t)&&console.warn(`[Resolver] already has key: ${t} overwriting`)})),Array.isArray(e)||(e="string"==typeof e?da(e):[e]);const r=e.map((t=>{var e;let r=t;if("string"==typeof t){let e=!1;for(let s=0;s{this._assetMap[t]=r}))}resolveBundle(t){const e=ca(t);t=ha(t);const s={};return t.forEach((t=>{const e=this._bundles[t];if(e){const i=this.resolve(e),r={};for(const e in i){const s=i[e];r[this._extractAssetIdFromBundle(t,e)]=s}s[t]=r}})),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const s in e)t[s]=e[s].src;return t}return e.src}resolve(t){const e=ca(t);t=ha(t);const s={};return t.forEach((t=>{var e;if(!this._resolverHash[t])if(this._assetMap[t]){let s=this._assetMap[t];const i=this._getPreferredOrder(s),r=s[0];null==i||i.priority.forEach((t=>{i.params[t].forEach((e=>{const i=s.filter((s=>!!s[t]&&s[t]===e));i.length&&(s=i)}))})),this._resolverHash[t]=null!=(e=s[0])?e:r}else{let e=t;(this._basePath||this._rootPath)&&(e=$t.toAbsolute(e,this._basePath,this._rootPath)),e=this._appendDefaultSearchParams(e),this._resolverHash[t]={src:e}}s[t]=this._resolverHash[t]})),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;et.params.format.includes(e.format)));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}}class La{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Na,this.loader=new fa,this.cache=pa,this._backgroundLoader=new na(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,i,r;if(this._initialized)return void console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}const n=null!=(s=null==(e=t.texturePreference)?void 0:e.resolution)?s:1,a="number"==typeof n?[n]:n;let o=[];if(null!=(i=t.texturePreference)&&i.format){const e=null==(r=t.texturePreference)?void 0:r.format;o="string"==typeof e?[e]:e;for(const t of this._detections)await t.test()||(o=await t.remove(o))}else for(const t of this._detections)await t.test()&&(o=await t.add(o));this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s){this.resolver.add(t,e,s)}async load(t,e){this._initialized||await this.init();const s=ca(t),i=ha(t).map((t=>"string"!=typeof t?(this.resolver.add(t.src,t),t.src):(this.resolver.hasKey(t)||this.resolver.add(t,t),t))),r=this.resolver.resolve(i),n=await this._mapLoadToResolve(r,e);return s?n[i[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;"string"==typeof t&&(s=!0,t=[t]);const i=this.resolver.resolveBundle(t),r={},n=Object.keys(i);let a=0,o=0;const h=()=>{null==e||e(++a/o)},l=n.map((t=>{const e=i[t];return o+=Object.keys(e).length,this._mapLoadToResolve(e,h).then((e=>{r[t]=e}))}));return await Promise.all(l),s?r[t[0]]:r}async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach((t=>{this._backgroundLoader.add(Object.values(t))}))}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return pa.get(t);const e={};for(let s=0;s{const s=r[t.src],a=[t.src];t.alias&&a.push(...t.alias),n[i[e]]=s,pa.set(a,s)})),n}async unload(t){this._initialized||await this.init();const e=ha(t).map((t=>"string"!=typeof t?t.src:t)),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=ha(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map((t=>this._unloadFromResolved(e[t])));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach((t=>{pa.remove(t.src)})),await this.loader.unload(e)}get detections(){return this._detections}get preferWorkers(){return Fa.config.preferWorkers}set preferWorkers(t){Kt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach((e=>{!e.config||Object.keys(e.config).filter((e=>e in t)).forEach((s=>{e.config[s]=t[s]}))}))}}const Ga=new La;os.handleByList(rs.LoadParser,Ga.loader.parsers).handleByList(rs.ResolveParser,Ga.resolver.parsers).handleByList(rs.CacheParser,Ga.cache.parsers).handleByList(rs.DetectionParser,Ga.detections);const Ua={extension:rs.CacheParser,test:t=>Array.isArray(t)&&t.every((t=>t instanceof Wi)),getCacheableAssets:(t,e)=>{const s={};return t.forEach((t=>{e.forEach(((e,i)=>{s[t+(0===i?"":i+1)]=e}))})),s}};os.add(Ua);const ka={extension:{type:rs.DetectionParser,priority:1},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await A.ADAPTER.fetch("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=").then((t=>t.blob()));return createImageBitmap(t).then((()=>!0),(()=>!1))},add:async t=>[...t,"avif"],remove:async t=>t.filter((t=>"avif"!==t))};os.add(ka);const Xa={extension:{type:rs.DetectionParser,priority:0},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await A.ADAPTER.fetch("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=").then((t=>t.blob()));return createImageBitmap(t).then((()=>!0),(()=>!1))},add:async t=>[...t,"webp"],remove:async t=>t.filter((t=>"webp"!==t))};os.add(Xa);const Ha=["png","jpg","jpeg"],Va={extension:{type:rs.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...Ha],remove:async t=>t.filter((t=>!Ha.includes(t)))};os.add(Va);const za={extension:rs.ResolveParser,test:Fa.test,parse:t=>{var e,s;return{resolution:parseFloat(null!=(s=null==(e=A.RETINA_PREFIX.exec(t))?void 0:e[1])?s:"1"),format:t.split(".").pop(),src:t}}};os.add(za);var Wa=(t=>(t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t))(Wa||{});const Ya={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let ja,$a;function qa(){$a={s3tc:ja.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:ja.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:ja.getExtension("WEBGL_compressed_texture_etc"),etc1:ja.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:ja.getExtension("WEBGL_compressed_texture_pvrtc")||ja.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:ja.getExtension("WEBGL_compressed_texture_atc"),astc:ja.getExtension("WEBGL_compressed_texture_astc")}}const Ka={extension:{type:rs.DetectionParser,priority:2},test:async()=>{const t=A.ADAPTER.createCanvas().getContext("webgl");return t?(ja=t,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async t=>{$a||qa();const e=[];for(const t in $a)!$a[t]||e.push(t);return[...e,...t]},remove:async t=>($a||qa(),t.filter((t=>!(t in $a))))};os.add(Ka);class Za extends gs{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,i;"string"==typeof t?(s=t,i=new Uint8Array):(s=null,i=t),super(i,e),this.origin=s,this.buffer=i?new hs(i):null,this._load=null,this.loaded=!1,null!==this.origin&&!1!==e.autoLoad&&this.load(),null===this.origin&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load||(this._load=fetch(this.origin).then((t=>t.blob())).then((t=>t.arrayBuffer())).then((t=>(this.data=new Uint32Array(t),this.buffer=new hs(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)))),this._load}}class Qa extends Za{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Qa._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Qa._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;for(let t=0,e=this.levels;t=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,s,i,r,n,a){const o=new Array(s);let h=t.byteOffset,l=n,u=a,d=l+i-1&~(i-1),c=u+r-1&~(r-1),p=d*c*Ya[e];for(let n=0;n1?l:d,levelHeight:s>1?u:c,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,l=l>>1||1,u=u>>1||1,d=l+i-1&~(i-1),c=u+r-1&~(r-1),p=d*c*Ya[e];return o}}const Ja=124,to=3,eo=4,so=7,io=19,ro=2,no=0,ao=1,oo=2,ho=3;var lo=(t=>(t[t.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",t[t.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",t[t.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",t[t.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",t[t.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",t[t.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",t[t.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",t[t.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",t[t.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",t[t.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",t[t.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",t[t.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",t[t.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",t[t.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",t[t.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",t[t.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",t[t.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",t[t.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",t[t.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",t[t.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",t[t.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",t[t.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",t[t.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",t[t.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",t[t.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",t[t.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",t[t.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",t[t.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",t[t.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",t[t.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",t[t.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",t[t.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",t[t.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",t[t.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",t[t.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",t[t.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",t[t.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",t[t.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",t[t.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",t[t.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",t[t.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",t[t.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",t[t.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",t[t.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",t[t.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",t[t.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",t[t.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",t[t.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",t[t.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",t[t.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",t[t.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",t[t.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",t[t.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",t[t.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",t[t.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",t[t.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",t[t.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",t[t.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",t[t.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",t[t.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",t[t.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",t[t.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",t[t.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",t[t.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",t[t.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",t[t.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",t[t.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",t[t.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",t[t.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",t[t.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",t[t.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",t[t.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",t[t.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",t[t.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",t[t.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",t[t.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",t[t.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",t[t.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",t[t.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",t[t.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",t[t.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",t[t.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",t[t.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",t[t.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",t[t.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",t[t.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",t[t.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",t[t.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",t[t.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",t[t.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",t[t.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",t[t.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",t[t.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",t[t.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",t[t.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",t[t.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",t[t.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",t[t.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",t[t.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",t[t.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",t[t.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",t[t.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",t[t.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",t[t.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",t[t.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",t[t.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",t[t.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",t[t.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",t[t.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",t[t.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",t[t.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",t[t.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",t[t.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",t[t.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",t[t.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",t[t.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",t[t.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",t[t.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",t[t.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",t[t.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",t[t.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",t[t.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",t))(lo||{}),uo=(t=>(t[t.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",t[t.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",t[t.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",t))(uo||{});const co={827611204:Wa.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:Wa.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:Wa.COMPRESSED_RGBA_S3TC_DXT5_EXT},po={70:Wa.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Wa.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Wa.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Wa.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Wa.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Wa.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Wa.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Wa.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Wa.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function fo(t){const e=new Uint32Array(t);if(542327876!==e[0])throw new Error("Invalid DDS file magic word");const s=new Uint32Array(t,0,Ja/Uint32Array.BYTES_PER_ELEMENT),i=s[to],r=s[eo],n=s[so],a=new Uint32Array(t,io*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),o=a[1];if(4&o){const s=a[ro];if(808540228!==s){const e=co[s],a=new Uint8Array(t,128);return[new Qa(a,{format:e,width:r,height:i,levels:n})]}const o=128,h=new Uint32Array(e.buffer,o,20/Uint32Array.BYTES_PER_ELEMENT),l=h[no],u=h[ao],d=h[oo],c=h[ho],p=po[l];if(void 0===p)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(4===d)throw new Error("DDSParser does not support cubemap textures");if(6===u)throw new Error("DDSParser does not supported 3D texture data");const f=new Array,m=148;if(1===c)f.push(new Uint8Array(t,m));else{const e=Ya[p];let s=0,a=r,o=i;for(let t=0;t>>=1,o>>>=1}let h=m;for(let e=0;enew Qa(t,{format:p,width:r,height:i,levels:n})))}throw 64&o?new Error("DDSParser does not support uncompressed texture data."):512&o?new Error("DDSParser does not supported YUV uncompressed texture data."):131072&o?new Error("DDSParser does not support single-channel (lumninance) texture data!"):2&o?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const mo=[171,75,84,88,32,49,49,187,13,10,26,10],_o=12,go=16,xo=24,vo=28,yo=36,To=40,bo=44,Eo=48,Ao=52,Ro=56,So=60,wo=64,Io={[u.UNSIGNED_BYTE]:1,[u.UNSIGNED_SHORT]:2,[u.INT]:4,[u.UNSIGNED_INT]:4,[u.FLOAT]:4,[u.HALF_FLOAT]:8},Mo={[h.RGBA]:4,[h.RGB]:3,[h.RG]:2,[h.RED]:1,[h.LUMINANCE]:1,[h.LUMINANCE_ALPHA]:2,[h.ALPHA]:1},Co={[u.UNSIGNED_SHORT_4_4_4_4]:2,[u.UNSIGNED_SHORT_5_5_5_1]:2,[u.UNSIGNED_SHORT_5_6_5]:2};function Do(t,e,s=!1){const i=new DataView(e);if(!function(t,e){for(let s=0;se-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h1||0!==n?E:R,levelHeight:f>1||0!==n?A:S,levelBuffer:new Uint8Array(e,a,b)},a+=b}w+=s+4,w=w%4!=0?w+4-w%4:w,E=E>>1||1,A=A>>1||1,R=E+4-1&-4,S=A+4-1&-4,b=R*S*v}return 0!==n?{uncompressed:x.map((t=>{let e=t[0].levelBuffer,s=!1;return n===u.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):n===u.UNSIGNED_INT?(s=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):n===u.INT&&(s=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new gs(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:n,format:s?Po(a):a}})),kvData:T}:{compressed:x.map((t=>new Qa(null,{format:o,width:h,height:l,levels:f,levelBuffers:t}))),kvData:T}}function Po(t){switch(t){case h.RGBA:return h.RGBA_INTEGER;case h.RGB:return h.RGB_INTEGER;case h.RG:return h.RG_INTEGER;case h.RED:return h.RED_INTEGER;default:return t}}const Oo={extension:{type:rs.LoadParser,priority:ma.High},name:"loadDDS",test:t=>oa(t,".dds"),async load(t,e,s){const i=fo(await(await A.ADAPTER.fetch(t)).arrayBuffer()).map((i=>Ca(new ys(i,bt({mipmap:f.OFF,alphaMode:m.NO_PREMULTIPLIED_ALPHA,resolution:ss(t)},e.data)),s,t)));return 1===i.length?i[0]:i},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};os.add(Oo);const Fo={extension:{type:rs.LoadParser,priority:ma.High},name:"loadKTX",test:t=>oa(t,".ktx"),async load(t,e,s){const i=await(await A.ADAPTER.fetch(t)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=Do(t,i),o=null!=r?r:n,h=bt({mipmap:f.OFF,alphaMode:m.NO_PREMULTIPLIED_ALPHA,resolution:ss(t)},e.data),l=o.map((e=>{o===n&&Object.assign(h,{type:e.type,format:e.format});const i=new ys(e,h);return i.ktxKeyValueData=a,Ca(i,s,t)}));return 1===l.length?l[0]:l},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};os.add(Fo);const Bo={extension:rs.ResolveParser,test:t=>{const e=t.split("?")[0].split(".").pop();return["basis","ktx","dds"].includes(e)},parse:t=>{var e,s,i,r;if("ktx"===t.split("?")[0].split(".").pop()){const i=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(i.some((e=>t.endsWith(e))))return{resolution:parseFloat(null!=(s=null==(e=A.RETINA_PREFIX.exec(t))?void 0:e[1])?s:"1"),format:i.find((e=>t.endsWith(e))),src:t}}return{resolution:parseFloat(null!=(r=null==(i=A.RETINA_PREFIX.exec(t))?void 0:i[1])?r:"1"),format:t.split(".").pop(),src:t}}};os.add(Bo);const No=new Ls,Lo=class{constructor(t){this.renderer=t}async image(t,e,s){const i=new Image;return i.src=await this.base64(t,e,s),i}async base64(t,e,s){const i=this.canvas(t);if(void 0!==i.toBlob)return new Promise(((t,r)=>{i.toBlob((e=>{if(!e)return void r(new Error("ICanvas.toBlob failed!"));const s=new FileReader;s.onload=()=>t(s.result),s.onerror=r,s.readAsDataURL(e)}),e,s)}));if(void 0!==i.toDataURL)return i.toDataURL(e,s);if(void 0!==i.convertToBlob){const t=await i.convertToBlob({type:e,quality:s});return new Promise(((e,s)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=s,i.readAsDataURL(t)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:i,height:r,flipY:n}=this._rawPixels(t,e);n&&Lo._flipY(s,i,r),Lo._unpremultiplyAlpha(s);const a=new qe(i,r,1),o=new ImageData(new Uint8ClampedArray(s.buffer),i,r);return a.context.putImageData(o,0,0),a.canvas}pixels(t,e){const{pixels:s,width:i,height:r,flipY:n}=this._rawPixels(t,e);return n&&Lo._flipY(s,i,r),Lo._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let i,r,n=!1,a=!1;if(t&&(t instanceof Yi?r=t:(r=s.generateTexture(t,{resolution:s.resolution,multisample:s.multisample}),a=!0)),r){if(i=r.baseTexture.resolution,e=null!=e?e:r.frame,n=!1,!a){s.renderTexture.bind(r);const t=r.framebuffer.glFramebuffers[s.CONTEXT_UID];t.blitFramebuffer&&s.framebuffer.bind(t.blitFramebuffer)}}else i=s.resolution,e||((e=No).width=s.width/i,e.height=s.height/i),n=!0,s.renderTexture.bind();const o=Math.round(e.width*i),h=Math.round(e.height*i),l=new Uint8Array(4*o*h),u=s.gl;return u.readPixels(Math.round(e.x*i),Math.round(e.y*i),o,h,u.RGBA,u.UNSIGNED_BYTE,l),a&&(null==r||r.destroy(!0)),{pixels:l,width:o,height:h,flipY:n}}destroy(){this.renderer=null}static _flipY(t,e,s){const i=e<<2,r=s>>1,n=new Uint8Array(i);for(let e=0;e=0&&o>=0&&r>=0&&n>=0))return void(e.length=0);const h=Math.ceil(2.3*Math.sqrt(a+o)),l=8*h+(r?4:0)+(n?4:0);if(e.length=l,0===l)return;if(0===h)return e.length=8,e[0]=e[6]=s+r,e[1]=e[3]=i+n,e[2]=e[4]=s-r,void(e[5]=e[7]=i-n);let u=0,d=4*h+(r?2:0)+2,c=d,p=l;{const t=r+a,o=n,h=s+t,l=s-t,f=i+o;if(e[u++]=h,e[u++]=f,e[--d]=f,e[--d]=l,n){const t=i-o;e[c++]=l,e[c++]=t,e[--p]=t,e[--p]=h}}for(let t=1;t0||e&&i<=0){const e=s/2;for(let i=e+e%2;i=6){ko(s,!1);const t=[];for(let e=0;e=0&&n>=0&&a.push(s,i,s+r,i,s+r,i+n,s,i+n)},triangulate(t,e){const s=t.points,i=e.points;if(0===s.length)return;const r=i.length/2;i.push(s[0],s[1],s[2],s[3],s[6],s[7],s[4],s[5]),e.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},Vo={build(t){Uo.build(t)},triangulate(t,e){Uo.triangulate(t,e)}};var zo=(t=>(t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t))(zo||{}),Wo=(t=>(t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t))(Wo||{});const Yo={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let s=Math.ceil(t/this.maxLength);return sthis.maxSegments&&(s=this.maxSegments),s}},jo=Yo;class $o{static curveTo(t,e,s,i,r,n){const a=n[n.length-2],o=n[n.length-1]-e,h=a-t,l=i-e,u=s-t,d=Math.abs(o*u-h*l);if(d<1e-8||0===r)return(n[n.length-2]!==t||n[n.length-1]!==e)&&n.push(t,e),null;const c=o*o+h*h,p=l*l+u*u,f=o*l+h*u,m=r*Math.sqrt(c)/d,_=r*Math.sqrt(p)/d,g=m*f/c,x=_*f/p,v=m*u+_*h,y=m*l+_*o,T=h*(_+g),b=o*(_+g),E=u*(m+x),A=l*(m+x);return{cx:v+t,cy:y+e,radius:r,startAngle:Math.atan2(b-y,T-v),endAngle:Math.atan2(A-y,E-v),anticlockwise:h*l>u*o}}static arc(t,e,s,i,r,n,a,o,h){const l=a-n,u=Yo._segmentsCount(Math.abs(l)*r,40*Math.ceil(Math.abs(l)/Ds)),d=l/(2*u),c=2*d,p=Math.cos(d),f=Math.sin(d),m=u-1,_=m%1/m;for(let t=0;t<=m;++t){const e=d+n+c*(t+_*t),a=Math.cos(e),o=-Math.sin(e);h.push((p*a+f*o)*r+s,(p*-o+f*a)*r+i)}}}class qo{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class Ko{static curveLength(t,e,s,i,r,n,a,o){let h=0,l=0,u=0,d=0,c=0,p=0,f=0,m=0,_=0,g=0,x=0,v=t,y=e;for(let T=1;T<=10;++T)l=T/10,u=l*l,d=u*l,c=1-l,p=c*c,f=p*c,m=f*t+3*p*l*s+3*c*u*r+d*a,_=f*e+3*p*l*i+3*c*u*n+d*o,g=v-m,x=y-_,v=m,y=_,h+=Math.sqrt(g*g+x*x);return h}static curveTo(t,e,s,i,r,n,a){const o=a[a.length-2],h=a[a.length-1];a.length-=2;const l=Yo._segmentsCount(Ko.curveLength(o,h,t,e,s,i,r,n));let u=0,d=0,c=0,p=0,f=0;a.push(o,h);for(let m=1,_=0;m<=l;++m)_=m/l,u=1-_,d=u*u,c=d*u,p=_*_,f=p*_,a.push(c*o+3*d*_*t+3*u*p*s+f*r,c*h+3*d*_*e+3*u*p*i+f*n)}}function Zo(t,e,s,i,r,n,a,o){let h,l;a?(h=i,l=-s):(h=-i,l=s);const u=t-s*r+h,d=e-i*r+l,c=t+s*n+h,p=e+i*n+l;return o.push(u,d,c,p),2}function Qo(t,e,s,i,r,n,a,o){const h=s-t,l=i-e;let u=Math.atan2(h,l),d=Math.atan2(r-t,n-e);o&&ud&&(d+=2*Math.PI);let c=u;const p=d-u,f=Math.abs(p),m=Math.sqrt(h*h+l*l),_=1+(15*f*Math.sqrt(m)/Math.PI>>0),g=p/_;if(c+=g,o){a.push(t,e,s,i);for(let s=1,i=c;s<_;s++,i+=g)a.push(t,e,t+Math.sin(i)*m,e+Math.cos(i)*m);a.push(t,e,r,n)}else{a.push(s,i,t,e);for(let s=1,i=c;s<_;s++,i+=g)a.push(t+Math.sin(i)*m,e+Math.cos(i)*m,t,e);a.push(r,n,t,e)}return 2*_}function Jo(t,e){t.lineStyle.native?function(t,e){let s=0;const i=t.shape,r=t.points||i.points,n=i.type!==Fs.POLY||i.closeStroke;if(0===r.length)return;const a=e.points,o=e.indices,h=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),s=1;s=0&&(n.join===zo.ROUND?c+=Qo(v,y,v-E*M,y-A*M,v-R*M,y-S*M,u,!1)+4:c+=2,u.push(v-R*C,y-S*C,v+R*M,y+S*M));continue}const d=(-E+g)*(-A+y)-(-E+v)*(-A+x),p=(-R+T)*(-S+y)-(-R+v)*(-S+b),I=(e*p-r*d)/h,D=(a*d-s*p)/h,P=(I-v)*(I-v)+(D-y)*(D-y),O=v+(I-v)*M,F=y+(D-y)*M,B=v-(I-v)*C,N=y-(D-y)*C,L=l?M:C,G=P<=Math.min(e*e+s*s,r*r+a*a)+L*L*m;let U=n.join;if(U===zo.MITER&&P/m>_&&(U=zo.BEVEL),G)switch(U){case zo.MITER:u.push(O,F,B,N);break;case zo.BEVEL:l?u.push(O,F,v+E*C,y+A*C,O,F,v+R*C,y+S*C):u.push(v-E*M,y-A*M,B,N,v-R*M,y-S*M,B,N),c+=2;break;case zo.ROUND:l?(u.push(O,F,v+E*C,y+A*C),c+=Qo(v,y,v+E*C,y+A*C,v+R*C,y+S*C,u,!0)+4,u.push(O,F,v+R*C,y+S*C)):(u.push(v-E*M,y-A*M,B,N),c+=Qo(v,y,v-E*M,y-A*M,v-R*M,y-S*M,u,!1)+4,u.push(v-R*M,y-S*M,B,N))}else{switch(u.push(v-E*M,y-A*M,v+E*C,y+A*C),U){case zo.MITER:l?u.push(B,N,B,N):u.push(O,F,O,F),c+=2;break;case zo.ROUND:c+=l?Qo(v,y,v+E*C,y+A*C,v+R*C,y+S*C,u,!0)+2:Qo(v,y,v-E*M,y-A*M,v-R*M,y-S*M,u,!1)+2}u.push(v-R*M,y-S*M,v+R*C,y+S*C),c+=2}}g=i[2*(d-2)],x=i[2*(d-2)+1],v=i[2*(d-1)],y=i[2*(d-1)+1],E=-(x-y),A=g-v,w=Math.sqrt(E*E+A*A),E/=w,A/=w,E*=f,A*=f,u.push(v-E*M,y-A*M,v+E*C,y+A*C),h||(n.cap===Wo.ROUND?c+=Qo(v-E*(M-C)*.5,y-A*(M-C)*.5,v-E*M,y-A*M,v+E*C,y+A*C,u,!1)+2:n.cap===Wo.SQUARE&&(c+=Zo(v,y,E,A,M,C,!1,u)));const D=e.indices,P=Yo.epsilon*Yo.epsilon;for(let t=p;t0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,i=null){const r=new rh(t,e,s,i);return this.graphicsData.push(r),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new rh(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=i.lineStyle,i.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t0&&(s=this.batches[this.batches.length-1],i=s.style);for(let r=this.shapeIndex;r65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t131070)return!1;const t=this.batches;for(let e=0;e0&&(i=ih.pop(),i||(i=new Ts,i.texArray=new wi),this.drawCalls.push(i)),i.start=u,i.size=0,i.texArray.count=0,i.type=l),_.touched=1,_._batchEnabled=t,_._batchLocation=r,_.wrapMode=p.REPEAT,i.texArray.elements[i.texArray.count++]=_,r++)),i.size+=c.size,u+=c.size,a=_._batchLocation,this.addColors(e,m.color,m.alpha,c.attribSize,c.attribStart),this.addTextureIds(s,a,c.attribSize,c.attribStart)}ys._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,i=this.textureIds,r=new ArrayBuffer(3*t.length*4),n=new Float32Array(r),a=new Uint32Array(r);let o=0;for(let r=0;r0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new ks,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new ks,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,i=s[s.length-2],r=s[s.length-1];return(i!==t||r!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,i){this._initCurve();const r=this.currentPath.points;return 0===r.length&&this.moveTo(0,0),th.curveTo(t,e,s,i,r),this}bezierCurveTo(t,e,s,i,r,n){return this._initCurve(),Ko.curveTo(t,e,s,i,r,n,this.currentPath.points),this}arcTo(t,e,s,i,r){this._initCurve(t,e);const n=this.currentPath.points,a=$o.curveTo(t,e,s,i,r,n);if(a){const{cx:t,cy:e,radius:s,startAngle:i,endAngle:r,anticlockwise:n}=a;this.arc(t,e,s,i,r,n)}return this}arc(t,e,s,i,r,n=!1){if(i===r)return this;if(!n&&r<=i?r+=Ds:n&&i<=r&&(i+=Ds),r-i==0)return this;const a=t+Math.cos(i)*s,o=e+Math.sin(i)*s,h=this._geometry.closePointEps;let l=this.currentPath?this.currentPath.points:null;if(l){const t=Math.abs(l[l.length-2]-a),e=Math.abs(l[l.length-1]-o);t0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,i){return this.drawShape(new Ls(t,e,s,i))}drawRoundedRect(t,e,s,i,r){return this.drawShape(new Xs(t,e,s,i,r))}drawCircle(t,e,s){return this.drawShape(new Gs(t,e,s))}drawEllipse(t,e,s,i){return this.drawShape(new Us(t,e,s,i))}drawPolygon(...t){let e,s=!0;const i=t[0];i.points?(s=i.closeStroke,e=i.points):e=Array.isArray(t[0])?t[0]:t;const r=new ks(e);return r.closeStroke=s,this.drawShape(r),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==Fs.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let i=0;i0){const s=o.x-t[e].x,i=o.y-t[e].y,r=Math.sqrt(s*s+i*i);o=t[e],a+=r/h}else a=e/(l-1);r[s]=a,r[s+1]=0,r[s+2]=a,r[s+3]=1}let u=0;for(let t=0;t0?this.textureScale*this._width/2:this._width/2;for(let h=0;h1&&(d=1);const c=Math.sqrt(i*i+r*r);c<1e-6?(i=0,r=0):(i/=c,r/=c,i*=o,r*=o),n[u]=l.x+i,n[u+1]=l.y+r,n[u+2]=l.x-i,n[u+3]=l.y-r,s=l}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class Eh extends xh{constructor(t,e,s){super(new Th(t.width,t.height,e,s),new yh(Wi.WHITE)),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}class Ah{constructor(t,e,s){this.geometry=new Ms,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;ss&&!t.autoResize&&(n=s);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const o=e[0]._texture.baseTexture,h=o.alphaMode>0;this.state.blendMode=Pe(t.blendMode,h),r.state.set(this.state);const l=r.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(r.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=Ie.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);let d=!1;for(let s=0,o=0;si&&(h=i),o>=a.length&&a.push(this._generateOneMoreBuffer(t));const u=a[o];u.uploadDynamic(e,s,h);const c=t._bufferUpdateIDs[o]||0;d=d||u._updateID0);i[n]=o,i[n+r]=o,i[n+2*r]=o,i[n+3*r]=o,n+=4*r}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Rh.extension={name:"particle",type:rs.RendererPlugin},os.add(Rh);var Sh=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))(Sh||{});const wh={willReadFrequently:!0},Ih=class{static get experimentalLetterSpacingSupported(){let t=Ih._experimentalLetterSpacingSupported;if(void 0!==t){const e=A.ADAPTER.getCanvasRenderingContext2D().prototype;t=Ih._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,r,n,a,o,h){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=r,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=o,this.fontProperties=h}static measureText(t,e,s,i=Ih._canvas){s=null==s?e.wordWrap:s;const r=e.toFontString(),n=Ih.measureFont(r);0===n.fontSize&&(n.fontSize=e.fontSize,n.ascent=e.fontSize);const a=i.getContext("2d",wh);a.font=r;const o=(s?Ih.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),h=new Array(o.length);let l=0;for(let t=0;t0&&(i?r-=e:r+=(Ih.graphemeSegmenter(t).length-1)*e),r}static wordWrap(t,e,s=Ih._canvas){const i=s.getContext("2d",wh);let r=0,n="",a="";const o=Object.create(null),{letterSpacing:h,whiteSpace:l}=e,u=Ih.collapseSpaces(l),d=Ih.collapseNewlines(l);let c=!u;const p=e.wordWrapWidth+h,f=Ih.tokenize(t);for(let t=0;tp)if(""!==n&&(a+=Ih.addLine(n),n="",r=0),Ih.canBreakWords(s,e.breakWords)){const t=Ih.wordWrapSplit(s);for(let l=0;lp&&(a+=Ih.addLine(n),c=!1,n="",r=0),n+=u,r+=m}}else{n.length>0&&(a+=Ih.addLine(n),n="",r=0);const e=t===f.length-1;a+=Ih.addLine(s,!e),c=!1,n="",r=0}else l+r>p&&(c=!1,a+=Ih.addLine(n),n="",r=0),(n.length>0||!Ih.isBreakingSpace(s)||c)&&(n+=s,r+=l)}return a+=Ih.addLine(n,!1),a}static addLine(t,e=!0){return t=Ih.trimRight(t),t=e?`${t}\n`:t}static getFromCache(t,e,s,i){let r=s[t];return"number"!=typeof r&&(r=Ih._measureText(t,e,i)+e,s[t]=r),r}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(t){if("string"!=typeof t)return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!Ih.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return"string"==typeof t&&Ih._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return"string"==typeof t&&Ih._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if("string"!=typeof t)return e;for(let i=0;ia;--d){for(let t=0;t{if("function"==typeof(null==Intl?void 0:Intl.Segmenter)){const t=new Intl.Segmenter;return e=>[...t.segment(e)].map((t=>t.segment))}return t=>[...t]})(),Mh.experimentalLetterSpacing=!1,Mh._fonts={},Mh._newlines=[10,13],Mh._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];const Ch=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Dh=class{constructor(t){this.styleID=0,this.reset(),Fh(this,t,t)}clone(){const t={};return Fh(t,this,Dh.defaultStyle),new Dh(t)}reset(){Fh(this,Dh.defaultStyle,Dh.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Oh(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=Oh(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let s=0;s=0;t--){let s=e[t].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!Ch.includes(s)&&(s=`"${s}"`),e[t]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};let Ph=Dh;function Oh(t){const e=Ie.shared;return Array.isArray(t)?t.map((t=>e.setValue(t).toHex())):e.setValue(t).toHex()}function Fh(t,e,s){for(const i in s)Array.isArray(e[i])?t[i]=e[i].slice():t[i]=e[i]}Ph.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Sh.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};const Bh={texture:!0,children:!1,baseTexture:!0},Nh=class extends Sn{constructor(t,e,s){var i;let r=!1;s||(s=A.ADAPTER.createCanvas(),r=!0),s.width=3,s.height=3;const n=Wi.from(s);n.orig=new Ls,n.trim=new Ls,super(n),this._ownCanvas=r,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=null!=(i=Nh.defaultResolution)?i:A.RESOLUTION,this._autoResolution=Nh.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return Mh.experimentalLetterSpacing}static set experimentalLetterSpacing(t){Kt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Mh.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const s=this.context,i=Mh.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),r=i.width,n=i.height,a=i.lines,o=i.lineHeight,h=i.lineWidths,l=i.maxLineWidth,u=i.fontProperties;let d,c;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,r)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,n)+2*e.padding)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=e.strokeThickness,s.textBaseline=e.textBaseline,s.lineJoin=e.lineJoin,s.miterLimit=e.miterLimit;const p=e.dropShadow?2:1;for(let t=0;t0&&n>a&&(o=(a+n)/2);const d=a+i,c=s.lineHeight*(t+1);let p=d;t+10}}function Uh(t,e){var s;let i=!1;if(null!=(s=null==t?void 0:t._textures)&&s.length)for(let s=0;s{!this.queue||this.prepareItems()},this.registerFindHook(zh),this.registerFindHook(Wh),this.registerFindHook(Uh),this.registerFindHook(kh),this.registerFindHook(Xh),this.registerUploadHook(Hh),this.registerUploadHook(Vh)}upload(t){return new Promise((e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,$r.system.addOnce(this.tick,this,Wr.UTILITY))):e()}))}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed)for(let s=0,i=this.uploadHooks.length;s=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&$r.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};let jh=Yh;function $h(t,e){return e instanceof ys&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function qh(t,e){if(!(e instanceof ch))return!1;const{geometry:s}=e;e.finishPoly(),s.updateBatches();const{batches:i}=s;for(let e=0;ejh.uploadsPerFrame,set(t){Kt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),jh.uploadsPerFrame=t}}});class Zh extends jh{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(Kh),this.registerUploadHook($h),this.registerUploadHook(qh)}}Zh.extension={name:"prepare",type:rs.RendererSystem},os.add(Zh);class Qh extends Sn{constructor(t,e=!0){super(t[0]instanceof Wi?t[0]:t[0].texture),this._textures=null,this._durations=null,this._autoUpdate=e,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=t}stop(){!this._playing||(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&($r.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&($r.shared.add(this.update,this,Wr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=this.animationSpeed*t,s=this.currentFrame;if(null!==this._durations){let s=this._currentTime%1*this._durations[this.currentFrame];for(s+=e/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];const i=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*i,this._currentTime+=i;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this.updateTexture())}updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;sthis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?($r.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&($r.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const Jh=new Bs;class tl extends Sn{constructor(t,e=100,s=100){super(t),this.tileTransform=new Js,this._width=e,this._height=s,this.uvMatrix=this.texture.uvMatrix||new or(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){const e=this._texture;!e||!e.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){const t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,s=this._width*(1-this._anchor._x),i=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,s,i)}getLocalBounds(t){return 0===this.children.length?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new Ls),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Jh);const e=this._width,s=this._height,i=-e*this.anchor._x;if(Jh.x>=i&&Jh.x=t&&Jh.y1?Ri.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",e):Ri.from(el,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",e)}render(t){const e=this.renderer,s=this.quad;let i=s.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const r=t.uvRespectAnchor?t.anchor.x:0,n=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-r,i[1]=i[3]=-n,i[2]=i[4]=1-r,i[5]=i[7]=1-n,s.invalidate();const a=t._texture,o=a.baseTexture,h=o.alphaMode>0,l=t.tileTransform.localTransform,u=t.uvMatrix;let d=o.isPowerOfTwo&&a.frame.width===o.width&&a.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==p.CLAMP:o.wrapMode===p.CLAMP&&(o.wrapMode=p.REPEAT));const c=d?this.simpleShader:this.shader,f=a.width,m=a.height,_=t._width,g=t._height;sl.set(l.a*f/_,l.b*f/g,l.c*m/_,l.d*m/g,l.tx/_,l.ty/g),sl.invert(),d?sl.prepend(u.mapCoord):(c.uniforms.uMapCoord=u.mapCoord.toArray(!0),c.uniforms.uClampFrame=u.uClampFrame,c.uniforms.uClampOffset=u.uClampOffset),c.uniforms.uTransform=sl.toArray(!0),c.uniforms.uColor=Ie.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(c.uniforms.uColor),c.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),c.uniforms.uSampler=a,e.shader.bind(c),e.geometry.bind(s),this.state.blendMode=Pe(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}il.extension={name:"tilingSprite",type:rs.RendererPlugin},os.add(il);const rl=class{constructor(t,e,s=null){this.linkedSheets=[],this._texture=t instanceof Wi?t:null,this.baseTexture=t instanceof ys?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const i=this.baseTexture.resource;this.resolution=this._updateResolution(s||(i?i.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=ss(t,null);return null===s&&(s=parseFloat(null!=e?e:"1")),1!==s&&this.baseTexture.setResolution(s),s}parse(){return new Promise((t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=rl.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(t){let e=t;const s=rl.BATCH_SIZE;for(;e-t{this._batchIndex*rl.BATCH_SIZE{i[t]=e})),Object.keys(e.textures).forEach((t=>{i[t]=e.textures[t]})),!s){const s=$t.dirname(t[0]);e.linkedSheets.forEach(((t,r)=>{const n=ol([`${s}/${e.data.meta.related_multi_packs[r]}`],t,!0);Object.assign(i,n)}))}return i}const hl={extension:rs.Asset,cache:{test:t=>t instanceof nl,getCacheableAssets:(t,e)=>ol(t,e,!1)},resolver:{test:t=>{const e=t.split("?")[0].split("."),s=e.pop(),i=e.pop();return"json"===s&&al.includes(i)},parse:t=>{var e,s;const i=t.split(".");return{resolution:parseFloat(null!=(s=null==(e=A.RETINA_PREFIX.exec(t))?void 0:e[1])?s:"1"),format:i[i.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:rs.LoadParser,priority:ma.Normal},testParse:async(t,e)=>".json"===$t.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,s){var i,r;let n=$t.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a=n+t.meta.image;a=la(a,e.src);const o=(await s.load([a]))[a],h=new nl(o.baseTexture,t,e.src);await h.parse();const l=null==(i=null==t?void 0:t.meta)?void 0:i.related_multi_packs;if(Array.isArray(l)){const t=[];for(const i of l){if("string"!=typeof i)continue;let a=n+i;null!=(r=e.data)&&r.ignoreMultiPack||(a=la(a,e.src),t.push(s.load({src:a,data:{ignoreMultiPack:!0}})))}const i=await Promise.all(t);h.linkedSheets=i,i.forEach((t=>{t.linkedSheets=[h].concat(h.linkedSheets.filter((e=>e!==t)))}))}return h},unload(t){t.destroy(!0)}}};os.add(hl);class ll{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ul{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const t in e){const i=e[t].match(/^[a-z]+/gm)[0],r=e[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),n={};for(const t in r){const e=r[t].split("="),s=e[0],i=e[1].replace(/"/gm,""),a=parseFloat(i),o=isNaN(a)?i:a;n[s]=o}s[i].push(n)}const i=new ll;return s.info.forEach((t=>i.info.push({face:t.face,size:parseInt(t.size,10)}))),s.common.forEach((t=>i.common.push({lineHeight:parseInt(t.lineHeight,10)}))),s.page.forEach((t=>i.page.push({id:parseInt(t.id,10),file:t.file}))),s.char.forEach((t=>i.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)}))),s.kerning.forEach((t=>i.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)}))),s.distanceField.forEach((t=>i.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType}))),i}}class dl{static test(t){const e=t;return"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){const e=new ll,s=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),r=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let t=0;t"))&&dl.test(A.ADAPTER.parseXML(t))}static parse(t){return dl.parse(A.ADAPTER.parseXML(t))}}const pl=[ul,dl,cl];function fl(t){for(let e=0;e=h-r*a){if(0===x)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${e}')`);--t,f=null,m=null,_=null,x=0,g=0,v=0;continue}if(v=Math.max(r+s.fontProperties.descent,v),b*a+g>=c){if(0===g)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${e}')`);--t,x+=v*a,x=Math.ceil(x),g=0,v=0;continue}ml(f,m,s,g,x,a,d);const E=_l(s.text);p.char.push({id:E,page:T.length-1,x:g/a,y:x/a,width:b,height:r,xoffset:0,yoffset:0,xadvance:i-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),g+=(b+2*n)*a,g=Math.ceil(g)}for(let t=0,e=u.length;t{this.dirty=!0}),this,0,0),this._roundPixels=A.ROUND_PIXELS,this.dirty=!0,this._resolution=A.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var t;const e=vl.available[this._fontName],s=this.fontSize,i=s/e.size,r=new Bs,n=[],o=[],h=[],l=gl(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),u=this._maxWidth*e.size/s,d="none"===e.distanceFieldType?yl:Tl;let c=null,p=0,f=0,m=0,_=-1,g=0,x=0,v=0,y=0;for(let t=0;t0&&r.x>u&&(++x,ke(n,1+_-x,1+t-_),t=_,_=-1,o.push(g),h.push(n.length>0?n[n.length-1].prevSpaces:0),f=Math.max(f,g),m++,r.x=0,r.y+=e.lineHeight,c=null,y=0)}const T=l[l.length-1];"\r"!==T&&"\n"!==T&&(/(?:\s)/.test(T)&&(p=g),o.push(p),f=Math.max(f,p),h.push(-1));const b=[];for(let t=0;t<=m;t++){let e=0;"right"===this._align?e=f-o[t]:"center"===this._align?e=(f-o[t])/2:"justify"===this._align&&(e=h[t]<0?0:(f-o[t])/h[t]),b.push(e)}const E=n.length,A={},R=[],S=this._activePagesMeshData;d.push(...S);for(let t=0;t 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // Gamma correction for coverage-like alpha\r\n float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r\n float gamma = mix(1.0, 1.0 / 2.2, luma);\r\n float coverage = pow(uColor.a * alpha, gamma); \r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, coverage);\r\n}\r\n"),uniforms:{uFWidth:0}}),r=a.NORMAL_NPM);const n=new xh(s,i);n.blendMode=r,t={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:n,vertices:null,uvs:null,indices:null}}t.index=0,t.indexCount=0,t.vertexCount=0,t.uvsCount=0,t.total=0;const{_textureCache:r}=this;r[i]=r[i]||new Wi(s.baseTexture),t.mesh.texture=r[i],t.mesh.tint=this._tintColor.value,R.push(t),A[i]=t}A[i].total++}for(let t=0;t6*i)||s.vertices.length<2*xh.BATCHABLE_SIZE)s.vertices=new Float32Array(8*i),s.uvs=new Float32Array(8*i),s.indices=new Uint16Array(6*i);else{const t=s.total,e=s.vertices;for(let s=4*t*2;se[t.mesh.texture.baseTexture.uid])).forEach((t=>{t.mesh.texture=Wi.EMPTY}));for(const t in e)e[t].destroy(),delete e[t];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};let Al=El;Al.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const Rl=[".xml",".fnt"],Sl={extension:{type:rs.LoadParser,priority:ma.Normal},name:"loadBitmapFont",test:t=>Rl.includes($t.extname(t).toLowerCase()),testParse:async t=>ul.test(t)||cl.test(t),async parse(t,e,s){const i=ul.test(t)?ul.parse(t):cl.parse(t),{src:r}=e,{page:n}=i,a=[];for(let t=0;to[t]));return vl.install(i,h,!0)},load:async(t,e)=>(await A.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};os.add(Sl);const wl=class extends Ph{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new wl(Object.keys(wl.defaultOptions).reduce(((e,s)=>Qi(bt({},e),{[s]:t[s]})),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach((t=>{URL.revokeObjectURL(t.src),t.refs--,0===t.refs&&(t.fontFace&&document.fonts.delete(t.fontFace),delete wl.availableFonts[t.originalUrl])})),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=wl;if(s[t]){const e=s[t];return this._fonts.push(e),e.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return A.ADAPTER.fetch(t).then((t=>t.blob())).then((async t=>new Promise(((e,s)=>{const i=URL.createObjectURL(t),r=new FileReader;r.onload=()=>e([i,r.result]),r.onerror=s,r.readAsDataURL(t)})))).then((async([i,r])=>{const n=Object.assign({family:$t.basename(t,$t.extname(t)),weight:"normal",style:"normal",src:i,dataSrc:r,refs:1,originalUrl:t,fontFace:null},e);s[t]=n,this._fonts.push(n),this.styleID++;const a=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style});n.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0}))}addOverride(...t){const e=t.filter((t=>!this._overrides.includes(t)));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter((t=>this._overrides.includes(t)));e.length>0&&(this._overrides=this._overrides.filter((t=>!e.includes(t))),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?["word-wrap: "+(this.breakWords?"break-all":"break-word"),`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce(((t,e)=>`${t}\n @font-face {\n font-family: "${e.family}";\n src: url('${e.dataSrc}');\n font-weight: ${e.weight};\n font-style: ${e.style}; \n }`),this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=Ce(t)),"number"==typeof t?Me(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(255*e|0).toString(16).padStart(2,"0"));const r=`${s}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${r} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${r} ${t}`}reset(){Object.assign(this,wl.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise((t=>setTimeout(t,100))):Promise.resolve()}get isSafari(){const{userAgent:t}=A.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};let Il=wl;Il.availableFonts={},Il.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};const Ml=class extends Sn{constructor(t="",e={}){var s;super(Wi.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this._loading=!1,this.localStyleID=-1,this.dirty=!1,this.ownsStyle=!1;const i=new Image,r=Wi.from(i,{scaleMode:A.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new Ls,r.trim=new Ls,this.texture=r;const n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),u=document.createElementNS(a,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",o.appendChild(h),this.maxWidth=Ml.defaultMaxWidth,this.maxHeight=Ml.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=o,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Ml.defaultAutoResolution,this._resolution=null!=(s=Ml.defaultResolution)?s:A.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:i,style:r,resolution:n}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:i,style:r.toCSS(n)}),this._styleElement.textContent=r.toGlobalCSS(),document.body.appendChild(this._svgRoot);const a=this._domElement.getBoundingClientRect();this._svgRoot.remove();const o=Math.min(this.maxWidth,Math.ceil(a.width)),h=Math.min(this.maxHeight,Math.ceil(a.height));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",h.toString()),i!==this._text&&(this._domElement.innerHTML=this._text),r!==this._style&&(Object.assign(this._domElement,{style:null==(e=this._style)?void 0:e.toCSS(n)}),this._styleElement.textContent=null==(s=this._style)?void 0:s.toGlobalCSS()),{width:o+2*r.padding,height:h+2*r.padding}}async updateText(t=!0){const{style:e,_image:s,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:r,height:n}=this.measureText();s.width=i.width=Math.ceil(Math.max(1,r)),s.height=i.height=Math.ceil(Math.max(1,n)),this._loading||(this._loading=!0,await new Promise((t=>{i.onload=async()=>{await e.onBeforeDraw(),this._loading=!1,s.src=i.src,i.onload=null,i.src="",this.updateTexture(),t()};const r=(new XMLSerializer).serializeToString(this._svgRoot);i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(r)}`})))}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:i}=this,{padding:r}=t,{baseTexture:n}=e;e.trim.width=e._frame.width=s.width/i,e.trim.height=e._frame.height=s.height/i,e.trim.x=-r,e.trim.y=-r,e.orig.width=e._frame.width-2*r,e.orig.height=e._frame.height-2*r,this._onTextureUpdate(),n.setRealSize(s.width,s.height,i),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var e,s,i,r,n;"boolean"==typeof t&&(t={children:t}),t=Object.assign({},Ml.defaultDestroyOptions,t),super.destroy(t);const a=null;this.ownsStyle&&(null==(e=this._style)||e.cleanFonts()),this._style=a,null==(s=this._svgRoot)||s.remove(),this._svgRoot=a,null==(i=this._domElement)||i.remove(),this._domElement=a,null==(r=this._foreignObject)||r.remove(),this._foreignObject=a,null==(n=this._styleElement)||n.remove(),this._styleElement=a,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=a,this._image.src="",this._image=a}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=Xe(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=Xe(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&((t=t||{})instanceof Il?(this.ownsStyle=!1,this._style=t):t instanceof Ph?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Il.from(t)):(this.ownsStyle=!0,this._style=new Il(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(""===t||null==t?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/

/gi,"
").replace(/
/gi,"
").replace(/ /gi," ")}};let Cl=Ml;return Cl.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Cl.defaultMaxWidth=2024,Cl.defaultMaxHeight=2024,Cl.defaultAutoResolution=!0,t.ALPHA_MODES=m,t.AbstractMultiResource=on,t.AccessibilityManager=ta,t.AlphaFilter=Mn,t.AnimatedSprite=Qh,t.Application=sa,t.ArrayResource=hn,t.Assets=Ga,t.AssetsClass=La,t.Attribute=As,t.BLEND_MODES=a,t.BUFFER_BITS=n,t.BUFFER_TYPE=b,t.BackgroundSystem=Oi,t.BaseImageResource=ki,t.BasePrepare=jh,t.BaseRenderTexture=Ui,t.BaseTexture=ys,t.BatchDrawCall=Ts,t.BatchGeometry=Cs,t.BatchRenderer=Ci,t.BatchShaderGenerator=Si,t.BatchSystem=Fi,t.BatchTextureArray=wi,t.BitmapFont=vl,t.BitmapFontData=ll,t.BitmapText=Al,t.BlobResource=Za,t.BlurFilter=On,t.BlurFilterPass=Pn,t.Bounds=gn,t.BrowserAdapter=E,t.Buffer=Es,t.BufferResource=gs,t.BufferSystem=sn,t.CLEAR_MODES=_,t.COLOR_MASK_BITS=y,t.Cache=pa,t.CanvasResource=ln,t.Circle=Gs,t.Color=Ie,t.ColorMatrixFilter=Fn,t.CompressedTextureResource=Qa,t.Container=En,t.ContextSystem=Ni,t.CountLimiter=Gh,t.CubeResource=dn,t.DEG_TO_RAD=Os,t.DRAW_MODES=o,t.DisplacementFilter=Bn,t.DisplayObject=xn,t.ENV=i,t.Ellipse=Us,t.EventBoundary=jn,t.EventSystem=Kn,t.ExtensionType=rs,t.Extract=Go,t.FORMATS=h,t.FORMATS_TO_COMPONENTS=Mo,t.FXAAFilter=Nn,t.FederatedDisplayObject=Qn,t.FederatedEvent=kn,t.FederatedMouseEvent=Xn,t.FederatedPointerEvent=Hn,t.FederatedWheelEvent=Vn,t.FillStyle=hh,t.Filter=Pi,t.FilterState=Ki,t.FilterSystem=tr,t.Framebuffer=Gi,t.FramebufferSystem=ir,t.GC_MODES=g,t.GLFramebuffer=er,t.GLProgram=Ar,t.GLTexture=Xr,t.GRAPHICS_CURVES=jo,t.GenerateTextureSystem=yr,t.Geometry=Ms,t.GeometrySystem=nr,t.Graphics=ch,t.GraphicsData=rh,t.GraphicsGeometry=oh,t.HTMLText=Cl,t.HTMLTextStyle=Il,t.IGLUniformData=class{},t.INSTALLED=ps,t.INTERNAL_FORMATS=Wa,t.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=Ya,t.ImageBitmapResource=cn,t.ImageResource=Xi,t.LINE_CAP=Wo,t.LINE_JOIN=zo,t.LineStyle=lh,t.LoaderParserPriority=ma,t.MASK_TYPES=v,t.MIPMAP_MODES=f,t.MSAA_QUALITY=T,t.MaskData=lr,t.MaskSystem=ur,t.Matrix=Hs,t.Mesh=xh,t.MeshBatchUvs=fh,t.MeshGeometry=vh,t.MeshMaterial=yh,t.MultisampleSystem=tn,t.NineSlicePlane=class extends Eh{constructor(t,e,s,i,r){var n,a,o,h,l,u,d,c;super(Wi.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=null!=(a=null!=e?e:null==(n=t.defaultBorders)?void 0:n.left)?a:10,this._rightWidth=null!=(h=null!=i?i:null==(o=t.defaultBorders)?void 0:o.right)?h:10,this._topHeight=null!=(u=null!=s?s:null==(l=t.defaultBorders)?void 0:l.top)?u:10,this._bottomHeight=null!=(c=null!=r?r:null==(d=t.defaultBorders)?void 0:d.bottom)?c:10,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,s=this._topHeight+this._bottomHeight,i=this._height>s?1:this._height/s;return Math.min(e,i)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const s=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}},t.NoiseFilter=Ln,t.ObjectRenderer=Ii,t.ObjectRendererSystem=rn,t.ObservablePoint=Zs,t.PI_2=Ds,t.PRECISION=x,t.ParticleContainer=class extends En{constructor(t=1500,e,s=16384,i=!1){super();s>16384&&(s=16384),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=a.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Ie(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(()=>this.onChildrenChange(0)))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.length0&&(t.baseTexture.wrapMode=p.REPEAT),super(i,r),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}},t.Sprite=Sn,t.SpriteMaskFilter=hr,t.Spritesheet=nl,t.StartupSystem=Br,t.State=cs,t.StateSystem=Lr,t.StencilSystem=_r,t.SystemManager=Gr,t.TARGETS=l,t.TEXT_GRADIENT=Sh,t.TYPES=u,t.TYPES_TO_BYTES_PER_COMPONENT=Io,t.TYPES_TO_BYTES_PER_PIXEL=Co,t.TemporaryDisplayObject=vn,t.Text=Lh,t.TextFormat=ul,t.TextMetrics=Mh,t.TextStyle=Ph,t.Texture=Wi,t.TextureGCSystem=kr,t.TextureMatrix=or,t.TextureSystem=Hr,t.TextureUvs=Hi,t.Ticker=$r,t.TickerPlugin=qr,t.TilingSprite=tl,t.TilingSpriteRenderer=il,t.TimeLimiter=class{constructor(t){this.maxMilliseconds=t,this.frameStart=0}beginFrame(){this.frameStart=Date.now()}allowedToUpload(){return Date.now()-this.frameStart