PageSourceSearch

https://bombhopper.io/@pixi-77c13fa2.js

js bombhopper.io collected 2026-10-05 11:39:39 UTC 518,080 bytes, 10 lines download raw bytes

1import"./url-bba75d43.js";import{E as t}from"./eventemitter3-b285e461.js";import{e}from"./earcut-fbed66c8.js";import{i}from"./ismobilejs-f91cde33.js";var r=(t=>(t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2",t))(r||{}),s=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS",t))(s||{}),n=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(n||{}),o=(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))(o||{}),a=(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))(a||{}),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||{}),c=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(c||{}),d=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(d||{}),f=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(f||{}),p=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(p||{}),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||{}),g=(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))(_||{}),v=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(v||{}),x=(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))(x||{}),y=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(y||{}),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 T={ADAPTER:{createCanvas:(t,e)=>{const i=document.createElement("canvas");return i.width=t,i.height=e,i},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},E=(i.default??i)(globalThis.navigator);T.RETINA_PREFIX=/@([0-9\.]+)x/,T.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;const A={};function S(t,e,i=3){if(A[e])return;let r=(new Error).stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`):(r=r.split("\n").splice(i).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(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`),console.warn(r))),A[e]=!0}function w(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function C(t){return t.split("?")[0].split("#")[0]}const P={toPosix(t){return e="\\",i="/",t.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),i);var e,i},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),isBlobUrl:t=>
1t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){w(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const i=/^[^/:]+:\/{0,2}/.exec(t);return i?i[0]:""},toAbsolute(t,e,i){if(w(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=C(this.toPosix(e??T.ADAPTER.getBaseUrl())),s=C(this.toPosix(i??this.rootname(r)));return(t=this.toPosix(t)).startsWith("/")?P.join(s,t.slice(1)):this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(w(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;let e="";const i=(t=this.toPosix(t)).startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return t=function(t,e){let i="",r=0,s=-1,n=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(47===o)break;o=47}if(47===o){if(s!==a-1&&1!==n)if(s!==a-1&&2===n){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){const t=i.lastIndexOf("/");if(t!==i.length-1){-1===t?(i="",r=0):(i=i.slice(0,t),r=i.length-1-i.lastIndexOf("/")),s=a,n=0;continue}}else if(2===i.length||1===i.length){i="",r=0,s=a,n=0;continue}e&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+=`/${t.slice(s+1,a)}`:i=t.slice(s+1,a),r=a-s-1;s=a,n=0}else 46===o&&-1!==n?++n:n=-1}return i}(t,!1),t.length>0&&r&&(t+="/"),i?`/${t}`:e+t},isAbsolute(t){return w(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let i=0;i<t.length;++i){const r=t[i];if(w(r),r.length>0)if(void 0===e)e=r;else{const s=t[i-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(w(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const i=47===e;let r=-1,s=!0;const n=this.getProtocol(t),o=t;for(let i=(t=t.slice(n.length)).length-1;i>=1;--i)if(e=t.charCodeAt(i),47===e){if(!s){r=i;break}}else s=!1;return-1===r?i?"/":this.isUrl(o)?n+t:n:i&&1===r?"//":n+t.slice(0,r)},rootname(t){w(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const i=t.indexOf("/",e.length);e=-1!==i?t.slice(0,i):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){w(t),e&&w(e),t=C(this.toPosix(t));let i,r=0,s=-1,n=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(i=t.length-1;i>=0;--i){const h=t.charCodeAt(i);if(47===h){if(!n){r=i+1;break}}else-1===a&&(n=!1,a=i+1),o>=0&&(h===e.charCodeAt(o)?-1==--o&&(s=i):(o=-1,s=a))}return r===s?s=a:-1===s&&(s=t.length),t.slice(r,s)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!n){r=i+1;break}}else-1===s&&(n=!1,s=i+1);return-1===s?"":t.slice(r,s)},extname(t){w(t);let e=-1,i=0,r=-1,s=!0,n=0;for(let o=(t=C(this.toPosix(t))).length-1;o>=0;--o){const a=t.charCodeAt(o);if(47!==a)-1===r&&(s=!1,r=o+1),46===a?-1===e?e=o:1!==n&&(n=1):-1!==e&&(n=-1);else if(!s){i=o+1;break}}return-1===e||-1===r||0===n||1===n&&e===r-1&&e===i+1?"":t.slice(e,r)},parse(t){w(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let i=(t=C(this.toPosix(t))).charCodeAt(0);const r=this.isAbsolute(t);let s;e.root=this.rootname(t),s=r||this.hasProtocol(t)?1:0;let n=-1,o=0,a=-1,h=!0,l=t.length-1,u=0;for(;l>=s;--l)if(i=t.charCodeAt(l),47!==i)-1===a&&(h=!1,a=l+1),46===i?-1===n?n=l:1!==u&&(u=1):-1!==n&&(u=-1);else if(!h){o=l+1;break}return-1===n||-1===a||0===u||1===u&&n===a-1&&n===o+1?-1!==a&&(e.base=e.name=0===o&&r?t.slice(1,a):t.slice(o,a)):(0===o&&r?(e.name=t.slice(1,n),e.base=t.slice(1,a)):(e.name=t.slice(o,n),e.base=t.slice(o,a)),e.ext=t.slice(n,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let R,I;async function M(){return R??(R=(async()=>{const t=document.createElement("canvas").getContext("webgl");if(!t)return m.UNPACK;const e=await new Promise((t=>{const e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()}));if(!e)return m.UNPACK;const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const s=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,s),t.deleteFramebuffer(r),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),s[0]<=s[3]?m.PMA:m.UNPACK})()),R}var D={grad:.9,turn:360,rad:360/(2*Math.PI)},F=function(t){return"string"==typeof t?t.length>0:"number"==typeof t}
vendor: 8,336 bytes, line 1
1,B=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=Math.pow(10,e)),Math.round(i*t)/i+0},L=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=1),t>i?i:t>e?t:e},O=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},N=function(t){return{r:L(t.r,0,255),g:L(t.g,0,255),b:L(t.b,0,255),a:L(t.a)}},k=function(t){return{r:B(t.r),g:B(t.g),b:B(t.b),a:B(t.a,3)}},U=/^#([0-9a-f]{3,8})$/i,G=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},z=function(t){var e=t.r,i=t.g,r=t.b,s=t.a,n=Math.max(e,i,r),o=n-Math.min(e,i,r),a=o?n===e?(i-r)/o:n===i?2+(r-e)/o:4+(e-i)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},H=function(t){var e=t.h,i=t.s,r=t.v,s=t.a;e=e/360*6,i/=100,r/=100;var n=Math.floor(e),o=r*(1-i),a=r*(1-(e-n)*i),h=r*(1-(1-e+n)*i),l=n%6;return{r:255*[r,a,o,o,h,r][l],g:255*[h,r,r,a,o,o][l],b:255*[o,o,h,r,r,a][l],a:s}},X=function(t){return{h:O(t.h),s:L(t.s,0,100),l:L(t.l,0,100),a:L(t.a)}},V=function(t){return{h:B(t.h),s:B(t.s),l:B(t.l),a:B(t.a,3)}},j=function(t){return H((i=(e=t).s,{h:e.h,s:(i*=((r=e.l)<50?r:100-r)/100)>0?2*i/(r+i)*100:0,v:r+i,a:e.a}));var e,i,r},W=function(t){return{h:(e=z(t)).h,s:(s=(200-(i=e.s))*(r=e.v)/100)>0&&s<200?i*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,i,r,s},$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Y=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,q=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,K=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Z={string:[[function(t){var e=U.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?B(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?B(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=q.exec(t)||K.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:N({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=$.exec(t)||Y.exec(t);if(!e)return null;var i,r,s=X({h:(i=e[1],r=e[2],void 0===r&&(r="deg"),Number(i)*(D[r]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return j(s)},"hsl"]],object:[[function(t){var e=t.r,i=t.g,r=t.b,s=t.a,n=void 0===s?1:s;return F(e)&&F(i)&&F(r)?N({r:Number(e),g:Number(i),b:Number(r),a:Number(n)}):null},"rgb"],[function(t){var e=t.h,i=t.s,r=t.l,s=t.a,n=void 0===s?1:s;if(!F(e)||!F(i)||!F(r))return null;var o=X({h:Number(e),s:Number(i),l:Number(r),a:Number(n)});return j(o)},"hsl"],[function(t){var e=t.h,i=t.s,r=t.v,s=t.a,n=void 0===s?1:s;if(!F(e)||!F(i)||!F(r))return null;var o=function(t){return{h:O(t.h),s:L(t.s,0,100),v:L(t.v,0,100),a:L(t.a)}}({h:Number(e),s:Number(i),v:Number(r),a:Number(n)});return H(o)},"hsv"]]},Q=function(t,e){for(var i=0;i<e.length;i++){var r=e[i][0](t);if(r)return[r,e[i][1]]}return[null,void 0]},J=function(t,e){var i=W(t);return{h:i.h,s:L(i.s+100*e,0,100),l:i.l,a:i.a}},tt=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},et=function(t,e){var i=W(t);return{h:i.h,s:i.s,l:L(i.l+100*e,0,100),a:i.a}},it=function(){function t(t){this.parsed=function(t){return"string"==typeof t?Q(t.trim(),Z.string):"object"==typeof t&&null!==t?Q(t,Z.object):[null,void 0]}(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return B(tt(this.rgba),2)},t.prototype.isDark=function(){return tt(this.rgba)<.5},t.prototype.isLight=function(){return tt(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=k(this.rgba)).r,i=t.g,r=t.b,n=(s=t.a)<1?G(B(255*s)):"","#"+G(e)+G(i)+G(r)+n;var t,e,i,r,s,n},t.prototype.toRgb=function(){return k(this.rgba)},t.prototype.toRgbString=function(){return e=(t=k(this.rgba)).r,i=t.g,r=t.b,(s=t.a)<1?"rgba("+e+", "+i+", "+r+", "+s+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,s},t.prototype.toHsl=function(){return V(W(this.rgba))},t.prototype.toHslString=function(){return e=(t=V(W(this.rgba))).h,i=t.s,r=t.l,(s=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+s+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,s},t.prototype.toHsv=function(){return t=z(this.rgba),{h:B(t.h),s:B(t.s),v:B(t.v),a:B(t.a,3)};var t},t.prototype.invert=function(){return rt({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),rt(J(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),rt(J(this.rgba,-t))},t.prototype.grayscale=function(){return rt(J(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),rt(et(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),rt(et(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?rt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):B(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=W(this.rgba);return"number"==typeof t?rt({h:t,s:e.s,l:e.l,a:e.a}):B(e.h)},t.prototype.isEqual=function(t){return this.toHex()===rt(t).toHex()},t}(),rt=function(t){return t instanceof it?t:new it(t)},st=[];!function(t){t.forEach((function(t){st.indexOf(t)<0&&(t(it,Z),st.push(t))}))}([function(t,e){var i={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",s
1andybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in i)r[i[s]]=s;var n={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var s,o,a=r[this.toHex()];if(a)return a;if(null==e?void 0:e.closest){var h=this.toRgb(),l=1/0,u="black";if(!n.length)for(var c in i)n[c]=new t(i[c]).toRgb();for(var d in i){var f=(s=h,o=n[d],Math.pow(s.r-o.r,2)+Math.pow(s.g-o.g,2)+Math.pow(s.b-o.b,2));f<l&&(l=f,u=d)}return u}},e.string.push([function(e){var r=e.toLowerCase(),s="transparent"===r?"#0000":i[r];return s?new t(s).toRgb():null},"name"])}]);const nt=class t{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(e){if(e instanceof t)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw new Error("Cannot set PIXI.Color#value to null");(null===this._value||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if("number"===i||"string"===i||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,i)=>t===e[i]));if(null!==t&&null!==e){const i=Object.keys(t),r=Object.keys(e);return i.length===r.length&&i.every((i=>t[i]===e[i]))}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return(t=t??[])[0]=Math.round(255*e),t[1]=Math.round(255*i),t[2]=Math.round(255*r),t}toRgbArray(t){t=t??[];const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){const[i,r,s,n]=t.temp.setValue(e)._components;return this._components[0]*=i,this._components[1]*=r,this._components[2]*=s,this._components[3]*=n,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 i=this._int>>16&255,r=this._int>>8&255,s=255&this._int;return e&&(i=i*t+.5|0,r=r*t+.5|0,s=s*t+.5|0),(255*t<<24)+(i<<16)+(r<<8)+s}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,i,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,r,s]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=s,t}normalize(e){let i,r,s,n;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){i=(e>>16&255)/255,r=(e>>8&255)/255,s=(255&e)/255,n=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[i,r,s,n=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[i,r,s,n=255]=e,i/=255,r/=255,s/=255,n/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){const i=t.HEX_PATTERN.exec(e);i&&(e=`#${i[2]}`)}const o=rt(e);o.isValid()&&(({r:i,g:r,b:s,a:n}=o.rgba),i/=255,r/=255,s/=255)}if(void 0===i)throw new Error(`Unable to convert color ${e}`);this._components[0]=i,this._components[1]=r,this._components[2]=s,this._components[3]=n,this.refreshInt()}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*i|0)}_clamp(t,e=0,i=1){return"number"==typeof t?Math.min(Math.max(t,e),i):(t.forEach(((r,s)=>{t[s]=Math.min(Math.max(r,e),i)})),t)}};nt.shared=new nt,nt.temp=new nt,nt.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let ot=nt;function at(t,e=[]){return S("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),ot.shared.setValue(t).toRgbArray(e)}function ht(t){return S("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),ot.shared.setValue(t).toHex()}function lt(t){return S("7.2.0","utils.string2hex is deprecated, use Color#toNumber instead"),ot.shared.setValue(t).toNumber()}function ut(t){return S("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),ot.shared.setValue(t).toNumber()}const ct=function(){const t=[],e=[];for(let i=0;i<32;i++)t[i]=i,e[i]=i;t[o.NORMAL_NPM]=o.NORMAL,t[o.ADD_NPM]=o.ADD,t[o.SCREEN_NPM]=o.SCREEN,e[o.NORMAL]=o.NORMAL_NPM,e[o.ADD]=o.ADD_NPM,e[o.SCREEN]=o.SCREEN_NPM;const i=[];return i.push(e),i.push(t),i}();function dt(t,e){return ct[e?1:0][t]}function ft(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}function pt(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function mt(t){return!(t&t-1||!t)}function gt(t){let e=(t>65535?1:0)<<4,i=((t>>>=e)>255?1:0)<<3;return e|=i,i=((t>>>=i)>15?1:0)<<2,e|=i,i=((t>>>=i)>3?1:0)<<1,e|=i,e|(t>>>=i)>>1}function _t(t,e,i){const r=t.length;let s;if(e>=r||0===i)return;const n=r-(i=e+i>r?r-e:i);for(s=e;s<n;++s)t[s]=t[s+i];t.length=n}function vt(t){return 0===t?0:t<0?-1:1}let xt=0;function yt(){return++xt}const bt=class{constructor(t,e,i,r){this.left=t,this.top=e,this.right=i,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};
1bt.EMPTY=new bt(0,0,0,0);let Tt=bt;const Et={},At=Object.create(null),St=Object.create(null);class wt{constructor(t,e,i){this._canvas=T.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||T.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(null===this._canvas)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Ct(t,e,i){for(let r=0,s=4*i*e;r<e;++r,s+=4)if(0!==t[s+3])return!1;return!0}function Pt(t,e,i,r,s){const n=4*e;for(let e=r,o=r*n+4*i;e<=s;++e,o+=n)if(0!==t[o+3])return!1;return!0}function Rt(t){const e=function(t){const{width:e,height:i}=t,r=t.getContext("2d",{willReadFrequently:!0});if(null===r)throw new TypeError("Failed to get canvas 2D context");const s=r.getImageData(0,0,e,i).data;let n=0,o=0,a=e-1,h=i-1;for(;o<i&&Ct(s,e,o);)++o;if(o===i)return Tt.EMPTY;for(;Ct(s,e,h);)--h;for(;Pt(s,e,n,o,h);)++n;for(;Pt(s,e,a,o,h);)--a;return++a,++h,new Tt(n,o,a,h)}(t),{width:i,height:r}=e;let s=null;if(!e.isEmpty()){const n=t.getContext("2d");if(null===n)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(e.left,e.top,i,r)}return{width:i,height:r,data:s}}function It(t,e=1){const i=T.RETINA_PREFIX?.exec(t);return i?parseFloat(i[1]):e}var Mt=(t=>(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))(Mt||{});const Dt=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},Ft=(t,e)=>Dt(t).priority??e,Bt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Dt).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(Dt).forEach((t=>{t.type.forEach((e=>{const i=this._addHandlers,r=this._queue;i[e]?i[e]?.(t):(r[e]=r[e]||[],r[e]?.push(t))}))})),this},handle(t,e,i){const r=this._addHandlers,s=this._removeHandlers;if(r[t]||s[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,s[t]=i;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=>{t.name&&(e[t.name]=t.ref)}),(t=>{t.name&&delete e[t.name]}))},handleByList(t,e,i=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>Ft(e,i)-Ft(t,i))))}),(t=>{const i=e.indexOf(t.ref);-1!==i&&e.splice(i,1)}))}};class Lt{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 Ot=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Nt(t){let e="";for(let i=0;i<t;++i)i>0&&(e+="\nelse "),i<t-1&&(e+=`if(test == ${i}.0){}`);return e}class kt{constructor(){this.data=0,this.blendMode=o.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}
1get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==o.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new kt;return t.depthTest=!1,t.blend=!0,t}}kt.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Ut=[];function Gt(t,e){if(!t)return null;let i="";if("string"==typeof t){const e=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);e&&(i=e[1].toLowerCase())}for(let r=Ut.length-1;r>=0;--r){const s=Ut[r];if(s.test&&s.test(t,i))return new s(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class zt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,r,s,n,o,a){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:l}=this;this._aliasCount++;for(let u=0,c=l.length;u<c;u++)l[u][h](t,e,i,r,s,n,o,a);return l===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){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.length=0,this._name=""}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(zt.prototype,{dispatch:{value:zt.prototype.emit},run:{value:zt.prototype.emit}});class Ht{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new zt("setRealSize"),this.onUpdate=new zt("update"),this.onError=new zt("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,i){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 Xt extends Ht{constructor(t,e){const{width:i,height:r}=e||{};if(!i||!r)throw new Error("BufferResource width or height invalid");super(i,r),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===m.UNPACK);const s=e.realWidth,n=e.realHeight;return i.width===s&&i.height===n?r.texSubImage2D(e.target,0,0,0,s,n,e.format,i.type,this.data):(i.width=s,i.height=n,r.texImage2D(e.target,0,i.internalFormat,s,n,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return null===t||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const Vt={scaleMode:d.NEAREST,alphaMode:m.NPM},jt=class e extends t{constructor(t=null,i=null){super(),i=Object.assign({},e.defaultOptions,i);const{alphaMode:r,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=i;t&&!(t instanceof Ht)&&((t=Gt(t,p)).internal=!0),this.resolution=f||T.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=u,this.type=c,this.target=d,this.alphaMode=r,this.uid=yt(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),void 0!==e&&e!==this.mipmap&&
1(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=mt(this.realWidth)&&mt(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 St[this.cacheId],delete At[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,i,r=T.STRICT_TEXTURE_CACHE){const s="string"==typeof t;let n=null;if(s)n=t;else{if(!t._pixiId){const e=i?.pixiIdPrefix||"pixiid";t._pixiId=`${e}_${yt()}`}n=t._pixiId}let o=St[n];if(s&&r&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new e(t,i),o.cacheId=n,e.addToCache(o,n)),o}static fromBuffer(t,i,r,s){t=t||new Float32Array(i*r*4);const n=new Xt(t,{width:i,height:r,...s?.resourceOptions});let o,a;return t instanceof Float32Array?(o=h.RGBA,a=u.FLOAT):t instanceof Int32Array?(o=h.RGBA_INTEGER,a=u.INT):t instanceof Uint32Array?(o=h.RGBA_INTEGER,a=u.UNSIGNED_INT):t instanceof Int16Array?(o=h.RGBA_INTEGER,a=u.SHORT):t instanceof Uint16Array?(o=h.RGBA_INTEGER,a=u.UNSIGNED_SHORT):t instanceof Int8Array?(o=h.RGBA,a=u.BYTE):(o=h.RGBA,a=u.UNSIGNED_BYTE),n.internal=!0,new e(n,Object.assign({},Vt,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),St[e]&&St[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),St[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=St[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete St[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete St[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};jt.defaultOptions={mipmap:p.POW2,anisotropicLevel:0,scaleMode:d.LINEAR,wrapMode:f.CLAMP,alphaMode:m.UNPACK,target:l.TEXTURE_2D,format:h.RGBA,type:u.UNSIGNED_BYTE},jt._globalBatch=0;let Wt=jt;class $t{constructor(){this.texArray=null,this.blend=0,this.type=a.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Yt=0;class qt{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=Yt++,this.disposeRunner=new zt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?b.ELEMENT_ARRAY_BUFFER:b.ARRAY_BUFFER}get index(){return this.type===b.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new qt(t)}}class Kt{constructor(t,e=0,i=!1,r=u.FLOAT,s,n,o,a=1){this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=s,this.start=n,this.instance=o,this.divisor=a}destroy(){this.buffer=null}static from(t,e,i,r,s){return new Kt(t,e,i,r,s)}}const Zt={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};const Qt={5126:4,5123:2,5121:1};let Jt=0;const te={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array};class ee{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Jt++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new zt("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,r=!1,s,n,o,a=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof qt||(e instanceof Array&&(e=new Float32Array(e)),e=new qt(e));const h=t.split("|");if(h.length>1){for(let t=0;t<h.length;t++)this.addAttribute(h[t],e,i,r,s);return this}let l=this.buffers.indexOf(e);return-1===l&&(this.buffers.push(e),l=this.buffers.length-1),this.attributes[t]=new Kt(l,i,r,s,n,o,a),this.instanced=this.instanced||a,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof qt||(t instanceof Array&&(t=new Uint16Array(t)),t=new qt(t)),t.type=b.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;const t=[],e=[],i=new qt;let r;for(r in this.attributes){const i=this.attributes[r],s=this.buffers[i.buffer];t.push(s.data),e.push(i.size*Qt[i.type]/4),i.buffer=0}for(i.data=function(t,e){let i=0,r=0;const s={};for(let s=0;s<t.length;s++)r+=e[s],i+=t[s].length;const n=new ArrayBuffer(4*i);let o=null,a=0;for(let i=0;i<t.length;i++){const h=e[i],l=t[i],u=ft(l);s[u]||(s[u]=new Zt[u](n)),o=s[u];for(let t=0;t<l.length;t++)o[(t/h|0)*r+a+t%h]=l[t];a+=h}return new Float32Array(n)}(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new ee;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new qt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Kt(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=b.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new ee,i=[],r=[],s=[];let n;for(let e=0;e<t.length;e++){n=t[e];for(let t=0;t<n.buffers.length;t++)r[t]=r[t]||0,r[t]+=n.buffers[t].data.length,s[t]=0}for(let t=0;t<n.buffers.length;t++)i[t]=new(te[ft(n.buffers[t].data)])(r[t]),e.buffers[t]=new qt(i[t]);for(let e=0;e<t.length;e++){n=t[e];for(let t=0;t<n.buffers.length;t++)i[t].set(n.buffers[t].data,s[t]),s[t]+=n.buffers[t].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=b.ELEMENT_ARRAY_BUFFER;let i=0,r=0,s=0,o=0;for(let t=0;t<n.buffers.length;t++)if(n.buffers[t]!==n.indexBuffer){o=t;break}for(const t in n.attributes){const e=n.attributes[t];(0|e.buffer)===o&&(r+=e.size*Qt[e.type]/4)}for(let n=0;n<t.length;n++){const a=t[n].indexBuffer.data;for(let t=0;t<a.length;t++)e.indexBuffer.data[t+s]+=i;i+=t[n].buffers[o].data.length/r,s+=a.length}}return e}}class ie extends ee{constructor(t=!1){super(),this._buffer=new qt(null,t,!1),this._indexBuffer=new qt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,u.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,u.FLOAT).addAttribute("aColor",this._buffer,4,!0,u.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,u.FLOAT).addIndex(this._indexBuffer)}}const re=2*Math.PI,se=180/Math.PI,ne=Math.PI/180;var oe=(t=>
1(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))(oe||{});class ae{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new ae(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}}ae.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const he=[new ae,new ae,new ae,new ae];class le{constructor(t=0,e=0,i=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=oe.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 le(0,0,0,0)}clone(){return new le(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.x+this.width&&e>=this.y&&e<this.y+this.height)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const i=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>i}const i=this.left,r=this.right,s=this.top,n=this.bottom;if(r<=i||n<=s)return!1;const o=he[0].set(t.left,t.top),a=he[1].set(t.left,t.bottom),h=he[2].set(t.right,t.top),l=he[3].set(t.right,t.bottom);if(h.x<=o.x||a.y<=o.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u||(e.apply(o,o),e.apply(a,a),e.apply(h,h),e.apply(l,l),Math.max(o.x,a.x,h.x,l.x)<=i||Math.min(o.x,a.x,h.x,l.x)>=r||Math.max(o.y,a.y,h.y,l.y)<=s||Math.min(o.y,a.y,h.y,l.y)>=n))return!1;const c=u*(a.y-o.y),d=u*(o.x-a.x),f=c*i+d*s,p=c*r+d*s,m=c*i+d*n,g=c*r+d*n;if(Math.max(f,p,m,g)<=c*o.x+d*o.y||Math.min(f,p,m,g)>=c*l.x+d*l.y)return!1;const _=u*(o.y-h.y),v=u*(h.x-o.x),x=_*i+v*s,y=_*r+v*s,b=_*i+v*n,T=_*r+v*n;return!(Math.max(x,y,b,T)<=_*o.x+v*o.y||Math.min(x,y,b,T)>=_*l.x+v*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),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(s-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=s-r,this}}le.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ue{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=oe.CIRC}clone(){return new ue(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,s=this.y-e;return r*=r,s*=s,r+s<=i}getBounds(){return new le(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}}ue.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ce{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.width=i,this.height=r,this.type=oe.ELIP}clone(){return new ce(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,i+r<=1}getBounds(){return new le(this.x-this.width,this.y-this.height,this.width,this.height)}}ce.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class de{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let i=0,r=e.length;i<r;i++)t.push(e[i].x,e[i].y);e=t}this.points=e,this.type=oe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new de(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const r=this.points.length/2;for(let s=0,n=r-1;s<r;n=s++){const r=this.points[2*s],o=this.points[2*s+1],a=this.points[2*n],h=this.points[2*n+1];o>e!=h>e&&t<(e-o)/(h-o)*(a-r)+r&&(i=!i)}return i}}de.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`};class fe{constructor(t=0,e=0,i=0,r=0,s=20){this.x=t,this.y=e,this.width=i,this.height=r,this.radius=s,this.type=oe.RREC}clone(){return new fe(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),s=e-(this.y+i);const n=i*i;if(r*r+s*s<=n||(r=t-(this.x+this.width-i),r*r+s*s<=n)||(s=e-(this.y+this.height-i),r*r+s*s<=n)||(r=t-(this.x+i),r*r+s*s<=n))return!0}return!1}}fe.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class pe{constructor(t=1,e=0,i=0,r=1,s=0,n=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=s,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,i,r,s,n){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=s,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ae;const i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.t
1y,e}applyInverse(t,e){e=e||new ae;const i=1/(this.a*this.d+this.c*-this.b),r=t.x,s=t.y;return e.x=this.d*i*r+-this.c*i*s+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*s+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),r=this.a,s=this.c,n=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=n*e-this.ty*i,this.ty=n*i+this.ty*e,this}append(t){const e=this.a,i=this.b,r=this.c,s=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*s,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*s,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this}setTransform(t,e,i,r,s,n,o,a,h){return this.a=Math.cos(o+h)*s,this.b=Math.sin(o+h)*s,this.c=-Math.sin(o-a)*n,this.d=Math.cos(o-a)*n,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*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,i=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*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,i=this.b,r=this.c,s=this.d,n=t.pivot,o=-Math.atan2(-r,s),a=Math.atan2(i,e),h=Math.abs(o+a);return h<1e-5||Math.abs(re-h)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+s*s),t.position.x=this.tx+(n.x*e+n.y*r),t.position.y=this.ty+(n.x*i+n.y*s),t}invert(){const t=this.a,e=this.b,i=this.c,r=this.d,s=this.tx,n=t*r-e*i;return this.a=r/n,this.b=-e/n,this.c=-i/n,this.d=t/n,this.tx=(i*this.ty-r*s)/n,this.ty=-(t*this.ty-e*s)/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 pe;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new pe}static get TEMP_MATRIX(){return new pe}}pe.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const me=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ge=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],_e=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ve=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xe=[],ye=[],be=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];xe.push(e);for(let i=0;i<16;i++){const r=be(me[t]*me[i]+_e[t]*ge[i]),s=be(ge[t]*me[i]+ve[t]*ge[i]),n=be(me[t]*_e[i]+_e[t]*ve[i]),o=be(ge[t]*_e[i]+ve[t]*ve[i]);for(let t=0;t<16;t++)if(me[t]===r&&ge[t]===s&&_e[t]===n&&ve[t]===o){e.push(t);break}}}for(let t=0;t<16;t++){const e=new pe;e.set(me[t],ge[t],_e[t],ve[t],0,0),ye.push(e)}}();const Te={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=>me[t],uY:t=>ge[t],vX:t=>_e[t],vY:t=>ve[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>xe[t][e],sub:(t,e)=>xe[t][Te.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?Te.S:Te.N:2*Math.abs(e)<=Math.abs(t)?t>0?Te.E:Te.W:e>0?t>0?Te.SE:Te.SW:t>0?Te.NE:Te.NW,matrixAppendRotationInv:(t,e,i=0,r=0)=>{const s=ye[Te.inv(e)];s.tx=i,s.ty=r,t.append(s)}};class Ee{constructor(t,e,i=0,r=0){this._x=i,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new Ee(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}Ee.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Ae=class{constructor(){this.worldTransform=new pe,this.localTransform=new pe,this.position=new Ee(this.onChange,this,0,0),this.scale=new Ee(this.onChange,this,1,1),this.pivot=new Ee(this.onChange,this,0,0),this.skew=new Ee(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){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 i=t.
1worldTransform,r=this.worldTransform;r.a=e.a*i.a+e.b*i.c,r.b=e.a*i.b+e.b*i.d,r.c=e.c*i.a+e.d*i.c,r.d=e.c*i.b+e.d*i.d,r.tx=e.tx*i.a+e.ty*i.c+i.tx,r.ty=e.tx*i.b+e.ty*i.d+i.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())}};Ae.IDENTITY=new Ae;let Se=Ae;Se.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};function we(t,e,i){const r=t.createShader(e);return t.shaderSource(r,i),t.compileShader(r),r}function Ce(t){const e=new Array(t);for(let t=0;t<e.length;t++)e[t]=!1;return e}function Pe(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Ce(2*e);case"bvec3":return Ce(3*e);case"bvec4":return Ce(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Re=[{test: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                }`}],Ie={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    }"},Me={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 De={};let Fe,Be=De;function Le(){if(!Fe){Fe=v.MEDIUM;const t=function(){if(Be===De||Be?.isContextLost()){const t=T.ADAPTER.createCanvas();let e;T.PREFER_ENV>=r.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Be=e}return Be}();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);e&&(Fe=e.precision?v.HIGH:v.MEDIUM)}}return Fe}function Oe(t,e){const i=t.getShaderSource(e).split("\n").map(((t,e)=>`${e}: ${t}`)),r=t.getShaderInfoLog(e),s=r.split("\n"),n={},o=s.map((t=>
1parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1")))).filter((t=>!(!t||n[t])&&(n[t]=!0,!0))),a=[""];o.forEach((t=>{i[t-1]=`%c${i[t-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));const h=i.join("\n");a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}const Ne={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 ke(t){return Ne[t]}let Ue=null;const Ge={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 ze(t,e){if(!Ue){const e=Object.keys(Ge);Ue={};for(let i=0;i<e.length;++i){const r=e[i];Ue[t[r]]=Ge[r]}}return Ue[e]}function He(t,e,i){if("precision"!==t.substring(0,9)){let r=e;return e===v.HIGH&&i!==v.HIGH&&(r=v.MEDIUM),`precision ${r} float;\n${t}`}return i!==v.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}let Xe;let Ve=0;const je={},We=class t{constructor(e,i,r="pixi-shader",s={}){this.extra={},this.id=Ve++,this.vertexSrc=e||t.defaultVertexSrc,this.fragmentSrc=i||t.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,"#version"!==this.vertexSrc.substring(0,8)&&(r=r.replace(/\s+/g,"-"),je[r]?(je[r]++,r+=`-${je[r]}`):je[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}\n${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r}\n${this.fragmentSrc}`,this.vertexSrc=He(this.vertexSrc,t.defaultVertexPrecision,v.HIGH),this.fragmentSrc=He(this.fragmentSrc,t.defaultFragmentPrecision,Le())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n   vTextureCoord = aTextureCoord;\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"}static from(e,i,r){const s=e+i;let n=Et[s];return n||(Et[s]=n=new t(e,i,r)),n}};We.defaultVertexPrecision=v.HIGH,We.defaultFragmentPrecision=E.apple.device?v.HIGH:v.MEDIUM;let $e=We,Ye=0;class qe{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Ye++,this.static=!!e,this.ubo=!!i,t instanceof qt?(this.buffer=t,this.buffer.type=b.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new qt(new Float32Array(1)),this.buffer.type=b.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[t]=new qe(e,i)}static from(t,e,i){return new qe(t,e,i)}static uboFrom(t,e){return new qe(t,e??!0,!0)}}class Ke{constructor(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof qe?e:new qe(e):new qe({}),this.disposeRunner=new zt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const i in e.uniforms){const r=e.uniforms[i];if(!0===r.group&&this.checkUniformExists(t,r))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){const r=$e.from(t,e);return new Ke(r,i)}}class Ze{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const e=new Int32Array(t);for(let i=0;i<t;i++)e[i]=i;this.defaultGroupCache[t]=qe.from({uSamplers:e},!0);let i=this.fragTemplate;i=i.replace(/%count%/gi,`${t}`),i=i.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new $e(this.vertexSrc,i)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new pe,default:this.defaultGroupCache[t]};return new Ke(this.programCache[t],e)}generateSampleSrc(t){let e="";e+="\n",e+="\n";for(let i=0;i<t;i++)i>0&&(e+="\nelse "),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+="\n{",e+=`\n\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`,e+="\n}";return e+="\n",e+="\n",e}}class Qe{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}class Je{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}const ti=class t extends Je{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=ie,this.vertexSize=6,this.state=kt.for2d(),this.size=4*t.defaultBatchSize,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??function(t){let e=!0;const i=T.ADAPTER.getNavigator();if(E.tablet||E.phone){if(E.apple.device){const t=i.userAgent.match(/OS (\d+)_(\d+)?/);t&&parseInt(t[1],10)<11&&(e=!1)}if(E.android.device){const t=i.userAgent.match(/Android\s([0-9.]*)/);t&&parseInt(t[1],10)<7&&(e=!1)}}return e?t:4}(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??!E.apple.device,this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return S("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return"precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vTextureId = aTextureId;\n    vColor = aColor * tint;\n}\n"}static get defaultFragmentTemplate(){return"varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n    vec4 color;\n    %forloop%\n    gl_FragColor = color * vColor;\n}\n"}setShaderGenerator({vertex:e=t.defaultVertexSrc,fragment:i=t.defaultFragmentTemplate}={}){this.shaderGenerator=new Ze(e,i)}contextChange(){const e=this.renderer.gl;T.PREFER_ENV===r.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),t.defaultMaxTextures),this.maxTextures=function(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const i=e.createShader(e.FRAGMENT_SHADER);for(;;){const r=Ot.replace(/%forloop%/gi,Nt(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))break;t=t/2|0}return t}(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:e,_textureArrayPool:i}=t,r=this.size/4,s=Math.floor(r/this.maxTextures)+1;for(;e.length<r;)e.push(new $t);for(;i.length<s;)i.push(new Qe);for(let t=0;t<this.maxTextures;t++)this._tempBoundTextures[t]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:e,maxTextures:i}=this,r=t._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++Wt._globalBatch,h=0,l=r[0],u=0;s.copyBoundTextures(n,i);for(let t=0;t<this._bufferSize;++t){const c=e[t];e[t]=null,c._batchEnabled!==a&&(l.count>=i&&(s.boundArray(l,n,a,i),this.buildDrawCalls(l,u,t),u=t,l=r[++h],++a),c._batchEnabled=a,c.touched=o,l.elements[l.count++]=c)}l.count>0&&(s.boundArray(l,n,a,i),this.buildDrawCalls(l,u,this._bufferSize),++h,++a);for(let t=0;t<n.length;t++)n[t]=null;Wt._globalBatch=a}buildDrawCalls(e,i,r){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=t._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=e;for(let t=i;t<r;++t){const r=s[t],f=r._texture.baseTexture,p=ct[f.alphaMode?1:0][r.blendMode];s[t]=null,i<t&&d.blend!==p&&(d.size=c-d.start,i=t,d=h[++l],d.texArray=e,d.start=c),this.packInterleavedGeometry(r,n,o,u,c),u+=r.vertexData.length/2*a,c+=r.indices.length,d.blend=p}i<r&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:e,_attributeBuffer:i,_indexBuffer:r}=this;t.canUploadSameBuffer?(e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(i.rawBinaryData),e[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const e=this._dcIndex,{gl:i,state:r}=this.renderer,s=t._drawCallPool;let n=null;for(let t=0;t<e;t++){const{texArray:e,type:o,size:a,start:h,blend:l}=s[t];n!==e&&(n=e,this.bindAndClearTexArray(e)),this.state.blendMode=l,r.set(this.state),i.drawElements(o,a,i.UNSIGNED_SHORT,2*h)}}flush(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),t.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=pt(Math.ceil(t/8)),i=gt(e),r=8*e;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let s=this._aBuffers[r];return s||(this._aBuffers[r]=s=new Lt(r*this.vertexSize*4)),s}getIndexBuffer(t){const e=pt(Math.ceil(t/12)),i=gt(e),r=12*e;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let s=this._iBuffers[i];return s||(this._iBuffers[i]=s=new Uint16Array(r)),s}packInterleavedGeometry(t,e,i,r,s){const{uint32View:n,float32View:o}=e,a=r/this.vertexSize,h=t.uvs,l=t.indices,u=t.vertexData,c=t._texture.baseTexture._batchLocation,d=Math.min(t.worldAlpha,1),f=ot.shared.setValue(t._tintRGB).toPremultiplied(d,t._texture.baseTexture.alphaMode>0);for(let t=0;t<u.length;t+=2)o[r++]=u[t],o[r++]=u[t+1],o[r++]=h[t],o[r++]=h[t+1],n[r++]=f,o[r++]=c;for(let t=0;t<l.length;t++)i[s++]=a+l[t]}};ti.defaultBatchSize=4096,ti.extension={name:"batch",type:Mt.RendererPlugin},ti._drawCallPool=[],ti._textureArrayPool=[];let ei=ti;Bt.add(ei);const ii=class t extends Ke{constructor(e,i,r){super($e.from(e||t.defaultVertexSrc,i||t.defaultFragmentSrc),r),this.padding=0,this.resolution=t.defaultResolution,this.multisample=t.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new kt}apply(t,e,i,r,s){t.applyFilter(this,e,i,r)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return"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;
1\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"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"}};ii.defaultResolution=1,ii.defaultMultisample=y.NONE;let ri=ii;class si{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ot(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:r}=t,s=i??e;void 0!==s&&(this.color=s),this.alpha=r}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}si.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},si.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"background"},Bt.add(si);class ni{constructor(t){this.renderer=t,this.emptyRenderer=new Je(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:i}=this.renderer.texture;for(let r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,i,r){const{elements:s,ids:n,count:o}=t;let a=0;for(let t=0;t<o;t++){const o=s[t],h=o._batchLocation;if(h>=0&&h<r&&e[h]===o)n[t]=h;else for(;a<r;){const r=e[a];if(!r||r._batchEnabled!==i||r._batchLocation!==a){n[t]=a,o._batchLocation=a,e[a]=o;break}a++}}}destroy(){this.renderer=null}}ni.extension={type:Mt.RendererSystem,name:"batch"},Bt.add(ni);let oi=0;class ai{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=oi++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=oi++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;void 0!==e.addEventListener&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(T.PREFER_ENV>=r.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}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"),bptc:t.getExtension("EXT_texture_compression_bptc")};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(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ai.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ai.extension={type:Mt.RendererSystem,name:"context"},Bt.add(ai);class hi{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new zt("disposeFramebuffer"),this.multisample=y.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new Wt(null,{scaleMode:d.NEAREST,resolution:1,mipmap:p.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new Wt(null,{scaleMode:d.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:p.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||!e)throw new Error("Framebuffer width and height must not be zero");if(t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const r=this.colorTextures[i],s=r.resolution;r.setSize(t/s,e/s)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class li extends Wt{constructor(t={}){if("number"==typeof t){t={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=y.NONE),super(null,t),this.mipmap=p.OFF,this.valid=!0,this._clear=new ot([0,0,0,0]),this.framebuffer=new hi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.he
1ight)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class ui extends Ht{constructor(t){const e=t;super(e.naturalWidth||e.videoWidth||e.displayWidth||e.width,e.naturalHeight||e.videoHeight||e.displayHeight||e.height),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){void 0!==i||e.startsWith("data:")?!1!==i&&(t.crossOrigin="string"==typeof i?i:"anonymous"):t.crossOrigin=function(t,e=globalThis.location){if(t.startsWith("data:"))return"";e=e||globalThis.location;const i=new URL(t,document.baseURI);return i.hostname!==e.hostname||i.port!==e.port||i.protocol!==e.protocol?"anonymous":""}(e)}upload(t,e,i,r){const s=t.gl,n=e.realWidth,o=e.realHeight;if(r=r||this.source,typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement){if(!r.complete||0===r.naturalWidth)return!1}else if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===m.UNPACK),this.noSubImage||e.target!==s.TEXTURE_2D||i.width!==n||i.height!==o?(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)):s.texSubImage2D(s.TEXTURE_2D,0,0,0,e.format,i.type,r),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class ci extends ui{constructor(t,e){if(e=e||{},"string"==typeof t){const i=new Image;ui.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??T.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.bitmap=null,this._load=null,!1!==e.autoLoad&&this.load()}load(t){return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise(((t,e)=>{const i=this.source;this.url=i.src;const r=()=>{this.destroyed||(i.onload=null,i.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};i.complete&&i.src?r():(i.onload=r,i.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,i=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then((t=>t.blob())).then((i=>e(i,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,i){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let t=!0;const r=e._glTextures;for(const s in r){const n=r[s];if(n!==i&&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 typeof HTMLImageElement<"u"&&("string"==typeof t||t instanceof HTMLImageElement)}}class di{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,i){const r=e.width,s=e.height;if(i){const e=t.width/2/r,n=t.height/2/s,o=t.x/r+e,a=t.y/s+n;i=Te.add(i,Te.NW),this.x0=o+e*Te.uX(i),this.y0=a+n*Te.uY(i),i=Te.add(i,2),this.x1=o+e*Te.uX(i),this.y1=a+n*Te.uY(i),i=Te.add(i,2),this.x2=o+e*Te.uX(i),this.y2=a+n*Te.uY(i),i=Te.add(i,2),this.x3=o+e*Te.uX(i),this.y3=a+n*Te.uY(i)}else this.x0=t.x/r,this.y0=t.y/s,this.x1=(t.x+t.width)/r,this.y1=t.y/s,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/s,this.x3=t.x/r,this.y3=(t.y+t.height)/s;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}di.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const fi=new di;function pi(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}class mi extends t{constructor(t,e,i,r,s,n,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new le(0,0,1,1)),t instanceof mi&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=fi,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(s||0),!0===s)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 ae(n.x,n.y):new ae(0,0),this.defaultBorders=o,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(
1)}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;t?.url&&At[t.url]&&mi.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,mi.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new mi(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===fi&&(this._uvs=new di),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=T.STRICT_TEXTURE_CACHE){const r="string"==typeof t;let s=null;if(r)s=t;else if(t instanceof Wt){if(!t.cacheId){const i=e?.pixiIdPrefix||"pixiid";t.cacheId=`${i}-${yt()}`,Wt.addToCache(t,t.cacheId)}s=t.cacheId}else{if(!t._pixiId){const i=e?.pixiIdPrefix||"pixiid";t._pixiId=`${i}_${yt()}`}s=t._pixiId}let n=At[s];if(r&&i&&!n)throw new Error(`The cacheId "${s}" does not exist in TextureCache.`);return n||t instanceof Wt?!n&&t instanceof Wt&&(n=new mi(t),mi.addToCache(n,s)):(e.resolution||(e.resolution=It(t)),n=new mi(new Wt(t,e)),n.baseTexture.cacheId=s,Wt.addToCache(n.baseTexture,s),mi.addToCache(n,s)),n}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e?.resourceOptions),r=mi.from(t,Object.assign({resourceOptions:i},e),!1),s=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):s.load().then((()=>Promise.resolve(r)))}static fromBuffer(t,e,i,r){return new mi(Wt.fromBuffer(t,e,i,r))}static fromLoader(t,e,i,r){const s=new Wt(t,Object.assign({scaleMode:Wt.defaultOptions.scaleMode,resolution:It(e)},r)),{resource:n}=s;n instanceof ci&&(n.url=e);const o=new mi(s);return i||(i=e),Wt.addToCache(o.baseTexture,i),mi.addToCache(o,i),i!==e&&(Wt.addToCache(o.baseTexture,e),mi.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise((t=>{o.baseTexture.once("loaded",(()=>t(o)))}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),At[e]&&At[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),At[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=At[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete At[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)At[t.textureCacheIds[e]]===t&&delete At[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:i,width:r,height:s}=t,n=e+r>this.baseTexture.width,o=i+s>this.baseTexture.height;if(n||o){const t=n&&o?"and":"or",a=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,h=`Y: ${i} + ${s} = ${i+s} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${a} ${t} ${h}`)}this.valid=r&&s&&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 mi._EMPTY||(mi._EMPTY=new mi(new Wt),pi(mi._EMPTY),pi(mi._EMPTY.baseTexture)),mi._EMPTY}static get WHITE(){if(!mi._WHITE){const t=T.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),mi._WHITE=new mi(Wt.from(t)),pi(mi._WHITE),pi(mi._WHITE.baseTexture)}return mi._WHITE}}class gi extends mi{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,i=!0){const r=this.baseTexture.resolution,s=Math.round(t*r)/r,n=Math.round(e*r)/r;this.valid=s>0&&n>0,this._frame.width=this.orig.width=s,this._frame.height=this.orig.height=n,i&&this.baseTexture.resize(s,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 gi(new li(t))}}class _i{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=y.NONE){const r=new li(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new gi(r)}getOptimalTexture(t,e,i=1,r=y.NONE){let s;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?s=r>1?-r:-1:(s=((65535&(t=pt(t)))<<16|65535&(e=pt(e)))>>>0,r>1&&(s+=4294967296*r)),this.texturePool[s]||(this.texturePool[s]=[]);let n=this.texturePool[s].pop();return n||(n=this.createTexture(t,e,r)),n.filterPoolKey=s,n.setResolution(i),n}getFilterTexture(t,e,i){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||y.NONE);return r.filterFrame=t.filterFrame,r}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;t<e.length;t++)e[t].destroy(!0)}this.texturePool={}}setScreenSize(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){this.enableFullScreen=t.width>0&&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;t<e.length;t++)e[t].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}_i.SCREEN_KEY=-1;class vi extends ee{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class xi extends ee{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new qt(this.vertices),this.uvBuffer=new qt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class yi{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=y.NONE,this.sourceFrame=new le,this.destinationFrame=new le,this.bindingSourceFrame=new le,this.bindingDestinationFrame=new le,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const bi=[new ae,new ae,new ae,new ae],Ti=new pe;class Ei{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new _i,this.statePool=[],this.quad=new vi,this.quadUv=new xi,this.tempRect=new le,this.activeState={},this.globalUniforms=new qe({outputFrame:new le,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}
1init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const i=this.renderer,r=this.defaultFilterStack,s=this.statePool.pop()||new yi,n=i.renderTexture;let o,a;if(n.current){const t=n.current;o=t.resolution,a=t.multisample}else o=i.resolution,a=i.multisample;let h=e[0].resolution||o,l=e[0].multisample??a,u=e[0].padding,c=e[0].autoFit,d=e[0].legacy??!0;for(let t=1;t<e.length;t++){const i=e[t];h=Math.min(h,i.resolution||o),l=Math.min(l,i.multisample??a),u=this.useMaxPadding?Math.max(u,i.padding):u+i.padding,c=c&&i.autoFit,d=d||(i.legacy??!0)}1===r.length&&(this.defaultFilterStack[0].renderTexture=n.current),r.push(s),s.resolution=h,s.multisample=l,s.legacy=d,s.target=t,s.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),s.sourceFrame.pad(u);const f=this.tempRect.copyFrom(n.sourceFrame);i.projection.transform&&this.transformAABB(Ti.copyFrom(i.projection.transform).invert(),f),c?(s.sourceFrame.fit(f),(s.sourceFrame.width<=0||s.sourceFrame.height<=0)&&(s.sourceFrame.width=0,s.sourceFrame.height=0)):s.sourceFrame.intersects(f)||(s.sourceFrame.width=0,s.sourceFrame.height=0),this.roundFrame(s.sourceFrame,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),s.renderTexture=this.getOptimalFilterTexture(s.sourceFrame.width,s.sourceFrame.height,h,l),s.filters=e,s.destinationFrame.width=s.renderTexture.width,s.destinationFrame.height=s.renderTexture.height;const p=this.tempRect;p.x=0,p.y=0,p.width=s.sourceFrame.width,p.height=s.sourceFrame.height,s.renderTexture.filterFrame=s.sourceFrame,s.bindingSourceFrame.copyFrom(n.sourceFrame),s.bindingDestinationFrame.copyFrom(n.destinationFrame),s.transform=i.projection.transform,i.projection.transform=null,n.bind(s.renderTexture,s.sourceFrame,p),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;const s=r.inputSize,n=r.inputPixel,o=r.inputClamp;if(s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],n[0]=Math.round(s[0]*e.resolution),n[1]=Math.round(s[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],o[0]=.5*n[2],o[1]=.5*n[3],o[2]=e.sourceFrame.width*s[2]-.5*n[2],o[3]=e.sourceFrame.height*s[3]-.5*n[3],e.legacy){const t=r.filterArea;t[0]=e.destinationFrame.width,t[1]=e.destinationFrame.height,t[2]=e.sourceFrame.x,t[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();const a=t[t.length-1];if(this.renderer.framebuffer.blit(),1===i.length)i[0].apply(this,e.renderTexture,a.renderTexture,g.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let t=e.renderTexture,r=this.getOptimalFilterTexture(t.width,t.height,e.resolution);r.filterFrame=t.filterFrame;let s=0;for(s=0;s<i.length-1;++s){1===s&&e.multisample>1&&(r=this.getOptimalFilterTexture(t.width,t.height,e.resolution),r.filterFrame=t.filterFrame),i[s].apply(this,t,r,g.CLEAR,e);const n=t;t=r,r=n}i[s].apply(this,t,a.renderTexture,g.BLEND,e),s>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(t),this.returnFilterTexture(r)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=g.CLEAR){const{renderTexture:i,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){const e=this.tempRect;e.x=0,e.y=0,e.width=t.filterFrame.width,e.height=t.filterFrame.height,i.bind(t,t.filterFrame,e)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const s=1&r.stateId||this.forceClear;(e===g.CLEAR||e===g.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,r){const s=this.renderer;s.state.set(t.state),this.bindAndClear(i,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(a.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(a.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:r}=this.activeState,{orig:s}=e._texture,n=t.set(r.width,0,0,r.height,i.x,i.y),o=e.worldTransform.copyTo(pe.TEMP_MATRIX);return o.invert(),n.prepend(o),n.scale(1/s.width,1/s.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,r=y.NONE){return this.texturePool.getOptimalTexture(t,e,i,r)}getFilterTexture(t,e,i){if("number"==typeof t){const i=t;t=e,e=i}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||y.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}
1resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=bi[0],r=bi[1],s=bi[2],n=bi[3];i.set(e.left,e.top),r.set(e.left,e.bottom),s.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(i,i),t.apply(r,r),t.apply(s,s),t.apply(n,n);const o=Math.min(i.x,r.x,s.x,n.x),a=Math.min(i.y,r.y,s.y,n.y),h=Math.max(i.x,r.x,s.x,n.x),l=Math.max(i.y,r.y,s.y,n.y);e.x=o,e.y=a,e.width=h-o,e.height=l-a}roundFrame(t,e,i,r,s){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(s){const{a:t,b:e,c:i,d:r}=s;if((Math.abs(e)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(r)>1e-4))return}(s=s?Ti.copyFrom(s):Ti.identity()).translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}}}Ei.extension={type:Mt.RendererSystem,name:"filter"},Bt.add(Ei);class Ai{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=y.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Si=new le;class wi{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new hi(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 le,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;T.PREFER_ENV===r.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:r}=this;if(t){const s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=i),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let e=0;e<t.colorTextures.length;e++){const i=t.colorTextures[e];this.renderer.texture.unbind(i.parentTextureArray||i)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const t=e.width>>i,r=e.height>>i,s=t/e.width;this.setViewport(e.x*s,e.y*s,t,r)}else{const e=t.width>>i,r=t.height>>i;this.setViewport(0,0,e,r)}}else this.current&&(this.current=null,r.bindFramebuffer(r.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,i,r){const s=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),(s.width!==i||s.height!==r||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=i,s.height=r,this.gl.viewport(t,e,i,r))}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,i,r,s=n.COLOR|n.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,r),o.clear(s)}initFramebuffer(t){const{gl:e}=this,i=new Ai(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){let r;e.bindRenderbuffer(e.RENDERBUFFER,i.stencil),r=1===this.renderer.context.webGLVersion?e.DEPTH_STENCIL:t.depth&&t.stencil?e.DEPTH24_STENCIL8:t.depth?e.DEPTH_COMPONENT24:e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,r,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,r,t.width,t.height)}const r=t.colorTextures;let s=r.length;e.drawBuffers||(s=Math.min(s,1));for(let n=0;n<s;n++){const s=r[n],o=s.parentTextureArray||s;this.renderer.texture.bind(o,0),0===n&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:i}=this,r=t.glFramebuffers[this.CONTEXT_UID],s=t.colorTextures;let n=s.length;i.drawBuffers||(n=Math.min(n,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer():r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let a=0;a<n;a++){const n=s[a],h=n.parentTextureArray||n;this.renderer.texture.bind(h,0),0===a&&r.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,n.target,h._glTextures[this.CONTEXT_UID].texture,e),o.push(i.COLOR_ATTACHMENT0+a))}if(o.length>1&&i.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const r=t.depthTexture;this.renderer.texture.bind(r,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,r._glTextures[this.CONTEXT_UID].texture,e)}if(!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture)r.stencil&&(i.deleteRenderbuffer(r.stencil),r.stencil=null);else{let e,s;r.stencil=r.stencil||i.createRenderbuffer(),1===this.renderer.context.webGLVersion?(e=i.DEPTH_STENCIL_ATTACHMENT,s=i.DEPTH_STENCIL):t.depth&&t.stencil?(e=i.DEPTH_STENCIL_ATTACHMENT,s=i.DEPTH24_STENCIL8):t.depth?(e=i.DEPTH_ATTACHMENT,s=i.DEPTH_COMPONENT24):(e=i.STENCIL_ATTACHMENT,s=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,s,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,s,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,e,i.RENDERBUFFER,r.stencil)}}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=y.NONE;if(t<=1||null===e)return i;for(let r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return 1===i&&(i=y.NONE),i}blit(t,e,i){const{current:r,renderer:s,gl:n,CONTEXT_UID:o}=this;if(2!==s.context.webGLVersion||!r)return;const a=r.glFramebuffers[o];if(!a)return;if(!t){if(!a.msaaBuffer)return;const e=r.colorTextures[0];if(!e)return;a.blitFramebuffer||(a.blitFramebuffer=new hi(r.width,r.height),a.blitFramebuffer.addColorTexture(0,e)),(t=a.blitFramebuffer).colorTextures[0]!==e&&(t.colorTextures[0]=e,t.dirtyId++,t.dirtyFormat++),(t.width!==r.width||t.height!==r.height)&&(t.width=r.width,t.height=r.height,t.dirtyId++,t.dirtySize++)}e||((e=Si).width=r.width,e.height=r.height),i||(i=e);const h=e.width===i.width&&e.height===i.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,a.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,n.COLOR_BUFFER_BIT,h?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];const s=this.managedFramebuffers.indexOf(t);s>
1=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const i=t.width,r=t.height,s=this.gl,n=e.stencil=s.createRenderbuffer();let o,a;s.bindRenderbuffer(s.RENDERBUFFER,n),1===this.renderer.context.webGLVersion?(o=s.DEPTH_STENCIL_ATTACHMENT,a=s.DEPTH_STENCIL):t.depth?(o=s.DEPTH_STENCIL_ATTACHMENT,a=s.DEPTH24_STENCIL8):(o=s.STENCIL_ATTACHMENT,a=s.STENCIL_INDEX8),e.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,e.multisample,a,i,r):s.renderbufferStorage(s.RENDERBUFFER,a,i,r),s.framebufferRenderbuffer(s.FRAMEBUFFER,o,s.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new le}destroy(){this.renderer=null}}wi.extension={type:Mt.RendererSystem,name:"framebuffer"},Bt.add(wi);const Ci={5126:4,5123:2,5121:1};class Pi{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){let e=this.renderer.context.extensions.vertexArrayObject;T.PREFER_ENV===r.WEBGL_LEGACY&&(e=null),e?(t.createVertexArray=()=>e.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,i)=>e.vertexAttribDivisorANGLE(t,i),t.drawElementsInstanced=(t,i,r,s,n)=>e.drawElementsInstancedANGLE(t,i,r,s,n),t.drawArraysInstanced=(t,i,r,s)=>e.drawArraysInstancedANGLE(t,i,r,s)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},s=!0);const n=r[e.program.id]||this.initGeometryVao(t,e,s);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?i.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const r=t.buffers[i];e.update(r)}}checkCompatibility(t,e){const i=t.attributes,r=e.attributeData;for(const t in r)if(!i[t])throw new Error(`shader and geometry incompatible, geometry missing the "${t}" attribute`)}getSignature(t,e){const i=t.attributes,r=e.attributeData,s=["g",t.id];for(const t in i)r[t]&&s.push(t,r[t].location);return s.join("-")}initGeometryVao(t,e,i=!0){const r=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=e.program;o.glPrograms[s]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);const a=this.getSignature(t,o),h=t.glVertexArrayObjects[this.CONTEXT_UID];let l=h[a];if(l)return h[o.id]=l,l;const u=t.buffers,c=t.attributes,d={},f={};for(const t in u)d[t]=0,f[t]=0;for(const t in c)!c[t].size&&o.attributeData[t]?c[t].size=o.attributeData[t].size:c[t].size||console.warn(`PIXI Geometry attribute '${t}' size cannot be determined (likely the bound shader does not have the attribute)`),d[c[t].buffer]+=c[t].size*Ci[c[t].type];for(const t in c){const e=c[t],i=e.size;void 0===e.stride&&(d[e.buffer]===i*Ci[e.type]?e.stride=0:e.stride=d[e.buffer]),void 0===e.start&&(e.start=f[e.buffer],f[e.buffer]+=i*Ci[e.type])}l=r.createVertexArray(),r.bindVertexArray(l);for(let t=0;t<u.length;t++){const e=u[t];n.bind(e),i&&e._glBuffers[s].refCount++}return this.activateVao(t,o),h[o.id]=l,h[a]=l,r.bindVertexArray(null),n.unbind(b.ARRAY_BUFFER),l}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,s=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),i){if(n)for(let t=0;t<s.length;t++){const i=s[t]._glBuffers[this.CONTEXT_UID];i&&(i.refCount--,0===i.refCount&&!e&&n.dispose(s[t],e))}if(!e)for(const t in i)if("g"===t[0]){const e=i[t];this._activeVao===e&&this.unbind(),r.deleteVertexArray(e)}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,r=this.CONTEXT_UID,s=this.renderer.buffer,n=t.buffers,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let a=null;for(const t in o){const h=o[t],l=n[h.buffer],u=l._glBuffers[r];if(e.attributeData[t]){a!==u&&(s.bind(l),a=u);const r=e.attributeData[t].location;if(i.enableVertexAttribArray(r),i.vertexAttribPointer(r,h.size,h.type||i.FLOAT,h.normalized,h.stride,h.start),h.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");i.vertexAttribDivisor(r,h.divisor)}}}}draw(t,e,i,r){const{gl:s}=this,n=this._activeGeometry;if(n.indexBuffer){const o=n.indexBuffer.data.BYTES_PER_ELEMENT,a=2===o?s.UNSIGNED_SHORT:s.UNSIGNED_INT;2===o||4===o&&this.canUseUInt32ElementIndex?n.instanced?s.drawElementsInstanced(t,e||n.indexBuffer.data.length,a,(i||0)*o,r||1):s.drawElements(t,e||n.indexBuffer.data.length,a,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else n.instanced?s.drawArraysInstanced(t,i,e||n.getSize(),r||1):s.drawArrays(t,i,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Pi.extension={type:Mt.RendererSystem,name:"geometry"},Bt.add(Pi);const Ri=new pe;class Ii{constructor(t,e){this._texture=t,this.mapCoord=new pe,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){void 0===e&&(e=t);const i=this.mapCoord;for(let r=0;r<t.length;r+=2){const s=t[r],n=t[r+1];e[r]=s*i.a+n*i.c+i.tx,e[r+1]=s*i.b+n*i.d+i.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const r=e.orig,s=e.trim;s&&(Ri.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Ri));const n=e.baseTexture,o=this.uClampFrame,a=this.clampMargin/n.resolution,h=this.clampOffset;return o[0]=(e._frame.x+a+h)/n.width,o[1]=(e._frame.y+a+h)/n.height,o[2]=(e._frame.x+e._frame.width-a+h)/n.width,o[3]=(e._frame.y+e._frame.height-a+h)/n.height,this.uClampOffset[0]=h/n.realWidth,this.uClampOffset[1]=h/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&0===e.rotate,!0}}class Mi extends ri{constructor(t,e,i){let r=null;"string"!=typeof t&&void 0===e&&void 0===i&&(r=t,t=void 0,e=void 0,i=void 0),super(t||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0)  ).xy;\n}\n",e||"varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n    float clip = step(3.5,\n        step(maskClamp.x, vMaskCoord.x) +\n        step(maskClamp.y, vMaskCoord.y) +\n        step(vMaskCoord.x, maskClamp.z) +\n        step(vMaskCoord.y, maskClamp.w));\n\n    vec4 original = texture2D(uSampler, vTextureCoord);\n    vec4 masky = texture2D(mask, vMaskCoord);\n    float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n    original *= (alphaMul * masky.r * alpha * clip);\n\n    gl_FragColor = original;\n}\n",i),this.maskSprite=r,this.maskMatrix=new pe}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,r){const s=this._maskSprite,n=s._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Ii(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,s).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=s.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,i,r))}}class Di{constructor(t=null){this.type=x.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ri.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=x.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class Fi{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){const t=this.maskDataPool.pop()||new Di;t.pooled=!0,t.maskObject=e,i=t}const r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(r),i._colorMask=r?r._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==x.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case x.SCISSOR:this.renderer.scissor.push(i);break;case x.STENCIL:this.renderer.stencil.push(i);break;case x.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case x.COLOR:this.pushColorMask(i)}i.type===x.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(e&&e._target===t){if(e.enabled)switch(e.type){case x.SCISSOR:this.renderer.scissor.pop(e);break;case x.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case x.SPRITE:this.popSpriteMask(e);break;case x.COLOR:this.popColorMask(e)}if(e.reset(),e.pooled&&this.maskDataPool.push(e),0!==this.maskStack.length){const t=this.maskStack[this.maskStack.length-1];t.type===x.SPRITE&&t._filters&&(t._filters[0].maskSprite=t.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=x.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=x.SCISSOR:t.type=x.STENCIL:t.type=x.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new Mi])),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;const s=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,r),i.filterArea=s,t._filters||this.alphaMaskIndex++}
1popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))}destroy(){this.renderer=null}}Fi.extension={type:Mt.RendererSystem,name:"mask"},Bt.add(Fi);class Bi{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==i&&(0===r?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Li=new pe,Oi=[],Ni=class t extends Bi{constructor(t){super(t),this.glConst=T.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:r}=this,s=r.renderTexture,n=i.getBounds(!0,Oi.pop()??new le);this.roundFrameToPixels(n,s.current?s.current.resolution:r.resolution,s.sourceFrame,s.destinationFrame,r.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:r,d:s}=t;return(Math.abs(i)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(s)>1e-4)}testScissor(e){const{maskObject:i}=e;if(!i.isFastRect||!i.isFastRect()||t.isMatrixRotated(i.worldTransform)||t.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const r=e._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(e,i,r,s,n){t.isMatrixRotated(n)||((n=n?Li.copyFrom(n):Li.identity()).translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,e),e.fit(s),e.x=Math.round(e.x*i),e.y=Math.round(e.y*i),e.width=Math.round(e.width*i),e.height=Math.round(e.height*i))}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&&Oi.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)}};Ni.extension={type:Mt.RendererSystem,name:"scissor"};let ki=Ni;Bt.add(ki);class Ui extends Bi{constructor(t){super(t),this.glConst=T.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:i}=this.renderer,r=t._stencilCounter;0===r&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const s=t._colorMask;0!==s&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==s&&(t._colorMask=s,i.colorMask(0!=(1&s),0!=(2&s),0!=(4&s),0!=(8&s))),this._useCurrent()}pop(t){const e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{const i=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,r=i?i._colorMask:15;0!==r&&(i._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!==r&&(i._colorMask=r,e.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;
1t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Ui.extension={type:Mt.RendererSystem,name:"stencil"},Bt.add(Ui);class Gi{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get:()=>(S("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract)},prepare:{enumerable:!1,get:()=>(S("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare)},interaction:{enumerable:!1,get:()=>(S("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}}Gi.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"_plugin"},Bt.add(Gi);class zi{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new pe,this.transform=null}update(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,r),this.transform&&this.projectionMatrix.append(this.transform);const s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)}calculateProjection(t,e,i,r){const s=this.projectionMatrix,n=r?-1:1;s.identity(),s.a=1/e.width*2,s.d=n*(1/e.height*2),s.tx=-1-e.x*s.a,s.ty=-n-e.y*s.d}setTransform(t){}destroy(){this.renderer=null}}zi.extension={type:Mt.RendererSystem,name:"projection"},Bt.add(zi);const Hi=new Se,Xi=new le;class Vi{constructor(t){this.renderer=t,this._tempMatrix=new pe}generateTexture(t,e){const{region:i,...r}=e||{},s=i?.copyTo(Xi)||t.getLocalBounds(Xi,!0),n=r.resolution||this.renderer.resolution;s.width=Math.max(s.width,1/n),s.height=Math.max(s.height,1/n),r.width=s.width,r.height=s.height,r.resolution=n,r.multisample??(r.multisample=this.renderer.multisample);const o=gi.create(r);this._tempMatrix.tx=-s.x,this._tempMatrix.ty=-s.y;const a=t.transform;return t.transform=Hi,this.renderer.render(t,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=a,o}destroy(){}}Vi.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"textureGenerator"},Bt.add(Vi);const ji=new le,Wi=new le;class $i{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new le,this.destinationFrame=new le,this.viewportFrame=new le}contextChange(){const t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const r=this.renderer;let s,n,o;this.current=t,t?(s=t.baseTexture,o=s.resolution,e||(ji.width=t.frame.width,ji.height=t.frame.height,e=ji),i||(Wi.x=t.frame.x,Wi.y=t.frame.y,Wi.width=e.width,Wi.height=e.height,i=Wi),n=s.framebuffer):(o=r.resolution,e||(ji.width=r._view.screen.width,ji.height=r._view.screen.height,e=ji),i||((i=ji).width=e.width,i.height=e.height));const a=this.viewportFrame;a.x=i.x*o,a.y=i.y*o,a.width=i.width*o,a.height=i.height*o,t||(a.y=r.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(i,e,o,!n),t?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=ot.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const s=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,o=s.width!==n.width||s.height!==n.height;if(o){let{x:t,y:e,width:i,height:r}=this.viewportFrame;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(t,e,i,r)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}$i.extension={type:Mt.RendererSystem,name:"renderTexture"},Bt.add($i);class Yi{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 qi(t,e){const i=we(t,t.VERTEX_SHADER,e.vertexSrc),r=we(t,t.FRAGMENT_SHADER,e.fragmentSrc),s=t.createProgram();t.attachShader(s,i),t.attachShader(s,r);const n=e.extra?.transformFeedbackVaryings;if(n&&("function"!=typeof t.transformFeedbackVaryings?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(s,n.names,"separate"===n.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||function(t,e,
1i,r){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(i,t.COMPILE_STATUS)||Oe(t,i),t.getShaderParameter(r,t.COMPILE_STATUS)||Oe(t,r),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,s,i,r),e.attributeData=function(t,e){const i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){const r=e.getActiveAttrib(t,s);if(r.name.startsWith("gl_"))continue;const n=ze(e,r.type),o={type:n,name:r.name,size:ke(n),location:e.getAttribLocation(t,r.name)};i[r.name]=o}return i}(s,t),e.uniformData=function(t,e){const i={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){const r=e.getActiveUniform(t,s),n=r.name.replace(/\[.*?\]$/,""),o=!!r.name.match(/\[.*?\]$/),a=ze(e,r.type);i[n]={name:n,index:s,type:a,size:r.size,isArray:o,value:Pe(a,r.size)}}return i}(s,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const i=Object.keys(e.attributeData);i.sort(((t,e)=>t>e?1:-1));for(let r=0;r<i.length;r++)e.attributeData[i[r]].location=r,t.bindAttribLocation(s,r,i[r]);t.linkProgram(s)}t.deleteShader(i),t.deleteShader(r);const o={};for(const i in e.uniformData){const r=e.uniformData[i];o[i]={location:t.getUniformLocation(s,i),value:Pe(r.type,r.size)}}return new Yi(s,o)}function Ki(t,e,i,r,s){i.buffer.update(s)}const Zi={float:"\n        data[offset] = v;\n    ",vec2:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n    ",vec3:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n\n    ",vec4:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n        data[offset+3] = v[3];\n    ",mat2:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n\n        data[offset+4] = v[2];\n        data[offset+5] = v[3];\n    ",mat3:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n\n        data[offset + 4] = v[3];\n        data[offset + 5] = v[4];\n        data[offset + 6] = v[5];\n\n        data[offset + 8] = v[6];\n        data[offset + 9] = v[7];\n        data[offset + 10] = v[8];\n    ",mat4:"\n        for(var i = 0; i < 16; i++)\n        {\n            data[offset + i] = v[i];\n        }\n    "},Qi={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function Ji(t,e){if(!t.autoManage)return{size:0,syncFunc:Ki};const i=function(t,e){const i=[];for(const r in t)e[r]&&i.push(e[r]);return i.sort(((t,e)=>t.index-e.index)),i}(t.uniforms,e),{uboElements:r,size:s}=function(t){const e=t.map((t=>({data:t,offset:0,dataLen:0,dirty:0})));let i=0,r=0,s=0;for(let t=0;t<e.length;t++){const n=e[t];if(i=Qi[n.data.type],n.data.size>1&&(i=Math.max(i,16)*n.data.size),n.dataLen=i,r%i!=0&&r<16){const t=r%i%16;r+=t,s+=t}r+i>16?(s=16*Math.ceil(s/16),n.offset=s,s+=i,r=i):(n.offset=s,r+=i,s+=i)}return s=16*Math.ceil(s/16),{uboElements:e,size:s}}(i),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;e<r.length;e++){const i=r[e],s=t.uniforms[i.data.name],o=i.data.name;let a=!1;for(let t=0;t<Re.length;t++){const e=Re[t];if(e.codeUbo&&e.test(i.data,s)){n.push(`offset = ${i.offset/4};`,Re[t].codeUbo(i.data.name,s)),a=!0;break}}if(!a)if(i.data.size>1){const t=ke(i.data.type),e=Math.max(Qi[i.data.type]/16,1),r=t/e,s=(4-r%4)%4;n.push(`\n                cv = ud.${o}.value;\n                v = uv.${o};\n                offset = ${i.offset/4};\n\n                t = 0;\n\n                for(var i=0; i < ${i.data.size*e}; i++)\n                {\n                    for(var j = 0; j < ${r}; j++)\n                    {\n                        data[offset++] = v[t++];\n                    }\n                    offset += ${s};\n                }\n\n                `)}else{const t=Zi[i.data.type];n.push(`\n                cv = ud.${o}.value;\n                v = uv.${o};\n                offset = ${i.offset/4};\n                ${t};\n                `)}}return n.push("\n       renderer.buffer.update(buffer);\n    "),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join("\n"))}}let tr=0;const er={textureCount:0,uboCount:0};class ir{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=tr++}systemCheck(){if(!function(){if("boolean"==typeof Xe)return Xe;try{Xe=!0===new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")}catch{Xe=!1}return Xe}())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 i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(er.textureCount=0,er.uboCount=0,this.syncUniformGroup(t.uniformGroup,er)),r}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){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 s=e[r];if(!s){!0===t.uniforms[r]?.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 n=t.uniforms[r];let o=!1;for(let t=0;t<Re.length;t++)if(Re[t].test(s,n)){i.push(Re[t].code(r,n)),o=!0;break}if(!o){const t=(1!==s.size||s.isArray?Me:Ie)[s.type].replace("location",`ud["${r}"].location`);i.push(`\n            cu = ud["${r}"];\n            cv = cu.value;\n            v = uv["${r}"];\n            ${t};`)}}return new Function("ud","uv","renderer","syncData",i.join("\n"))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||0!==t.dirtyId||!i.uniformGroups[t.id]){t.dirtyId=0;const r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);
vendor: 4,479 bytes, line 1
1t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,er,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const s=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,s,this.shader.uniformBindCount),this.shader.uniformBindCount++;const n=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[n];if(o||(o=this._uboCache[n]=Ji(t,this.shader.program.uniformData)),t.autoManage){const e=new Float32Array(o.size/4);t.buffer.update(e)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const r=t.uniforms,s=[`${i}-`];for(const t in r)s.push(t),e[t]&&s.push(e[t].type);return s.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,r=qi(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}ir.extension={type:Mt.RendererSystem,name:"shader"},Bt.add(ir);class rr{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.0 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}rr.defaultOptions={hello:!1},rr.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"startup"},Bt.add(rr);const sr=class t{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=o.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new kt,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=function(t,e=[]){return e[o.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.ADD]=[t.ONE,t.ONE],e[o.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.NONE]=[0,0],e[o.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[o.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[o.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[o.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[o.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[o.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[o.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[o.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[o.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[o.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[o.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)1&e&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(e){this.updateCheck(t.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(t.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],i=this.gl;
12===e.length?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&-1===i?this.checks.push(t):!e&&-1!==i&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};sr.extension={type:Mt.RendererSystem,name:"state"};let nr=sr;Bt.add(nr);class or extends t{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter((e=>t.systems[e])),i=[...e,...Object.keys(t.systems).filter((t=>!e.includes(t)))];for(const e of i)this.addSystem(t.systems[e],e)}addRunners(...t){t.forEach((t=>{this.runners[t]=new zt(t)}))}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const t in this.runners)this.runners[t].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach((r=>{const s=i.find((t=>this._systemsHash[t]===r));r[t.name](e[s])}))}destroy(){Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash={}}}const ar=class t{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=t.defaultMaxIdle,this.checkCountMax=t.defaultCheckCountMax,this.mode=t.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==_.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let r=0;r<e.length;r++){const s=e[r];s.resource&&this.count-s.touched>
1this.maxIdle&&(t.destroyTexture(s,!0),e[r]=null,i=!0)}if(i){let t=0;for(let i=0;i<e.length;i++)null!==e[i]&&(e[t++]=e[i]);e.length=t}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let e=t.children.length-1;e>=0;e--)this.unload(t.children[e])}destroy(){this.renderer=null}};ar.defaultMode=_.AUTO,ar.defaultMaxIdle=3600,ar.defaultCheckCountMax=600,ar.extension={type:Mt.RendererSystem,name:"textureGC"};let hr=ar;Bt.add(hr);class lr{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 ur{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Wt,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),this.samplerTypes=function(t){let e;return e="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[t.RGB]:c.FLOAT,[t.RGBA]:c.FLOAT,[t.ALPHA]:c.FLOAT,[t.LUMINANCE]:c.FLOAT,[t.LUMINANCE_ALPHA]:c.FLOAT,[t.R8]:c.FLOAT,[t.R8_SNORM]:c.FLOAT,[t.RG8]:c.FLOAT,[t.RG8_SNORM]:c.FLOAT,[t.RGB8]:c.FLOAT,[t.RGB8_SNORM]:c.FLOAT,[t.RGB565]:c.FLOAT,[t.RGBA4]:c.FLOAT,[t.RGB5_A1]:c.FLOAT,[t.RGBA8]:c.FLOAT,[t.RGBA8_SNORM]:c.FLOAT,[t.RGB10_A2]:c.FLOAT,[t.RGB10_A2UI]:c.FLOAT,[t.SRGB8]:c.FLOAT,[t.SRGB8_ALPHA8]:c.FLOAT,[t.R16F]:c.FLOAT,[t.RG16F]:c.FLOAT,[t.RGB16F]:c.FLOAT,[t.RGBA16F]:c.FLOAT,[t.R32F]:c.FLOAT,[t.RG32F]:c.FLOAT,[t.RGB32F]:c.FLOAT,[t.RGBA32F]:c.FLOAT,[t.R11F_G11F_B10F]:c.FLOAT,[t.RGB9_E5]:c.FLOAT,[t.R8I]:c.INT,[t.R8UI]:c.UINT,[t.R16I]:c.INT,[t.R16UI]:c.UINT,[t.R32I]:c.INT,[t.R32UI]:c.UINT,[t.RG8I]:c.INT,[t.RG8UI]:c.UINT,[t.RG16I]:c.INT,[t.RG16UI]:c.UINT,[t.RG32I]:c.INT,[t.RG32UI]:c.UINT,[t.RGB8I]:c.INT,[t.RGB8UI]:c.UINT,[t.RGB16I]:c.INT,[t.RGB16UI]:c.UINT,[t.RGB32I]:c.INT,[t.RGB32UI]:c.UINT,[t.RGBA8I]:c.INT,[t.RGBA8UI]:c.UINT,[t.RGBA16I]:c.INT,[t.RGBA16UI]:c.UINT,[t.RGBA32I]:c.INT,[t.RGBA32UI]:c.UINT,[t.DEPTH_COMPONENT16]:c.FLOAT,[t.DEPTH_COMPONENT24]:c.FLOAT,[t.DEPTH_COMPONENT32F]:c.FLOAT,[t.DEPTH_STENCIL]:c.FLOAT,[t.DEPTH24_STENCIL8]:c.FLOAT,[t.DEPTH32F_STENCIL8]:c.FLOAT}:{[t.RGB]:c.FLOAT,[t.RGBA]:c.FLOAT,[t.ALPHA]:c.FLOAT,[t.LUMINANCE]:c.FLOAT,[t.LUMINANCE_ALPHA]:c.FLOAT,[t.DEPTH_STENCIL]:c.FLOAT},e}(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let t=0;t<e;t++)this.boundTextures[t]=null;this.emptyTextures={};const i=new lr(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new lr(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let e=0;e<6;e++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let t=0;t<this.boundTextures.length;t++)this.bind(null,t)}bind(t,e=0){const{gl:i}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let t=0;t<i.length;t++)i[t]===this.unknownTexture&&this.bind(null,t)}for(let r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:r}=this;if(i)for(let i=t-1;i>=0;--i){const t=e[i];t&&t._glTextures[r].samplerType!==c.FLOAT&&this.renderer.texture.unbind(t)}}initTexture(t){const e=new lr(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??c.FLOAT,2===this.webGLVersion&&t.type===u.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==c.FLOAT&&(this.hasIntegerTextures=!0);else{const r=t.realWidth,s=t.realHeight,n=i.gl;(e.width!==r||e.height!==s||e.dirtyId<0)&&(e.width=r,e.height=s,n.texImage2D(t.target,0,e.internalFormat,r,s,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const e=this.managedTextures.indexOf(t);-1!==e&&_t(this.managedTextures,e,1)}}updateTextureStyle(t){const e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==p.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=f.CLAMP,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==p.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===d.L
1INEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const e=this.renderer.context.extensions.anisotropicFiltering;if(e&&t.anisotropicLevel>0&&t.scaleMode===d.LINEAR){const r=Math.min(t.anisotropicLevel,i.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===d.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===d.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}ur.extension={type:Mt.RendererSystem,name:"texture"},Bt.add(ur);class cr{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:i}=this,r=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:r}=this;e&&r.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:r}=this,s=e.createTransformFeedback();t._glTransformFeedbacks[r]=s,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s);for(let s=0;s<t.buffers.length;s++){const n=t.buffers[s];n&&(i.buffer.update(n),n._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,s,n._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),s}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const s=this.renderer.buffer;if(s)for(let i=0;i<t.buffers.length;i++){const r=t.buffers[i];if(!r)continue;const n=r._glBuffers[this.CONTEXT_UID];n&&(n.refCount--,0===n.refCount&&!e&&s.dispose(r,e))}i&&(e||r.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}cr.extension={type:Mt.RendererSystem,name:"transformFeedback"},Bt.add(cr);class dr{constructor(t){this.renderer=t}init(t){this.screen=new le(0,0,t.width,t.height),this.element=t.view||T.ADAPTER.createCanvas(),this.resolution=t.resolution||T.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",i,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}}dr.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},dr.extension={type:[Mt.RendererSystem,Mt.CanvasRendererSystem],name:"_view"},Bt.add(dr),T.PREFER_ENV=r.WEBGL2,T.STRICT_TEXTURE_CACHE=!1,T.RENDER_OPTIONS={...ai.defaultOptions,...si.defaultOptions,...dr.defaultOptions,...rr.defaultOptions},Object.defineProperties(T,{WRAP_MODE:{get:()=>Wt.defaultOptions.wrapMode,set(t){S("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Wt.defaultOptions.wrapMode=t}},SCALE_MODE:{get:()=>Wt.defaultOptions.scaleMode,set(t){S("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Wt.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get:()=>Wt.defaultOptions.mipmap,set(t){S("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Wt.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get:()=>Wt.defaultOptions.anisotropicLevel,set(t){S("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Wt.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get:()=>(S("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ri.defaultResolution),set(t){ri.defaultResolution=t}},FILTER_MULTISAMPLE:{get:()=>(S("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ri.defaultMultisample),set(t){ri.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get:()=>ei.defaultMaxTextures,set(t){S("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ei.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get:()=>ei.defaultBatchSize,set(t){S("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ei.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get:()=>
1ei.canUploadSameBuffer,set(t){S("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ei.canUploadSameBuffer=t}},GC_MODE:{get:()=>hr.defaultMode,set(t){S("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),hr.defaultMode=t}},GC_MAX_IDLE:{get:()=>hr.defaultMaxIdle,set(t){S("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),hr.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get:()=>hr.defaultCheckCountMax,set(t){S("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),hr.defaultCheckCountMax=t}},PRECISION_VERTEX:{get:()=>$e.defaultVertexPrecision,set(t){S("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),$e.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get:()=>$e.defaultFragmentPrecision,set(t){S("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),$e.defaultFragmentPrecision=t}}});var fr=(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))(fr||{});class pr{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=r}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 mr=class t{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 pr(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.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,i=fr.NORMAL){return this._addListener(new pr(t,e,i))}addOnce(t,e,i=fr.NORMAL){return this._addListener(new pr(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i=i.match(t,e)?i.destroy():i.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(e=performance.now()){let i;if(e>this.lastTime){if(i=this.elapsedMS=e-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){const t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=i,this.deltaTime=this.deltaMS*t.targetFPMS;const r=this._head;let s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const i=Math.min(this.maxFPS,e),r=Math.min(Math.max(0,i)/1e3,t.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}
vendor: 4,361 bytes, line 1
1set maxFPS(t){if(0===t)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!t._shared){const e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){const e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};mr.targetFPMS=.06;let gr=mr;Object.defineProperties(T,{TARGET_FPMS:{get:()=>gr.targetFPMS,set(t){S("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),gr.targetFPMS=t}}});class _r{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,fr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?gr.shared:new gr,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}_r.extension=Mt.Application,Bt.add(_r);const vr=[];Bt.handleByList(Mt.Renderer,vr);const xr="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 yr{constructor(t){this.renderer=t}contextChange(t){let e;if(1===this.renderer.context.webGLVersion){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=y.HIGH?this.multisample=y.HIGH:e>=y.MEDIUM?this.multisample=y.MEDIUM:e>=y.LOW?this.multisample=y.LOW:this.multisample=y.NONE}destroy(){}}yr.extension={type:Mt.RendererSystem,name:"_multisample"},Bt.add(yr);class br{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Tr{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:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const s=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,s.buffer)}}bindBufferRange(t,e,i){const{gl:r,CONTEXT_UID:s}=this;i=i||0;const n=t._glBuffers[s]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,n.buffer,256*i,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const i=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,i)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new br(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Tr.extension={type:Mt.RendererSystem,name:"buffer"},Bt.add(Tr);class Er{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let r,s,n,o;if(e&&(r=e.renderTexture,s=e.clear,n=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!r,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=n,!i.context.
1isLost){if(r||(this.lastObjectRendered=t),!o){const e=t.enableTempParent();t.updateTransform(),t.disableTempParent(e)}i.renderTexture.bind(r),i.batch.currentRenderer.start(),(s??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),r&&(e.blit&&i.framebuffer.blit(),r.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Er.extension={type:Mt.RendererSystem,name:"objectRenderer"},Bt.add(Er);const Ar=class t extends or{constructor(e){super(),this.type=s.WEBGL,e=Object.assign({},T.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new qe({projectionMatrix:new pe},!0);const i={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:t.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(i),"useContextAlpha"in e&&(S("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&"notMultiplied"!==e.useContextAlpha,e.backgroundAlpha=!1===e.useContextAlpha?1:e.backgroundAlpha),this._plugin.rendererPlugins=t.__plugins,this.options=e,this.startup.run(this.options)}static test(t){return!t?.forceCanvas&&(typeof I>"u"&&(I=function(){const t={stencil:!0,failIfMajorPerformanceCaveat:T.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!T.ADAPTER.getWebGLRenderingContext())return!1;const e=T.ADAPTER.createCanvas();let i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const r=!!i?.getContextAttributes()?.stencil;if(i){const t=i.getExtension("WEBGL_lose_context");t&&t.loseContext()}return i=null,r}catch{return!1}}()),I)}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return S("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return S("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return S("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return S("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){S("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return S("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){S("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return S("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Ar.extension={type:Mt.Renderer,priority:1},Ar.__plugins={},Ar.__systems={};let Sr=Ar;Bt.handleByMap(Mt.RendererPlugin,Sr.__plugins),Bt.handleByMap(Mt.RendererSystem,Sr.__systems),Bt.add(Sr);class wr extends Ht{constructor(t,e){const{width:i,height:r}=e||{};
1super(i,r),this.items=[],this.itemDirtyIds=[];for(let e=0;e<t;e++){const t=new Wt;this.items.push(t),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof Ht?this.addResourceAt(t[i],i):this.addResourceAt(Gt(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map((t=>t.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),this.update(),Promise.resolve(this)})),this._load}}const Cr=class t extends wr{constructor(e,i){const{width:r,height:s,autoLoad:n,linkBaseTexture:o}=i||{};if(e&&e.length!==t.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:r,height:s});for(let e=0;e<t.SIDES;e++)this.items[e].target=l.TEXTURE_CUBE_MAP_POSITIVE_X+e;this.linkBaseTexture=!1!==o,e&&this.initFromArray(e,i),!1!==n&&this.load()}bind(t){super.bind(t),t.target=l.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(void 0===i&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(!t.resource)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(e,i,r){const s=this.itemDirtyIds;for(let n=0;n<t.SIDES;n++){const t=this.items[n];(s[n]<t.dirtyId||r.dirtyId<i.dirtyId)&&(t.valid&&t.resource?(t.resource.upload(e,t,r),s[n]=t.dirtyId):s[n]<-1&&(e.gl.texImage2D(t.target,0,r.internalFormat,i.realWidth,i.realHeight,0,i.format,r.type,null),s[n]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===t.SIDES}};Cr.SIDES=6;let Pr=Cr;class Rr extends ui{constructor(t,e){let i,r,s;e=e||{},"string"==typeof t?(i=Rr.EMPTY,r=t,s=!0):(i=t,r=null,s=!1),super(i),this.url=r,this.crossOrigin=e.crossOrigin??!0,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??s,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((async(t,e)=>{if(null!==this.url)try{const e=await T.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const i=await e.blob();if(this.destroyed)return;const r=await createImageBitmap(i,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===m.UNPACK?"premultiply":"none"});if(this.destroyed)return void r.close();this.source=r,this.update(),t(this)}catch(t){if(this.destroyed)return;e(t),this.onError.emit(t)}else t(this)}))),this._load}upload(t,e,i){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){return Rr._EMPTY=Rr._EMPTY??T.ADAPTER.createCanvas(0,0),Rr._EMPTY}}const Ir=class t extends ui{constructor(t,e){e=e||{},super(T.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((e=>{if(this._resolve=()=>{this.update(),e(this)},t.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;ui.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>
1{if(!this._resolve)return;const e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,s=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/i*e,s=this._overrideHeight||this._overrideWidth/e*i),r=Math.round(r),s=Math.round(s);const n=this.source;n.width=r,n.height=s,n._pixiId=`canvas_${yt()}`,n.getContext("2d").drawImage(t,0,0,e,i,0,0,r,s),this._resolve(),this._resolve=null}}static getSize(e){const i=t.SVG_SIZE.exec(e),r={};return i&&(r[i[1]]=Math.round(parseFloat(i[3])),r[i[5]]=Math.round(parseFloat(i[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,i){return"svg"===i||"string"==typeof e&&e.startsWith("data:image/svg+xml")||"string"==typeof e&&t.SVG_XML.test(e)}};Ir.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Ir.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Mr=Ir;const Dr=class t extends ui{constructor(e,i){if(i=i||{},!(e instanceof HTMLVideoElement)){const r=document.createElement("video");!1!==i.autoLoad&&r.setAttribute("preload","auto"),!1!==i.playsinline&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),!0===i.muted&&(r.setAttribute("muted",""),r.muted=!0),!0===i.loop&&r.setAttribute("loop",""),!1!==i.autoPlay&&r.setAttribute("autoplay",""),"string"==typeof e&&(e=[e]);const s=e[0].src||e[0];ui.crossOrigin(r,s,i.crossorigin);for(let i=0;i<e.length;++i){const s=document.createElement("source");let{src:n,mime:o}=e[i];if(n=n||e[i],n.startsWith("data:"))o=n.slice(5,n.indexOf(";"));else if(!n.startsWith("blob:")){const e=n.split("?").shift().toLowerCase(),i=e.slice(e.lastIndexOf(".")+1);o=o||t.MIME_TYPES[i]||`video/${i}`}s.src=n,o&&(s.type=o),r.appendChild(s)}e=r}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=i.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==i.autoPlay,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==i.autoLoad&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const t=gr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise(((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())})),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(gr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(gr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(gr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,i){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.includes(i)}};Dr.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Dr.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Fr=Dr;Ut.push(Rr,ci,class extends ui{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return!!(e&&t instanceof e)||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}},Fr,class extends ui{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}},Mr,Xt,Pr,class extends wr{constructor(t,e){const{width:i,height:r}=e||{};let s,n;Array.isArray(t)?(s=t,n=t.length):n=t,super(n,{width:i,height:r}),s&&this.initFromArray(s,e)}
vendor: 5,167 bytes, line 1
1addBaseTextureAt(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,i){const{length:r,itemDirtyIds:s,items:n}=this,{gl:o}=t;i.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,r,0,e.format,i.type,null);for(let t=0;t<r;t++){const r=n[t];s[t]<r.dirtyId&&(s[t]=r.dirtyId,r.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,t,r.resource.width,r.resource.height,1,e.format,i.type,r.resource.source))}return!0}});class Br{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?le.EMPTY:((t=t||new le(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:i,b:r,c:s,d:n,tx:o,ty:a}=t,h=i*e.x+s*e.y+o,l=r*e.x+n*e.y+a;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,i=this.minY,r=this.maxX,s=this.maxY,n=t[0],o=t[1];e=n<e?n:e,i=o<i?o:i,r=n>r?n:r,s=o>s?o:s,n=t[2],o=t[3],e=n<e?n:e,i=o<i?o:i,r=n>r?n:r,s=o>s?o:s,n=t[4],o=t[5],e=n<e?n:e,i=o<i?o:i,r=n>r?n:r,s=o>s?o:s,n=t[6],o=t[7],e=n<e?n:e,i=o<i?o:i,r=n>r?n:r,s=o>s?o:s,this.minX=e,this.minY=i,this.maxX=r,this.maxY=s}addFrame(t,e,i,r,s){this.addFrameMatrix(t.worldTransform,e,i,r,s)}addFrameMatrix(t,e,i,r,s){const n=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,u=t.ty;let c=this.minX,d=this.minY,f=this.maxX,p=this.maxY,m=n*e+a*i+l,g=o*e+h*i+u;c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,m=n*r+a*i+l,g=o*r+h*i+u,c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,m=n*e+a*s+l,g=o*e+h*s+u,c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,m=n*r+a*s+l,g=o*r+h*s+u,c=m<c?m:c,d=g<d?g:d,f=m>f?m:f,p=g>p?g:p,this.minX=c,this.minY=d,this.maxX=f,this.maxY=p}addVertexData(t,e,i){let r=this.minX,s=this.minY,n=this.maxX,o=this.maxY;for(let a=e;a<i;a+=2){const e=t[a],i=t[a+1];r=e<r?e:r,s=i<s?i:s,n=e>n?e:n,o=i>o?i:o}this.minX=r,this.minY=s,this.maxX=n,this.maxY=o}addVertices(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)}addVerticesMatrix(t,e,i,r,s=0,n=s){const o=t.a,a=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY;for(let t=i;t<r;t+=2){const i=e[t],r=e[t+1],g=o*i+h*r+u,_=l*r+a*i+c;d=Math.min(d,g-s),p=Math.max(p,g+s),f=Math.min(f,_-n),m=Math.max(m,_+n)}this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addBounds(t){const e=this.minX,i=this.minY,r=this.maxX,s=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>s?t.maxY:s}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,s=t.maxX<e.maxX?t.maxX:e.maxX,n=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=s&&r<=n){const t=this.minX,e=this.minY,o=this.maxX,a=this.maxY;this.minX=i<t?i:t,this.minY=r<e?r:e,this.maxX=s>o?s:o,this.maxY=n>a?n:a}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,s=t.maxX<e.x+e.width?t.maxX:e.x+e.width,n=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=s&&r<=n){const t=this.minX,e=this.minY,o=this.maxX,a=this.maxY;this.minX=i<t?i:t,this.minY=r<e?r:e,this.maxX=s>o?s:o,this.maxY=n>a?n:a}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,r,s,n){t-=s,e-=n,i+=s,r+=n,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r}}class Lr extends t{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Se,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 Br,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 i=0;i<e.length;++i){const r=e[i];Object.defineProperty(Lr.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&
1(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new le),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new le),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Br);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=i?.worldAlpha??1,this.transform=this._tempDisplayObjectParent.transform;const r=this._bounds,s=this._boundsID;this._bounds=this._localBounds;const n=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-s,n}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){this.parent?.removeChild(this)}setTransform(t=0,e=0,i=1,r=1,s=0,n=0,o=0,a=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=s,this.skew.x=n,this.skew.y=o,this.pivot.x=a,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new Or),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*se}set angle(t){this.transform.rotation=t*ne}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,0===t._maskRefCount&&(t.renderable=!0,t.isMask=!1))}if(this._mask=t,this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(0===t._maskRefCount&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class Or extends Lr{constructor(){super(...arguments),this.sortDirty=null}}Lr.prototype.displayObjectUpdateTransform=Lr.prototype.updateTransform;const Nr=new pe;function kr(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}const Ur=class t extends Lr{constructor(){super(),this.children=[],this.sortableChildren=t.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit
1("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.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 i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i:r)}getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);_t(this.children,i,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;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],i=this.children.indexOf(e);if(-1===i)return null;e.parent=null,e.transform._parentID=-1,_t(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,_t(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const i=t,r=e-i;let s;if(r>0&&r<=e){s=this.children.splice(i,r);for(let t=0;t<s.length;++t)s[t].parent=null,s[t].transform&&(s[t].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let t=0;t<s.length;++t)s[t].emit("removed",this),this.emit("childRemoved",s[t],this,t);return s}if(0===r&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const i=this.children[e];i._lastSortedIndex=e,!t&&0!==i.zIndex&&(t=!0)}t&&this.children.length>1&&this.children.sort(kr),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;t<e;++t){const e=this.children[t];e.visible&&e.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(e.visible&&e.renderable)if(e.calculateBounds(),e._mask){const t=e._mask.isMaskData?e._mask.maskObject:e._mask;t?(t.calculateBounds(),this._bounds.addBoundsMask(e._bounds,t._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const i=super.getLocalBounds(t);if(!e)for(let t=0,e=this.children.length;t<e;++t){const e=this.children[t];e.visible&&e.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(e){const i=e.renderTexture.sourceFrame;if(!(i.width>0&&i.height>0))return;let r,s;this.cullArea?(r=this.cullArea,s=this.worldTransform):this._render!==t.prototype._render&&(r=this.getBounds(!0));const n=e.projection.transform;if(n&&(s?(s=Nr.copyFrom(s),s.prepend(n)):s=n),r&&i.intersects(r,s))this._render(e);else if(this.cullArea)return;for(let t=0,i=this.children.length;t<i;++t){const i=this.children[t],r=i.cullable;i.cullable=r||!this.cullArea,i.render(e),i.cullable=r}}render(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,i=this.children.length;e<i;++e)this.children[e].render(t)}}renderAdvanced(t){const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let t=0;t<e.length;t++)e[t].enabled&&this._enabledFilters.push(e[t])}const r=e&&this._enabledFilters?.length||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==x.NONE));if(r&&t.batch.flush(),e&&this._enabledFilters?.length&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,i=this.children.length;e<i;++e)this.children[e].render(t)}r&&t.batch.flush(),i&&t.mask.pop(this),e&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e="boolean"==typeof t?t:t?.children,i=this.removeChildren(0,this.children.length);if(e)for(let e=0;e<i.length;++e)i[e].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;this.scale.x=0!==e?t/e:1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;this.scale.y=0!==e?t/e:1,this._height=t}};Ur.defaultSortableChildren=!1;let Gr=Ur;Gr.prototype.containerUpdateTransform=Gr.prototype.updateTransform,Object.defineProperties(T,{SORTABLE_CHILDREN:{get:()=>Gr.defaultSortableChildren,set(t){S("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Gr.defaultSortableChildren=t}}});const zr=new ae,Hr=new Uint16Array([0,1,2,0,2,3]);class Xr extends Gr{constructor(t){super(),this._anchor=new Ee(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 ot(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=o.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||mi.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Hr,this.pluginName="batch",this.isSprite=!0,this._roundPixels=T.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=vt(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=vt(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,i=e.a,r=e.b,s=e.c,n=e.d,o=e.tx,a=e.ty,h=this.vertexData,l=t.trim,u=t.orig,c=this._anchor;let d=0,f=0,p=0,m=0;if(l?(f=l.x-c._x*u.width,d=f+l.width,m=l.y-c._y*u.height,p=m+l.height):(f=-c._x*u.width,d=f+u.width,m=-c._y*u.height,p=m+u.height),h[0]=i*f+s*m+o,h[1]=n*m+r*f+a,h[2]=i*d+s*m+o,h[3]=n*m+r*d+a,h[4]=i*d+s*p+o,h[5]=n*p+r*d+a,h[6]=i*f+s*p+o,h[7]=n*p+r*f+a,this._roundPixels){const t=T.RESOLUTION;for(let e=0;e<h.length;++e)h[e]=Math.round(h[e]*t)/t}}
1calculateTrimmedVertices(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,h=s.d,l=s.tx,u=s.ty,c=-r._x*i.width,d=c+i.width,f=-r._y*i.height,p=f+i.height;if(e[0]=n*c+a*f+l,e[1]=h*f+o*c+u,e[2]=n*d+a*f+l,e[3]=h*f+o*d+u,e[4]=n*d+a*p+l,e[5]=h*p+o*d+u,e[6]=n*c+a*p+l,e[7]=h*p+o*c+u,this._roundPixels){const t=T.RESOLUTION;for(let i=0;i<e.length;++i)e[i]=Math.round(e[i]*t)/t}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return 0===this.children.length?(this._localBounds||(this._localBounds=new Br),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new le),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,zr);const e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x;let s=0;return zr.x>=r&&zr.x<r+e&&(s=-i*this.anchor.y,zr.y>=s&&zr.y<s+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof mi?t:mi.from(t,e);return new Xr(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=vt(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=vt(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||mi.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Vr=new pe;Lr.prototype._cacheAsBitmap=!1,Lr.prototype._cacheData=null,Lr.prototype._cacheAsBitmapResolution=null,
1Lr.prototype._cacheAsBitmapMultisample=null;class jr{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Lr.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(t){if(this._cacheAsBitmap===t)return;let e;this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new jr),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}),Lr.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},Lr.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;const e=this.alpha;this.alpha=1,t.batch.flush();const i=this.getLocalBounds(new le,!0);if(this.filters?.length){const t=this.filters[0].padding;i.pad(t)}const r=this.cacheAsBitmapResolution||t.resolution;i.ceil(r),i.width=Math.max(i.width,1/r),i.height=Math.max(i.height,1/r);const s=t.renderTexture.current,n=t.renderTexture.sourceFrame.clone(),o=t.renderTexture.destinationFrame.clone(),a=t.projection.transform,h=gi.create({width:i.width,height:i.height,resolution:r,multisample:this.cacheAsBitmapMultisample??t.multisample}),l=`cacheAsBitmap_${yt()}`;this._cacheData.textureCacheId=l,Wt.addToCache(h.baseTexture,l),mi.addToCache(h,l);const u=this.transform.localTransform.copyTo(Vr).invert().translate(-i.x,-i.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:h,clear:!0,transform:u,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=a,t.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const c=new Xr(h);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-i.x/i.width,c.anchor.y=-i.y/i.height,c.alpha=e,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Lr.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},Lr.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;const e=this.getLocalBounds(new le,!0),i=this.alpha;this.alpha=1;const r=t.canvasContext.activeContext,s=t._projTransform,n=this.cacheAsBitmapResolution||t.resolution;e.ceil(n),e.width=Math.max(e.width,1/n),e.height=Math.max(e.height,1/n);const o=gi.create({width:e.width,height:e.height,resolution:n}),a=`cacheAsBitmap_${yt()}`;this._cacheData.textureCacheId=a,Wt.addToCache(o.baseTexture,a),mi.addToCache(o,a);const h=Vr;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),t.canvasContext.activeContext=r,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;
1const l=new Xr(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-e.x/e.width,l.anchor.y=-e.y/e.height,l.alpha=i,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Lr.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Lr.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Lr.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Wt.removeFromCache(this._cacheData.textureCacheId),mi.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Lr.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},Lr.prototype.name=null,Gr.prototype.getChildByName=function(t,e){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===t)return this.children[e];if(e)for(let e=0,i=this.children.length;e<i;e++){const i=this.children[e];if(!i.getChildByName)continue;const r=i.getChildByName(t,!0);if(r)return r}return null},Lr.prototype.getGlobalPosition=function(t=new ae,e=!1){return this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};class Wr extends ri{constructor(t=1){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n   gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const $r={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Yr=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{","    gl_FragColor = vec4(0.0);","    %blur%","}"].join("\n");class qr extends ri{constructor(t,e=8,i=4,r=ri.defaultResolution,s=5){const n=function(t,e){const i=Math.ceil(t/2);let r,s="\n    attribute vec2 aVertexPosition;\n\n    uniform mat3 projectionMatrix;\n\n    uniform float strength;\n\n    varying vec2 vBlurTexCoords[%size%];\n\n    uniform vec4 inputSize;\n    uniform vec4 outputFrame;\n\n    vec4 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\n    vec2 filterTextureCoord( void )\n    {\n        return aVertexPosition * (outputFrame.zw * inputSize.zw);\n    }\n\n    void main(void)\n    {\n        gl_Position = filterVertexPosition();\n\n        vec2 textureCoord = filterTextureCoord();\n        %blur%\n    }",n="";r=e?"vBlurTexCoords[%index%] =  textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] =  textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let e=0;e<t;e++){let t=r.replace("%index%",e.toString());t=t.replace("%sampleIndex%",e-(i-1)+".0"),n+=t,n+="\n"}return s=s.replace("%blur%",n),s=s.replace("%size%",t.toString()),s}(s,t),o=function(t){const e=$r[t],i=e.length;let r,s=Yr,n="";for(let s=0;s<t;s++){let o="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",s.toString());r=s,s>=i&&(r=t-s-1),o=o.replace("%value%",e[r].toString()),n+=o,n+="\n"}return s=s.replace("%blur%",n),s=s.replace("%size%",t.toString()),s}(s);super(n,o),this.horizontal=t,this.resolution=r,this._quality=0,this.quality=i,this.blur=e}apply(t,e,i,r){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.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,i,r);else{const s=t.getFilterTexture(),n=t.renderer;let o=e,a=s;this.state.blend=!1,t.applyFilter(this,o,a,g.CLEAR);for(let e=1;e<this.passes-1;e++){t.bindAndClear(o,g.BLIT),this.uniforms.uSampler=a;const e=a;a=o,o=e,n.shader.bind(this),n.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,a,i,r),t.returnFilterTexture(s)}}get blur(){return this.strength}set blur(t){this.padding=1+2*Math.abs(t),this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class Kr extends ri{constructor(t=8,e=4,i=ri.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new qr(!0,t,e,i,r),this.blurYFilter=new qr(!1,t,e,i,r),this.resolution=i,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,i,r){const s=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(s&&n){const s=t.getFilterTexture();this.blurXFilter.apply(t,e,s,g.CLEAR),this.blurYFilter.apply(t,s,i,r),t.returnFilterTexture(s)}else n?this.blurYFilter.apply(t,e,i,r):this.blurXFilter.apply(t,e,i,r)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}class Zr extends ri{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(xr,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n    vec4 c = texture2D(uSampler, vTextureCoord);\n\n    if (uAlpha == 0.0) {\n        gl_FragColor = c;\n        return;\n    }\n\n    // Un-premultiply alpha before applying the color matrix. See issue #3539.\n    if (c.a > 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 i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[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 i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,r,s]=ot.shared.setValue(t).toArray(),n=[i,0,0,0,0,0,r,0,0,0,0,0,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,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 i=Math.cos(t),r=Math.sin(t),s=1/3,n=(0,Math.sqrt)(s),o=[i+(1-i)*s,s*(1-i)-n*r,s*(1-i)+n*r,0,0,s*(1-i)+n*r,i+s*(1-i),s*(1-i)-n*r,0,0,s*(1-i)-n*r,s*(1-i)+n*r,i+s*(1-i),0,0,0,0,0,1,0];this._loadMatrix(o,e)}contrast(t,e){const i=(t||0)+1,r=-.5*(i-1),s=[i,0,0,0,r,0,i,0,0,r,0,0,i,0,r,0,0,0,1,0];this._loadMatrix(s,e)}saturate(t=0,e){const i=2*t/3+1,r=-.5*(i-1),s=[i,r,r,0,0,r,i,r,0,0,r,r,i,0,0,0,0,0,1,0];this._loadMatrix(s,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,-.091555084827
155585,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,i,r,s){t=t||.2,e=e||.15,i=i||16770432,r=r||3375104;const n=ot.shared,[o,a,h]=n.setValue(i).toArray(),[l,u,c]=n.setValue(r).toArray(),d=[.3,.59,.11,0,0,o,a,h,t,0,l,u,c,e,0,o-l,a-u,h-c,0,0];this._loadMatrix(d,s)}night(t,e){const i=[-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(i,e)}predator(t,e){const i=[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(i,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}}Zr.prototype.grayscale=Zr.prototype.greyscale;class Qr extends ri{constructor(t,e){const i=new pe;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:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,null==e&&(e=20),this.scale=new ae(e,e)}apply(t,e,i,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const s=this.maskSprite.worldTransform,n=Math.sqrt(s.a*s.a+s.b*s.b),o=Math.sqrt(s.c*s.c+s.d*s.d);0!==n&&0!==o&&(this.uniforms.rotation[0]=s.a/n,this.uniforms.rotation[1]=s.b/n,this.uniforms.rotation[2]=s.c/o,this.uniforms.rotation[3]=s.d/o),t.applyFilter(this,e,i,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}class Jr extends ri{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;
1\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);
1\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 ts extends ri{constructor(t=.5,e=Math.random()){super(xr,"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 es=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||(gr.system.add(this.tickerUpdate,this,fr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(gr.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._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}};class is{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=is.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ae,this.page=new ae,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,r,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class rs extends is{constructor(){super(...arguments),this.client=new ae,this.movement=new ae,this.offset=new ae,this.global=new ae,this.screen=new ae}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}
1getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,s,n,o,a,h,l,u,c,d,f,p){throw new Error("Method not implemented.")}}class ss extends rs{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class ns extends rs{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}ns.DOM_DELTA_PIXEL=0,ns.DOM_DELTA_LINE=1,ns.DOM_DELTA_PAGE=2;const os=new ae,as=new ae;class hs{constructor(e){this.dispatch=new t,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.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 i=0,r=e.length;i<r;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}
1hitTest(t,e){es.pauseUpdate=!0;const i=this[this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive"](this.rootTarget,this.rootTarget.eventMode,os.set(t,e),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,s=i.length-1;r<s;r++)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(0===i.length)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let e=i.length-1;e>=0;e--)r.forEach((r=>{t.currentTarget=i[e],this.notifyTarget(t,r)}))}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget;i++){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,i,r,s,n=!1){let o=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(es.pauseUpdate=!1),t.interactiveChildren&&t.children){const a=t.children;for(let h=a.length-1;h>=0;h--){const l=a[h],u=this.hitTestMoveRecursive(l,this._isInteractive(e)?e:l.eventMode,i,r,s,n||s(t,i));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),o=!0}}}const a=this._isInteractive(e),h=t.isInteractive();return a&&h&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:o?this._hitElements:a&&!s(t,i)&&r(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,r,s){if(this._interactivePrune(t)||s(t,i))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(es.pauseUpdate=!1),t.interactiveChildren&&t.children){const n=t.children;for(let o=n.length-1;o>=0;o--){const a=n[o],h=this.hitTestRecursive(a,this._isInteractive(e)?e:a.eventMode,i,r,s
1);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),o=t.isInteractive();return n&&r(t,i)?o?[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){if(t.hitArea&&(t.worldTransform.applyInverse(e,as),!t.hitArea.contains(as.x,as.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!i.containsPoint?.(e))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){const i=`on${e=e??t.type}`;t.currentTarget[i]?.(t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof ss))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){if(!(t instanceof ss))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 e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i="mouse"===e.pointerType||"pen"===e.pointerType,r=this.trackingData(t.pointerId),s=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&s!==e.target){const r="mousemove"===t.type?"mouseout":"pointerout",n=this.createPointerEvent(t,r,s);if(this.dispatchEvent(n,"pointerout"),i&&this.dispatchEvent(n,"mouseout"),!e.composedPath().includes(s)){const r=this.createPointerEvent(t,"pointerleave",s);for(r.eventPhase=r.AT_TARGET;r.target&&!e.composedPath().includes(r.target);)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;this.freeEvent(r)}this.freeEvent(n)}if(s!==e.target){const r="mousemove"===t.type?"mouseover":"pointerover",n=this.clonePointerEvent(e,r);this.dispatchEvent(n,"pointerover"),i&&this.dispatchEvent(n,"mouseover");let o=s?.parent;for(;o&&o!==this.rootTarget.parent&&o!==e.target;)o=o.parent;if(!o||o===this.rootTarget.parent){const t=this.clonePointerEvent(e,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==s&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),i&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(n)}const n=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),o&&n.push("globalpointermove"),"touch"===e.pointerType&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),o&&n.push("globaltouchmove")),i&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),o&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof ss))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=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=i.target?.cursor);const s=this.clonePointerEvent(i,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(s)}mapPointerOut(t){if(!(t instanceof ss))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 i="mouse"===t.pointerType||"pen"===t.pointerType,r=this.findMountedTarget(e.overTargets),s=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(s),i&&this.dispatchEvent(s,"mouseout");const n=this.createPointerEvent(t,"pointerleave",r);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(s),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof ss))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),"touch"===i.pointerType)this.dispatchEvent(i,"touchend");else if("mouse"===i.pointerType||"pen"===i.pointerType){const t=2===i.button;this.dispatchEvent(i,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),s=this.findMountedTarget(r.pressTargetsByButton[t.button]);let n=s;if(s&&!i.composedPath().includes(s)){let e=s;for(;e&&!i.composedPath().includes(e);){if(i.currentTarget=e,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType)this.notifyTarget(i,"touchendoutside");else if("mouse"===i.pointerType||"pen"===i.pointerType){const t=2===i.button;this.notifyTarget(i,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],n=e}if(n){const s=this.clonePointerEvent(i,"click");s.target=n,s.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:s.target,timeStamp:e});const o=r.clicksByButton[t.button];if(o.target===s.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=s.target,o.timeStamp=e,s.detail=o.clickCount,"mouse"===s.pointerType){const t=2===s.button;this.dispatchEvent(s,t?"rightclick":"click")}else"touch"===s.pointerType&&this.dispatchEvent(s,"tap");this.dispatchEvent(s,"pointertap"),this.freeEvent(s)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof ss))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let s=i;for(;s;)r.currentTarget=s,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType?this.notifyTarget(r,"touchendoutside"):("mouse"===r.pointerType||"pen"===r.pointerType)&&this.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),s=s.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof ns))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 i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const r=this.allocateEvent(ss);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],"string"==typeof e&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(ns);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(ss);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof ss&&e instanceof ss&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.t
vendor: 8,045 bytes, line 1
1iltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof rs&&e instanceof rs&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,s=i.length;r<s&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(e,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}const ls={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},us=class t{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new hs(null),es.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ss(null),this.rootWheelEvent=new ns(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...t.defaultEventFeatures},{set:(t,e,i)=>("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=i),t[e]=i,!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(e){const{view:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,t._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),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 i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i)}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)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t<i;t++){const i=e[t],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,es.pointerMoved();const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let t=0,e=r.length;t<e;t++){const e=this.bootstrapEvent(this.rootPointerEvent,r[t]);e.type+=i,this.rootBoundary.mapEvent(e)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,es.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;es.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;es.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){const r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;t.x=(e-r.left)*(this.domElement.width/r.width)*s,t.y=(i-r.top)*(this.domElement.height/r.height)*s}normalizeToPointerData(t){const e=[];
1if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,r=t.changedTouches.length;i<r;i++){const r=t.changedTouches[i];typeof r.button>"u"&&(r.button=0),typeof r.buttons>"u"&&(r.buttons=1),typeof r.isPrimary>"u"&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),typeof r.width>"u"&&(r.width=r.radiusX||1),typeof r.height>"u"&&(r.height=r.radiusY||1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="touch"),typeof r.pointerId>"u"&&(r.pointerId=r.identifier||0),typeof r.pressure>"u"&&(r.pressure=r.force||.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),typeof r.layerX>"u"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY>"u"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=t.type,e.push(r)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=1),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=ls[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};us.extension={name:"events",type:[Mt.RendererSystem,Mt.CanvasRendererSystem]},us.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let cs=us;function ds(t){return"dynamic"===t||"static"===t}Bt.add(cs);const fs={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??ds(cs.defaultEventMode)},set interactive(t){S("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=t,this.eventMode=t?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??cs.defaultEventMode},set eventMode(t){this._internalInteractive=ds(t),this._internalEventMode=t},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(t,e,i){const r="boolean"==typeof i&&i||"object"==typeof i&&i.capture,s="object"==typeof i?i.signal:void 0,n="object"==typeof i&&!0===i.once,o="function"==typeof e?void 0:e;t=r?`${t}capture`:t;const a="function"==typeof e?e:e.handleEvent,h=this;s&&s.addEventListener("abort",(()=>{h.off(t,a,o)})),n?h.once(t,a,o):h.on(t,a,o)},removeEventListener(t,e,i){const r="function"==typeof e?void 0:e;t="boolean"==typeof i&&i||"object"==typeof i&&i.capture?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,r)},dispatchEvent(t){if(!(t instanceof is))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};Lr.mixin(fs);Lr.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});class ps{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(E.tablet||E.phone)&&this.createTouchHook();const e=document.createElement("div");
1e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",(()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()})),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){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),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!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),this.div.parentNode?.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<e.length;t++)this.updateAccessibleObjects(e[t])}update(){const t=performance.now();if(E.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:r,height:s}=this.renderer.view.getBoundingClientRect(),{width:n,height:o,resolution:a}=this.renderer,h=r/n*a,l=s/o*a;let u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${n}px`,u.style.height=`${o}px`;for(let t=0;t<this.children.length;t++){const e=this.children[t];if(e.renderId!==this.renderId)e._accessibleActive=!1,_t(this.children,t,1),this.div.removeChild(e._accessibleDiv),this.pool.push(e._accessibleDiv),e._accessibleDiv=null,t--;else{u=e._accessibleDiv;let t=e.hitArea;const i=e.worldTransform;e.hitArea?(u.style.left=(i.tx+t.x*i.a)*h+"px",u.style.top=(i.ty+t.y*i.d)*l+"px",u.style.width=t.width*i.a*h+"px",u.style.height=t.height*i.d*l+"px"):(t=e.getBounds(),this.capHitArea(t),u.style.left=t.x*h+"px",u.style.top=t.y*l+"px",u.style.width=t.width*h+"px",u.style.height=t.height*l+"px",u.title!==e.accessibleTitle&&null!==e.accessibleTitle&&(u.title=e.accessibleTitle),u.getAttribute("aria-label")!==e.accessibleHint&&null!==e.accessibleHint&&u.setAttribute("aria-label",e.accessibleHint)),(e.accessibleTitle!==u.title||e.tabIndex!==u.tabIndex)&&(u.title=e.accessibleTitle,u.tabIndex=e.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-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:i}=t.target,r=this.renderer.events.rootBoundary,s=Object.assign(new is(r),{target:i});r.rootTarget=this.renderer.lastObjectRendered,e.forEach((t=>r.dispatchEvent(s,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}}ps.extension={name:"accessibility",type:[Mt.RendererPlugin,Mt.CanvasRendererPlugin]},Bt.add(ps);const ms=class t{constructor(e){this.stage=new Gr,e=Object.assign({forceCanvas:!1},e),this.renderer=function(t){for(const e of vr)if(e.test(t))return new e(t);throw new Error("Unable to auto-detect a suitable renderer.")}(e),t._plugins.forEach((t=>{t.init.call(this,e)}))}render(){this.renderer.render(this.stage)}get view(){return this.renderer?.view}get screen(){return this.renderer?.screen}destroy(e,i){const r=t._plugins.slice(0);r.reverse(),r.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null}};ms._plugins=[];let gs=ms;Bt.handleByList(Mt.Application,gs._plugins);class _s{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:i,clientHeight:r}=this._resizeTo;t=i,e=r}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}}_s.extension=Mt.Application,Bt.add(_s);const vs={loader:Mt.LoadParser,resolver:Mt.ResolveParser,cache:Mt.Cac
1heParser,detection:Mt.DetectionParser};Bt.handle(Mt.Asset,(t=>{const e=t.ref;Object.entries(vs).filter((([t])=>!!e[t])).forEach((([t,i])=>Bt.add(Object.assign(e[t],{extension:e[t].extension??i}))))}),(t=>{const e=t.ref;Object.keys(vs).filter((t=>!!e[t])).forEach((t=>Bt.remove(e[t])))}));class xs{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 i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function ys(t,e){if(Array.isArray(e)){for(const i of e)if(t.startsWith(`data:${i}`))return!0;return!1}return t.startsWith(`data:${e}`)}function bs(t,e){const i=t.split("?")[0],r=P.extname(i).toLowerCase();return Array.isArray(e)?e.includes(r):r===e}const Ts=(t,e,i=!1)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t||i?e(t):t)):t),Es=(t,e)=>{const i=e.split("?")[1];return i&&(t+=`?${i}`),t};function As(t,e,i,r,s){const n=e[i];for(let o=0;o<n.length;o++){const a=n[o];i<e.length-1?As(t.replace(r[i],a),e,i+1,r,s):s.push(t.replace(r[i],a))}}function Ss(t){const e=t.match(/\{(.*?)\}/g),i=[];if(e){const r=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");r.push(e)})),As(t,r,0,e,i)}else i.push(t);return i}const ws=t=>!Array.isArray(t);const Cs=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 i=Ts(t);let r;for(let t=0;t<this.parsers.length;t++){const s=this.parsers[t];if(s.test(e)){r=s.getCacheableAssets(i,e);break}}r||(r={},i.forEach((t=>{r[t]=e})));const s=Object.keys(r),n={cacheKeys:s,keys:i};if(i.forEach((t=>{this._cacheMap.set(t,n)})),s.forEach((t=>{this._cache.has(t)&&this._cache.get(t)!==e&&console.warn("[Cache] already has key:",t),this._cache.set(t,r[t])})),e instanceof mi){const t=e;i.forEach((e=>{t.baseTexture!==mi.EMPTY.baseTexture&&Wt.addToCache(t.baseTexture,e),mi.addToCache(t,e)}))}}remove(t){if(!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 Ps{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{let r=null,s=null;if(e.loadParser&&(s=this._parserHash[e.loadParser],s||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!s){for(let i=0;i<this.parsers.length;i++){const r=this.parsers[i];if(r.load&&r.test?.(t,e,this)){s=r;break}}if(!s)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await s.load(t,e,this),i.parser=s;for(let t=0;t<this.parsers.length;t++){const s=this.parsers[t];s.parse&&s.parse&&await(s.testParse?.(r,e,this))&&(r=await s.parse(r,e,this)||r,i.parser=s)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const r={},s=ws(t),n=Ts(t,(t=>({alias:[t],src:t}))),o=n.length,a=n.map((async t=>{const s=P.toAbsolute(t.src);if(!r[t.src])try{this.promiseCache[s]||(this.promiseCache[s]=this._getLoadPromiseAndParser(s,t)),r[t.src]=await this.promiseCache[s].promise,e&&e(++i/o)}catch(e){throw delete this.promiseCache[s],delete r[t.src],new Error(`[Loader.load] Failed to load ${s}.\n${e}`)}}));return await Promise.all(a),s?r[n[0].src]:r}async unload(t){const e=Ts(t,(t=>({alias:[t],src:t}))).map((async t=>{const e=P.toAbsolute(t.src),i=this.promiseCache[e];if(i){const r=await i.promise;delete this.promiseCache[e],i.parser?.unload?.(r,t,this)}}));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}"`),{...t,[e.name]:e})),{})}}var Rs=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Rs||{});const Is={extension:{type:Mt.LoadParser,priority:Rs.Low},name:"loadJson",test:t=>ys(t,"application/json")||bs(t,".json"),load:async t=>await(await T.ADAPTER.fetch(t)).json()};Bt.add(Is);const Ms={name:"loadTxt",extension:{type:Mt.LoadParser,priority:Rs.Low},test:t=>ys(t,"text/plain")||bs(t,".txt"),load:async t=>await(await T.ADAPTER.fetch(t)).text()};Bt.add(Ms);const Ds=["normal","bold","100","200","300","400","500","600","700","800","900"],Fs=[".ttf",".otf",".woff",".woff2"],Bs=["font/ttf","font/otf","font/woff","font/woff2"],Ls=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;const Os=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;const Ns={extension:{type:Mt.LoadParser,priority:Rs.Low},name:"loadWebFont",test:t=>ys(t,Bs)||bs(t,Fs),async load(t,e){const i=T.ADAPTER.getFontFaceSet();if(i){const s=[],n=e.data?.family??function(t){const e=P.extname(t),i=P.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map((t=>t.charAt(0).toUpperCase()+t.slice(1)));let r=i.length>0;for(const t of i)if(!t.match(Ls)){r=!1;break}let s=i.join(" ");return r||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}(t),o=e.data?.weights?.filter((t=>Ds.includes(t)))??["normal"],a=e.data??{};for(let e=0;e<o.length;e++){const h=o[e],l=new FontFace(n,`url(${r=t,Os.test(r)?r:encodeURI(r)})`,{...a,weight:h});await l.load(),i.add(l),s.push(l)}return 1===s.length?s[0]:s}var r;return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null}
1,unload(t){(Array.isArray(t)?t:[t]).forEach((t=>T.ADAPTER.getFontFaceSet().delete(t)))}};Bt.add(Ns);let ks=null;class Us extends Worker{constructor(){ks||(ks=URL.createObjectURL(new Blob(['(function() {\n  "use strict";\n  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";\n  async function checkImageBitmap() {\n    try {\n      if (typeof createImageBitmap != "function")\n        return !1;\n      const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);\n      return imageBitmap.width === 1 && imageBitmap.height === 1;\n    } catch {\n      return !1;\n    }\n  }\n  checkImageBitmap().then((result) => {\n    self.postMessage(result);\n  });\n})();\n'],{type:"application/javascript"}))),super(ks)}}Us.revokeObjectURL=function(){ks&&(URL.revokeObjectURL(ks),ks=null)};let Gs=null;class zs extends Worker{constructor(){Gs||(Gs=URL.createObjectURL(new Blob(['(function() {\n  "use strict";\n  async function loadImageBitmap(url) {\n    const response = await fetch(url);\n    if (!response.ok)\n      throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: ${response.status} ${response.statusText}`);\n    const imageBlob = await response.blob();\n    return await createImageBitmap(imageBlob);\n  }\n  self.onmessage = async (event) => {\n    try {\n      const imageBitmap = await loadImageBitmap(event.data.data[0]);\n      self.postMessage({\n        data: imageBitmap,\n        uuid: event.data.uuid,\n        id: event.data.id\n      }, [imageBitmap]);\n    } catch (e) {\n      self.postMessage({\n        error: e,\n        uuid: event.data.uuid,\n        id: event.data.id\n      });\n    }\n  };\n})();\n'],{type:"application/javascript"}))),super(Gs)}}zs.revokeObjectURL=function(){Gs&&(URL.revokeObjectURL(Gs),Gs=null)};let Hs,Xs=0;const Vs=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=new Us;e.addEventListener("message",(i=>{e.terminate(),Us.revokeObjectURL(),t(i.data)}))}))),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===Hs&&(Hs=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Hs&&(this._createdWorkers++,t=new zs,t.addEventListener("message",(t=>{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 i=new Promise(((i,r)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:r})}));return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[Xs]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Xs++,id:i})}};function js(t,e,i){t.resource.internal=!0;const r=new mi(t),s=()=>{delete e.promiseCache[i],Cs.has(i)&&Cs.remove(i)};return r.baseTexture.once("destroyed",(()=>{i in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())})),r.once("destroyed",(()=>{t.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())})),r}const Ws=[".jpeg",".jpg",".png",".webp",".avif"],$s=["image/jpeg","image/png","image/webp","image/avif"];const Ys={name:"loadTextures",extension:{type:Mt.LoadParser,priority:Rs.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>ys(t,$s)||bs(t,Ws),async load(t,e,i){const r=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;s=r?this.config.preferWorkers&&await Vs.isImageBitmapSupported()?await Vs.loadImageBitmap(t):await async function(t){const e=await T.ADAPTER.fetch(t);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);const i=await e.blob();return await createImageBitmap(i)}(t):await new Promise(((e,i)=>{const r=new Image;r.crossOrigin=this.config.crossOrigin,r.src=t,r.complete?e(r):(r.onload=()=>e(r),r.onerror=t=>i(t))}));const n={...e.data};n.resolution??(n.resolution=It(t)),r&&void 0===n.resourceOptions?.ownsImageBitmap&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new Wt(s,n);return o.resource.src=t,js(o,i,t)},unload(t){t.destroy(!0)}};Bt.add(Ys);const qs={extension:{type:Mt.LoadParser,priority:Rs.High},name:"loadSVG",test:t=>ys(t,"image/svg+xml")||bs(t,".svg"),testParse:async t=>Mr.test(t),async parse(t,e,i){const r=new Mr(t,e?.data?.resourceOptions);await r.load();const s=new Wt(r,{resolution:It(t),...e?.data});return s.resource.src=e.src,js(s,i,e.src)},load:async(t,e)=>(await T.ADAPTER.fetch(t)).text(),unload:Ys.unload};Bt.add(qs);const Ks=[".mp4",".m4v",".webm",".ogv"],Zs=["video/mp4","video/webm","video/ogg"],Qs={name:"loadVideo",extension:{type:Mt.LoadParser,priority:Rs.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test:t=>ys(t,Zs)||bs(t,Ks),async load(t,e,i){let r;const s=await(await T.ADAPTER.fetch(t)).blob(),n=URL.createObjectURL(s);try{const s={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...e?.data?.resourceOptions,autoLoad:!0},o=new Fr(n,s);await o.load();const a=new Wt(o,{alphaMode:await M(),resolution:It(t),...e?.data});a.resource.src=t,r=js(a,i,t),r.baseTexture.once("destroyed",(()=>{URL.revokeObjectURL(n)}))}catch(t){throw URL.revokeObjectURL(n),t}return r},unload(t){t.destroy(!0)}};Bt.add(Qs);class Js{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"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))}
1)),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("&")}}getAlias(t){const{alias:e,name:i,src:r,srcs:s}=t;return Ts(e||i||r||s,(t=>"string"==typeof t?t:Array.isArray(t)?t.map((t=>t?.src??t?.srcs??t)):t?.src||t?.srcs?t.src??t.srcs:t),!0)}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 i=[];Array.isArray(e)?e.forEach((e=>{const r=e.src??e.srcs,s=e.alias??e.name;let n;if("string"==typeof s){const e=this._createBundleAssetId(t,s);i.push(e),n=[s,e]}else{const e=s.map((e=>this._createBundleAssetId(t,e)));i.push(...e),n=[...s,...e]}this.add({...e,alias:n,src:r})})):Object.keys(e).forEach((r=>{const s=[r,this._createBundleAssetId(t,r)];if("string"==typeof e[r])this.add({alias:s,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:s,src:e[r]});else{const t=e[r],i=t.src??t.srcs;this.add({...t,alias:s,src:Array.isArray(i)?i:[i]})}i.push(...s)})),this._bundles[t]=i}add(t,e,i,r,s){const n=[];let o;"string"==typeof t||Array.isArray(t)&&"string"==typeof t[0]?(S("7.2.0","Assets.add now uses an object instead of individual parameters.\nPlease use Assets.add({ alias, src, data, format, loadParser }) instead."),n.push({alias:t,src:e,data:i,format:r,loadParser:s})):Array.isArray(t)?n.push(...t):n.push(t),o=t=>{this.hasKey(t)&&console.warn(`[Resolver] already has key: ${t} overwriting`)},Ts(n).forEach((t=>{const{src:e,srcs:i}=t;let{data:r,format:s,loadParser:n}=t;const a=Ts(e||i).map((t=>"string"==typeof t?Ss(t):Array.isArray(t)?t:[t])),h=this.getAlias(t);Array.isArray(h)?h.forEach(o):o(h);const l=[];a.forEach((t=>{t.forEach((t=>{let e={};if("object"!=typeof t){e.src=t;for(let i=0;i<this._parsers.length;i++){const r=this._parsers[i];if(r.test(t)){e=r.parse(t);break}}}else r=t.data??r,s=t.format??s,n=t.loadParser??n,e={...e,...t};if(!h)throw new Error(`[Resolver] alias is undefined for this asset: ${e.src}`);e=this.buildResolvedAsset(e,{aliases:h,data:r,format:s,loadParser:n}),l.push(e)}))})),h.forEach((t=>{this._assetMap[t]=l}))}))}resolveBundle(t){const e=ws(t);t=Ts(t);const i={};return t.forEach((t=>{const e=this._bundles[t];if(e){const r=this.resolve(e),s={};for(const e in r){const i=r[e];s[this._extractAssetIdFromBundle(t,e)]=i}i[t]=s}})),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const i in e)t[i]=e[i].src;return t}return e.src}resolve(t){const e=ws(t);t=Ts(t);const i={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const i=e[0],r=this._getPreferredOrder(e);r?.priority.forEach((t=>{r.params[t].forEach((i=>{const r=e.filter((e=>!!e[t]&&e[t]===i));r.length&&(e=r)}))})),this._resolverHash[t]=e[0]??i}else this._resolverHash[t]=this.buildResolvedAsset({alias:[t],src:t},{});i[t]=this._resolverHash[t]})),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const e=t[0],i=this._preferredOrder.find((t=>t.params.format.includes(e.format)));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:s,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=P.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=s??t.loadParser,t.format=n??P.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}const tn=new class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Js,this.loader=new Ps,this.cache=Cs,this._backgroundLoader=new xs(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized)return void console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.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 e=t.texturePreference?.resolution??1,i="number"==typeof e?[e]:e,r=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,r,s){this.resolver.add(t,e,i,r,s)}async load(t,e){this._initialized||await this.init();const i=ws(t),r=Ts(t).map((t=>{if("string"!=typeof t){const e=this.resolver.getAlias(t);return e.some((t=>!this.resolver.hasKey(t)))&&this.add(t),Array.isArray(e)?e[0]:e}return this.resolver.hasKey(t)||this.add({alias:t,src:t}),t})),s=this.resolver.resolve(r),n=await this._mapLoadToResolve(s,e);return i?n[r[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;"string"==typeof t&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),s={},n=Object.keys(r);let o=0,a=0;const h=()=>{e?.(++o/a)},l=n.map((t=>{const e=r[t];return a+=Object.keys(e).length,this._mapLoadToResolve(e,h).then((e=>{s[t]=e}))}));return await Promise.all(l),i?s[t[0]]:s}
1async 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 Cs.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=Cs.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const s=await this.loader.load(i,e);this._backgroundLoader.active=!0;const n={};return i.forEach(((t,e)=>{const i=s[t.src],o=[t.src];t.alias&&o.push(...t.alias),n[r[e]]=i,Cs.set(o,i)})),n}async unload(t){this._initialized||await this.init();const e=Ts(t).map((t=>"string"!=typeof t?t.src:t)),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ts(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map((t=>this._unloadFromResolved(e[t])));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach((t=>{Cs.remove(t.src)})),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter(((t,i)=>e.indexOf(t)===i)),e}get detections(){return this._detections}get preferWorkers(){return Ys.config.preferWorkers}set preferWorkers(t){S("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((i=>{e.config[i]=t[i]}))}))}};Bt.handleByList(Mt.LoadParser,tn.loader.parsers).handleByList(Mt.ResolveParser,tn.resolver.parsers).handleByList(Mt.CacheParser,tn.cache.parsers).handleByList(Mt.DetectionParser,tn.detections);const en={extension:Mt.CacheParser,test:t=>Array.isArray(t)&&t.every((t=>t instanceof mi)),getCacheableAssets:(t,e)=>{const i={};return t.forEach((t=>{e.forEach(((e,r)=>{i[t+(0===r?"":r+1)]=e}))})),i}};async function rn(t){if("Image"in globalThis)return new Promise((e=>{const i=new Image;i.onload=()=>{e(!0)},i.onerror=()=>{e(!1)},i.src=t}));if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(t)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}Bt.add(en);const sn={extension:{type:Mt.DetectionParser,priority:1},test:async()=>rn("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter((t=>"avif"!==t))};Bt.add(sn);const nn={extension:{type:Mt.DetectionParser,priority:0},test:async()=>rn("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter((t=>"webp"!==t))};Bt.add(nn);const on=["png","jpg","jpeg"],an={extension:{type:Mt.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...on],remove:async t=>t.filter((t=>!on.includes(t)))};Bt.add(an);const hn="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ln(t){return!hn&&""!==document.createElement("video").canPlayType(t)}const un={extension:{type:Mt.DetectionParser,priority:0},test:async()=>ln("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter((t=>"webm"!==t))};Bt.add(un);const cn={extension:{type:Mt.DetectionParser,priority:0},test:async()=>ln("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter((t=>"mp4"!==t&&"m4v"!==t))};Bt.add(cn);const dn={extension:{type:Mt.DetectionParser,priority:0},test:async()=>ln("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter((t=>"ogv"!==t))};Bt.add(dn);
1const fn={extension:Mt.ResolveParser,test:Ys.test,parse:t=>({resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:P.extname(t).slice(1),src:t})};Bt.add(fn);var pn=(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=35987]="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[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t))(pn||{});const mn={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,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let gn,_n;function vn(){_n={s3tc:gn.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:gn.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:gn.getExtension("WEBGL_compressed_texture_etc"),etc1:gn.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:gn.getExtension("WEBGL_compressed_texture_pvrtc")||gn.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:gn.getExtension("WEBGL_compressed_texture_atc"),astc:gn.getExtension("WEBGL_compressed_texture_astc"),bptc:gn.getExtension("EXT_texture_compression_bptc")}}const xn={extension:{type:Mt.DetectionParser,priority:2},test:async()=>{const t=T.ADAPTER.createCanvas().getContext("webgl");return t?(gn=t,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async t=>{_n||vn();const e=[];for(const t in _n)_n[t]&&e.push(t);return[...e,...t]},remove:async t=>(_n||vn(),t.filter((t=>!(t in _n))))};Bt.add(xn);class yn extends Xt{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,r;"string"==typeof t?(i=t,r=new Uint8Array):(i=null,r=t),super(r,e),this.origin=i,this.buffer=r?new Lt(r):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 Lt(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)))),this._load}}class bn extends yn{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=bn._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||bn._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const r=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;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let t=0,e=this.levels;t<e;t++){const{levelID:e,levelWidth:i,levelHeight:s,levelBuffer:n}=this._levelBuffers[t];r.compressedTexImage2D(r.TEXTURE_2D,e,this.format,i,s,0,n)}return!0}onBlobLoaded(){this._levelBuffers=bn._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(36196===t)return"etc1";
1if(35986===t||35987===t||34798===t)return"atc";if(t>=36492&&t<=36495)return"bptc";if(37808===t)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,i,r,s,n,o){const a=new Array(i);let h=t.byteOffset,l=n,u=o,c=l+r-1&~(r-1),d=u+s-1&~(s-1),f=c*d*mn[e];for(let n=0;n<i;n++)a[n]={levelID:n,levelWidth:i>1?l:c,levelHeight:i>1?u:d,levelBuffer:new Uint8Array(t.buffer,h,f)},h+=f,l=l>>1||1,u=u>>1||1,c=l+r-1&~(r-1),d=u+s-1&~(s-1),f=c*d*mn[e];return a}}const Tn=3,En=4,An=7,Sn=19,wn=2,Cn=0,Pn=1,Rn=2,In=3,Mn={827611204:pn.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:pn.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:pn.COMPRESSED_RGBA_S3TC_DXT5_EXT},Dn={70:pn.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:pn.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:pn.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:pn.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:pn.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:pn.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:pn.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:pn.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:pn.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:pn.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:pn.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:pn.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:pn.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};const Fn=[171,75,84,88,32,49,49,187,13,10,26,10],Bn=12,Ln=16,On=24,Nn=28,kn=36,Un=40,Gn=44,zn=48,Hn=52,Xn=56,Vn=60,jn={[u.UNSIGNED_BYTE]:1,[u.UNSIGNED_SHORT]:2,[u.INT]:4,[u.UNSIGNED_INT]:4,[u.FLOAT]:4,[u.HALF_FLOAT]:8},Wn={[h.RGBA]:4,[h.RGB]:3,[h.RG]:2,[h.RED]:1,[h.LUMINANCE]:1,[h.LUMINANCE_ALPHA]:2,[h.ALPHA]:1},$n={[u.UNSIGNED_SHORT_4_4_4_4]:2,[u.UNSIGNED_SHORT_5_5_5_1]:2,[u.UNSIGNED_SHORT_5_6_5]:2};function Yn(t,e,i=!1){const r=new DataView(e);if(!function(t,e){for(let i=0;i<Fn.length;i++)if(e.getUint8(i)!==Fn[i])return console.error(`${t} is not a valid *.ktx file!`),!1;return!0}(t,r))return null;const s=67305985===r.getUint32(Bn,!0),n=r.getUint32(Ln,s),o=r.getUint32(On,s),a=r.getUint32(Nn,s),h=r.getUint32(kn,s),l=r.getUint32(Un,s)||1,c=r.getUint32(Gn,s)||1,d=r.getUint32(zn,s)||1,f=r.getUint32(Hn,s),p=r.getUint32(Xn,s),m=r.getUint32(Vn,s);if(0===l||1!==c)throw new Error("Only 2D textures are supported");if(1!==f)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==d)throw new Error("WebGL does not support array textures");const g=h+3&-4,_=l+3&-4,v=new Array(d);let x,y=h*l;if(0===n&&(y=g*_),x=0!==n?jn[n]?jn[n]*Wn[o]:$n[n]:mn[a],void 0===x)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const b=i?function(t,e,i){const r=new Map;let s=0;for(;s<e;){const n=t.getUint32(64+s,i),o=64+s+4,a=3-(n+3)%4;if(0===n||n>e-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&0!==t.getUint8(o+h);h++);if(-1===h){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=(new TextDecoder).decode(new Uint8Array(t.buffer,o,h)),u=new DataView(t.buffer,o+h+1,n-h-1);r.set(l,u),s+=4+n+a}return r}(r,m,s):null;let T=y*x,E=h,A=l,S=g,w=_,C=64+m;for(let t=0;t<p;t++){const i=r.getUint32(C,s);let o=C+4;for(let i=0;i<d;i++){let r=v[i];r||(r=v[i]=new Array(p)),r[t]={levelID:t,levelWidth:p>1||0!==n?E:S,levelHeight:p>1||0!==n?A:w,levelBuffer:new Uint8Array(e,o,T)},o+=T}C+=i+4,C=C%4!=0?C+4-C%4:C,E=E>>1||1,A=A>>1||1,S=E+4-1&-4,w=A+4-1&-4,T=S*w*x}return 0!==n?{uncompressed:v.map((t=>{let e=t[0].levelBuffer,i=!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?(i=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):n===u.INT&&(i=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new Xt(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:n,format:i?qn(o):o}})),kvData:b}:{compressed:v.map((t=>new bn(null,{format:a,width:h,height:l,levels:p,levelBuffers:t}))),kvData:b}}function qn(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 Kn={extension:{type:Mt.LoadParser,priority:Rs.High},name:"loadDDS",test:t=>bs(t,".dds"),async load(t,e,i){const r=function(t){const e=new Uint32Array(t);if(542327876!==e[0])throw new Error("Invalid DDS file magic word");const i=new Uint32Array(t,0,124/Uint32Array.BYTES_PER_ELEMENT),r=i[Tn],s=i[En],n=i[An],o=new Uint32Array(t,Sn*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),a=o[1];if(4&a){const i=o[wn];if(808540228!==i){const e=Mn[i],o=new Uint8Array(t,128);return[new bn(o,{format:e,width:s,height:r,levels:n})]}const a=128,h=new Uint32Array(e.buffer,a,20/Uint32Array.BYTES_PER_ELEMENT),l=h[Cn],u=h[Pn],c=h[Rn],d=h[In],f=Dn[l];if(void 0===f)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(4===c)throw new Error("DDSParser does not support cubemap textures");if(6===u)throw new Error("DDSParser does not supported 3D texture data");const p=new Array,m=148;if(1===d)p.push(new Uint8Array(t,m));else{const e=mn[f];let i=0,o=s,a=r;for(let t=0;t<n;t++)i+=Math.max(1,o+3&-4)*Math.max(1,a+3&-4)*e,o>>>=1,a>>>=1;let h=m;for(let e=0;e<d;e++)p.push(new Uint8Array(t,h,i)),h+=i}return p.map((t=>new bn(t,{format:f,width:s,height:r,levels:n})))}throw 64&a?new Error("DDSParser does not support uncompressed texture data."):512&a?new Error("DDSParser does not supported YUV uncompressed texture data."):131072&a?new Error("DDSParser does not support single-channel (lumninance) texture data!"):2&a?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!")}(await(await T.ADAPTER.fetch(t)).arrayBuffer()).map((r=>js(new Wt(r,{mipmap:p.OFF,alphaMode:m.NO_PREMULTIPLIED_ALPHA,resolution:It(t),...e.data}),i,t)));return 1===r.length?r[0]:r},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};Bt.add(Kn);const Zn={extension:{type:Mt.LoadParser,priority:Rs.High},name:"loadKTX",test:t=>bs(t,".ktx"),async load(t,e,i){const r=await(await T.ADAPTER.fetch(t)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=Yn(t,r),a=s??n,h={mipmap:p.OFF,alphaMode:m.NO_PREMULTIPLIED_ALPHA,resolution:It(t),...e.data},l=a.map((e=>{a===n&&Object.assign(h,{type:e.type,format:e.format});const r=e.resource??e,s=new Wt(r,h);return s.ktxKeyValueData=o,js(s,i,t)}));return 1===l.length?l[0]:l},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};Bt.add(Zn);const Qn={extension:Mt.ResolveParser,test:t=>{const e=P.extname(t).slice(1);return["basis","ktx","dds"].includes(e)},parse:t=>{const e=P.extname(t).slice(1);if("ktx"===e){const e=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx",".bptc.ktx"];if(e.some((e=>t.endsWith(e))))return{resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e.find((e=>t.endsWith(e))),src:t}}return{resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e,src:t}}};Bt.add(Qn);const Jn=new le,to=class t{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){const t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,r){const s=new Image;return s.src=await this.base64(t,e,i,r),s}async base64(t,e,i,r){const s=this.canvas(t,r);if(void 0!==s.toBlob)return new Promise(((t,r)=>{s.toBlob((e=>{if(!e)return void r(new Error("ICanvas.toBlob failed!"));const i=new FileReader;i.onload=()=>t(i.result),i.onerror=r,i.readAsDataURL(e)}),e,i)}
1));if(void 0!==s.toDataURL)return s.toDataURL(e,i);if(void 0!==s.convertToBlob){const t=await s.convertToBlob({type:e,quality:i});return new Promise(((e,i)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=i,r.readAsDataURL(t)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,i){const{pixels:r,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,i);o&&t._flipY(r,s,n),a&&t._unpremultiplyAlpha(r);const h=new wt(s,n,1),l=new ImageData(new Uint8ClampedArray(r.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(e,i){const{pixels:r,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,i);return o&&t._flipY(r,s,n),a&&t._unpremultiplyAlpha(r),r}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let r,s,n=!1,o=!1,a=!1;t&&(t instanceof gi?s=t:(s=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),a=!0,e&&(Jn.width=e.width,Jn.height=e.height,e=Jn)));const l=i.gl;if(s){if(r=s.baseTexture.resolution,e=e??s.frame,n=!1,o=s.baseTexture.alphaMode>0&&s.baseTexture.format===h.RGBA,!a){i.renderTexture.bind(s);const t=s.framebuffer.glFramebuffers[i.CONTEXT_UID];t.blitFramebuffer&&i.framebuffer.bind(t.blitFramebuffer)}}else r=i.resolution,e||((e=Jn).width=i.width/r,e.height=i.height/r),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(4*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),a&&s?.destroy(!0),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const r=e<<2,s=i>>1,n=new Uint8Array(r);for(let e=0;e<s;e++){const s=e*r,o=(i-e-1)*r;n.set(t.subarray(s,s+r)),t.copyWithin(s,o,o+r),t.set(n,o)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const e=t[i+3];if(0!==e){const r=255.001/e;t[i]=t[i]*r+.5,t[i+1]=t[i+1]*r+.5,t[i+2]=t[i+2]*r+.5}}}};to.extension={name:"extract",type:Mt.RendererSystem};let eo=to;Bt.add(eo);const io={build(t){const e=t.points;let i,r,s,n,o,a;if(t.type===oe.CIRC){const e=t.shape;i=e.x,r=e.y,o=a=e.radius,s=n=0}else if(t.type===oe.ELIP){const e=t.shape;i=e.x,r=e.y,o=e.width,a=e.height,s=n=0}else{const e=t.shape,h=e.width/2,l=e.height/2;i=e.x+h,r=e.y+l,o=a=Math.max(0,Math.min(e.radius,Math.min(h,l))),s=h-o,n=l-a}if(!(o>=0&&a>=0&&s>=0&&n>=0))return void(e.length=0);const h=Math.ceil(2.3*Math.sqrt(o+a)),l=8*h+(s?4:0)+(n?4:0);if(e.length=l,0===l)return;if(0===h)return e.length=8,e[0]=e[6]=i+s,e[1]=e[3]=r+n,e[2]=e[4]=i-s,void(e[5]=e[7]=r-n);let u=0,c=4*h+(s?2:0)+2,d=c,f=l;{const t=s+o,a=n,h=i+t,l=i-t,p=r+a;if(e[u++]=h,e[u++]=p,e[--c]=p,e[--c]=l,n){const t=r-a;e[d++]=l,e[d++]=t,e[--f]=t,e[--f]=h}}for(let t=1;t<h;t++){const l=Math.PI/2*(t/h),p=s+Math.cos(l)*o,m=n+Math.sin(l)*a,g=i+p,_=i-p,v=r+m,x=r-m;e[u++]=g,e[u++]=v,e[--c]=v,e[--c]=_,e[d++]=_,e[d++]=x,e[--f]=x,e[--f]=g}{const t=n+a,o=i+s,h=i-s,l=r+t,c=r-t;e[u++]=o,e[u++]=l,e[--f]=c,e[--f]=o,s&&(e[u++]=h,e[u++]=l,e[--f]=c,e[--f]=h)}},triangulate(t,e){const i=t.points,r=e.points,s=e.indices;if(0===i.length)return;let n=r.length/2;const o=n;let a,h;if(t.type!==oe.RREC){const e=t.shape;a=e.x,h=e.y}else{const e=t.shape;a=e.x+e.width/2,h=e.y+e.height/2}const l=t.matrix;r.push(t.matrix?l.a*a+l.c*h+l.tx:a,t.matrix?l.b*a+l.d*h+l.ty:h),n++,r.push(i[0],i[1]);for(let t=2;t<i.length;t+=2)r.push(i[t],i[t+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function ro(t,e=!1){const i=t.length;if(i<6)return;let r=0;for(let e=0,s=t[i-2],n=t[i-1];e<i;e+=2){const i=t[e],o=t[e+1];r+=(i-s)*(o+n),s=i,n=o}if(!e&&r>0||e&&r<=0){const e=i/2;for(let r=e+e%2;r<i;r+=2){const e=i-r-2,s=i-r-1,n=r,o=r+1;[t[e],t[n]]=[t[n],t[e]],[t[s],t[o]]=[t[o],t[s]]}}}const so={build(t){t.points=t.shape.points.slice()},triangulate(t,i){let r=t.points;const s=t.holes,n=i.points,o=i.indices;if(r.length>=6){ro(r,!1);const t=[];for(let e=0;e<s.length;e++){const i=s[e];ro(i.points,!0),t.push(r.length/2),r=r.concat(i.points)}const i=e(r,t,2);if(!i)return;const a=n.length/2;for(let t=0;t<i.length;t+=3)o.push(i[t]+a),o.push(i[t+1]+a),o.push(i[t+2]+a);for(let t=0;t<r.length;t++)n.push(r[t])}}}
1,no={build(t){const e=t.shape,i=e.x,r=e.y,s=e.width,n=e.height,o=t.points;o.length=0,s>=0&&n>=0&&o.push(i,r,i+s,r,i+s,r+n,i,r+n)},triangulate(t,e){const i=t.points,r=e.points;if(0===i.length)return;const s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},oo={build(t){io.build(t)},triangulate(t,e){io.triangulate(t,e)}};var ao=(t=>(t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t))(ao||{}),ho=(t=>(t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t))(ho||{});const lo={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}};class uo{static curveTo(t,e,i,r,s,n){const o=n[n.length-2],a=n[n.length-1]-e,h=o-t,l=r-e,u=i-t,c=Math.abs(a*u-h*l);if(c<1e-8||0===s)return(n[n.length-2]!==t||n[n.length-1]!==e)&&n.push(t,e),null;const d=a*a+h*h,f=l*l+u*u,p=a*l+h*u,m=s*Math.sqrt(d)/c,g=s*Math.sqrt(f)/c,_=m*p/d,v=g*p/f,x=m*u+g*h,y=m*l+g*a,b=h*(g+_),T=a*(g+_),E=u*(m+v),A=l*(m+v);return{cx:x+t,cy:y+e,radius:s,startAngle:Math.atan2(T-y,b-x),endAngle:Math.atan2(A-y,E-x),anticlockwise:h*l>u*a}}static arc(t,e,i,r,s,n,o,a,h){const l=o-n,u=lo._segmentsCount(Math.abs(l)*s,40*Math.ceil(Math.abs(l)/re)),c=l/(2*u),d=2*c,f=Math.cos(c),p=Math.sin(c),m=u-1,g=m%1/m;for(let t=0;t<=m;++t){const e=c+n+d*(t+g*t),o=Math.cos(e),a=-Math.sin(e);h.push((f*o+p*a)*s+i,(f*-a+p*o)*s+r)}}}class co{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}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 fo{static curveLength(t,e,i,r,s,n,o,a){let h=0,l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,v=0,x=t,y=e;for(let b=1;b<=10;++b)l=b/10,u=l*l,c=u*l,d=1-l,f=d*d,p=f*d,m=p*t+3*f*l*i+3*d*u*s+c*o,g=p*e+3*f*l*r+3*d*u*n+c*a,_=x-m,v=y-g,x=m,y=g,h+=Math.sqrt(_*_+v*v);return h}static curveTo(t,e,i,r,s,n,o){const a=o[o.length-2],h=o[o.length-1];o.length-=2;const l=lo._segmentsCount(fo.curveLength(a,h,t,e,i,r,s,n));let u=0,c=0,d=0,f=0,p=0;o.push(a,h);for(let m=1,g=0;m<=l;++m)g=m/l,u=1-g,c=u*u,d=c*u,f=g*g,p=f*g,o.push(d*a+3*c*g*t+3*u*f*i+p*s,d*h+3*c*g*e+3*u*f*r+p*n)}}function po(t,e,i,r,s,n,o,a){let h,l;o?(h=r,l=-i):(h=-r,l=i);const u=t-i*s+h,c=e-r*s+l,d=t+i*n+h,f=e+r*n+l;return a.push(u,c,d,f),2}function mo(t,e,i,r,s,n,o,a){const h=i-t,l=r-e;let u=Math.atan2(h,l),c=Math.atan2(s-t,n-e);a&&u<c?u+=2*Math.PI:!a&&u>c&&(c+=2*Math.PI);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=1+(15*p*Math.sqrt(m)/Math.PI>>0),_=f/g;if(d+=_,a){o.push(t,e,i,r);for(let i=1,r=d;i<g;i++,r+=_)o.push(t,e,t+Math.sin(r)*m,e+Math.cos(r)*m);o.push(t,e,s,n)}else{o.push(i,r,t,e);for(let i=1,r=d;i<g;i++,r+=_)o.push(t+Math.sin(r)*m,e+Math.cos(r)*m,t,e);o.push(s,n,t,e)}return 2*g}function go(t,e){t.lineStyle.native?function(t,e){let i=0;const r=t.shape,s=t.points||r.points,n=r.type!==oe.POLY||r.closeStroke;if(0===s.length)return;const o=e.points,a=e.indices,h=s.length/2,l=o.length/2;let u=l;for(o.push(s[0],s[1]),i=1;i<h;i++)o.push(s[2*i],s[2*i+1]),a.push(u,u+1),u++;n&&a.push(u,l)}(t,e):function(t,e){const i=t.shape;let r=t.points||i.points.slice();const s=e.closePointEps;if(0===r.length)return;const n=t.lineStyle,o=new ae(r[0],r[1]),a=new ae(r[r.length-2],r[r.length-1]),h=i.type!==oe.POLY||i.closeStroke,l=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){r=r.slice(),l&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));const t=.5*(o.x+a.x),e=.5*(a.y+o.y);r.unshift(t,e),r.push(t,e)}const u=e.points,c=r.length/2;let d=r.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let _=r[0],v=r[1],x=r[2],y=r[3],b=0,T=0,E=-(v-y),A=_-x,S=0,w=0,C=Math.sqrt(E*E+A*A);E/=C,A/=C,E*=p,A*=p;const P=n.alignment,R=2*(1-P),I=2*P;h||(n.cap===ho.ROUND?d+=mo(_-E*(R-I)*.5,v-A*(R-I)*.5,_-E*R,v-A*R,_+E*I,v+A*I,u,!0)+2:n.cap===ho.SQUARE&&(d+=po(_,v,E,A,R,I,!0,u))),u.push(_-E*R,v-A*R,_+E*I,v+A*I);for(let t=1;t<c-1;++t){_=r[2*(t-1)],v=r[2*(t-1)+1],x=r[2*t],y=r[2*t+1],b=r[2*(t+1)],T=r[2*(t+1)+1],E=-(v-y),A=_-x,C=Math.sqrt(E*E+A*A),E/=C,A/=C,E*=p,A*=p,S=-(y-T),w=x-b,C=Math.sqrt(S*S+w*w),S/=C,w/=C,S*=p,w*=p;const e=x-_,i=v-y,s=x-b,o=T-y,a=e*s+i*o,h=i*s-o*e,l=h<0;
1if(Math.abs(h)<.001*Math.abs(a)){u.push(x-E*R,y-A*R,x+E*I,y+A*I),a>=0&&(n.join===ao.ROUND?d+=mo(x,y,x-E*R,y-A*R,x-S*R,y-w*R,u,!1)+4:d+=2,u.push(x-S*I,y-w*I,x+S*R,y+w*R));continue}const c=(-E+_)*(-A+y)-(-E+x)*(-A+v),f=(-S+b)*(-w+y)-(-S+x)*(-w+T),P=(e*f-s*c)/h,M=(o*c-i*f)/h,D=(P-x)*(P-x)+(M-y)*(M-y),F=x+(P-x)*R,B=y+(M-y)*R,L=x-(P-x)*I,O=y-(M-y)*I,N=l?R:I,k=D<=Math.min(e*e+i*i,s*s+o*o)+N*N*m;let U=n.join;if(U===ao.MITER&&D/m>g&&(U=ao.BEVEL),k)switch(U){case ao.MITER:u.push(F,B,L,O);break;case ao.BEVEL:l?u.push(F,B,x+E*I,y+A*I,F,B,x+S*I,y+w*I):u.push(x-E*R,y-A*R,L,O,x-S*R,y-w*R,L,O),d+=2;break;case ao.ROUND:l?(u.push(F,B,x+E*I,y+A*I),d+=mo(x,y,x+E*I,y+A*I,x+S*I,y+w*I,u,!0)+4,u.push(F,B,x+S*I,y+w*I)):(u.push(x-E*R,y-A*R,L,O),d+=mo(x,y,x-E*R,y-A*R,x-S*R,y-w*R,u,!1)+4,u.push(x-S*R,y-w*R,L,O))}else{switch(u.push(x-E*R,y-A*R,x+E*I,y+A*I),U){case ao.MITER:l?u.push(L,O,L,O):u.push(F,B,F,B),d+=2;break;case ao.ROUND:d+=l?mo(x,y,x+E*I,y+A*I,x+S*I,y+w*I,u,!0)+2:mo(x,y,x-E*R,y-A*R,x-S*R,y-w*R,u,!1)+2}u.push(x-S*R,y-w*R,x+S*I,y+w*I),d+=2}}_=r[2*(c-2)],v=r[2*(c-2)+1],x=r[2*(c-1)],y=r[2*(c-1)+1],E=-(v-y),A=_-x,C=Math.sqrt(E*E+A*A),E/=C,A/=C,E*=p,A*=p,u.push(x-E*R,y-A*R,x+E*I,y+A*I),h||(n.cap===ho.ROUND?d+=mo(x-E*(R-I)*.5,y-A*(R-I)*.5,x-E*R,y-A*R,x+E*I,y+A*I,u,!1)+2:n.cap===ho.SQUARE&&(d+=po(x,y,E,A,R,I,!1,u)));const M=e.indices,D=lo.epsilon*lo.epsilon;for(let t=f;t<d+f-2;++t)_=u[2*t],v=u[2*t+1],x=u[2*(t+1)],y=u[2*(t+1)+1],b=u[2*(t+2)],T=u[2*(t+2)+1],!(Math.abs(_*(y-T)+x*(T-v)+b*(v-y))<D)&&M.push(t,t+1,t+2)}(t,e)}class _o{static curveLength(t,e,i,r,s,n){const o=t-2*i+s,a=e-2*r+n,h=2*i-2*t,l=2*r-2*e,u=4*(o*o+a*a),c=4*(o*h+a*l),d=h*h+l*l,f=2*Math.sqrt(u+c+d),p=Math.sqrt(u),m=2*u*p,g=2*Math.sqrt(d),_=c/p;return(m*f+p*c*(f-g)+(4*d*u-c*c)*Math.log((2*p+_+f)/(_+g)))/(4*m)}static curveTo(t,e,i,r,s){const n=s[s.length-2],o=s[s.length-1],a=lo._segmentsCount(_o.curveLength(n,o,t,e,i,r));let h=0,l=0;for(let u=1;u<=a;++u){const c=u/a;h=n+(t-n)*c,l=o+(e-o)*c,s.push(h+(t+(i-t)*c-h)*c,l+(e+(r-e)*c-l)*c)}}}const vo={[oe.POLY]:so,[oe.CIRC]:io,[oe.ELIP]:io,[oe.RECT]:no,[oe.RREC]:oo},xo=[],yo=[];class bo{constructor(t,e=null,i=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new bo(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const To=new ae,Eo=class t extends ie{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Br,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),yo.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),xo.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,r=null){const s=new bo(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new bo(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let i=0;i<e.length;++i){const r=e[i];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,To):To.copyFrom(t),r.shape.contains(To.x,To.y))){let t=!1;if(r.holes)for(let e=0;e<r.holes.length;e++)if(r.holes[e].shape.contains(To.x,To.y)){t=!0;break}if(!t)return!0}}return!1}updateBatches(){if(!this.graphicsData.length)return void(this.batchable=!0);if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,r=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],r=i.style);for(let s=this.shapeIndex;s<e.length;s++){this.shapeIndex++;const n=e[s],o=n.fillStyle,a=n.lineStyle;vo[n.type].build(n),n.matrix&&this.transformPoints(n.points,n.matrix),(o.visible||a.visible)&&this.processHoles(n.holes);for(let e=0;e<2;e++){const s=0===e?o:a;if(!s.visible)continue;const h=s.texture.baseTexture,l=this.indices.length,u=this.points.length/2;h.wrapMode=f.REPEAT,0===e?this.processFill(n):this.processLine(n);const c=this.points.length/2-u;0!==c&&(i&&!this._compareStyles(r,s)&&(i.end(l,u),i=null),i||(i=xo.pop()||new co,i.begin(s,l,u),this.batches.push(i),r=s),this.addUvs(this.points,t,s.texture,u,c,s.matrix))}}const s=this.indices.length,n=this.points.length/2;if(i&&i.end(s,n),0===this.batches.length)return void(this.batchable=!0);const o=n>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?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;t<e;t++){const e=this.graphicsData[t],i=e.fillStyle,r=e.lineStyle;if(i&&!i.texture.baseTexture.valid||r&&!r.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const i=t[e];for(let t=0;t<i.size;t++){const e=i.start+t;this.indicesUint16[e]=this.indicesUint16[e]-i.attribStart}}}isBatchable(){if(this.points.length>131070)return!1;const e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<2*t.BATCHABLE_SIZE}buildDrawCalls(){let t=++Wt._globalBatch;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),yo.push(this.drawCalls[t]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let r=yo.pop();r||(r=new $t,r.texArray=new Qe),r.texArray.count=0,r.start=0,r.size=0,r.type=a.TRIANGLES;let s=0,n=null,o=0,h=!1,l=a.TRIANGLES,u=0;this.drawCalls.push(r);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],p=8,m=d.style,g=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?a.LINES:a.TRIANGLES,n=null,s=p,t++),n!==g&&(n=g,g._batchEnabled!==t&&(s===p&&(t++,s=0,r.size>0&&(r=yo.pop(),r||(r=new $t,r.texArray=new Qe),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),g.touched=1,g._batchEnabled=t,g._batchLocation=s,g.wrapMode=f.REPEAT,r.texArray.elements[r.texArray.count++
1]=g,s++)),r.size+=d.size,u+=d.size,o=g._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,o,d.attribSize,d.attribStart)}Wt._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(3*t.length*4),n=new Float32Array(s),o=new Uint32Array(s);let a=0;for(let s=0;s<t.length/2;s++)n[a++]=t[2*s],n[a++]=t[2*s+1],n[a++]=e[2*s],n[a++]=e[2*s+1],o[a++]=i[s],n[a++]=r[s];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?so.triangulate(t,this):vo[t.type].triangulate(t,this)}processLine(t){go(t,this);for(let e=0;e<t.holes.length;e++)go(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];vo[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){const r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}}addColors(t,e,i,r,s=0){const n=ot.shared.setValue(e).toLittleEndianNumber(),o=ot.shared.setValue(n).toPremultiplied(i);t.length=Math.max(t.length,s+r);for(let e=0;e<r;e++)t[s+e]=o}addTextureIds(t,e,i,r=0){t.length=Math.max(t.length,r+i);for(let s=0;s<i;s++)t[r+s]=e}addUvs(t,e,i,r,s,n=null){let o=0;const a=e.length,h=i.frame;for(;o<s;){let i=t[2*(r+o)],s=t[2*(r+o)+1];if(n){const t=n.a*i+n.c*s+n.tx;s=n.b*i+n.d*s+n.ty,i=t}o++,e.push(i/h.width,s/h.height)}const l=i.baseTexture;(h.width<l.width||h.height<l.height)&&this.adjustUvs(e,i,a,s)}adjustUvs(t,e,i,r){const s=e.baseTexture,n=1e-6,o=i+2*r,a=e.frame,h=a.width/s.width,l=a.height/s.height;let u=a.x/a.width,c=a.y/a.height,d=Math.floor(t[i]+n),f=Math.floor(t[i+1]+n);for(let e=i+2;e<o;e+=2)d=Math.min(d,Math.floor(t[e]+n)),f=Math.min(f,Math.floor(t[e+1]+n));u-=d,c-=f;for(let e=i;e<o;e+=2)t[e]=(t[e]+u)*h,t[e+1]=(t[e+1]+c)*l}};Eo.BATCHABLE_SIZE=100;let Ao=Eo;class So{constructor(){this.color=16777215,this.alpha=1,this.texture=mi.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new So;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=mi.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class wo extends So{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=ho.BUTT,this.join=ao.MITER,this.miterLimit=10}clone(){const t=new wo;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=ho.BUTT,this.join=ao.MITER,this.miterLimit=10}}const Co={},Po=class t extends Gr{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new So,this._lineStyle=new wo,this._matrix=null,this._holeMode=!1,this.state=kt.for2d(),this._geometry=t||new Ao,this._geometry.refCount++,this._transformID=-1,this._tintColor=new ot(16777215),this.blendMode=o.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new t(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,r=.5,s=!1){return"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:s}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:mi.WHITE,color:t?.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:ho.BUTT,join:ao.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();
1const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new de,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new de,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 i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return(r!==t||s!==e)&&i.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,i,r){this._initCurve();const s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),_o.curveTo(t,e,i,r,s),this}bezierCurveTo(t,e,i,r,s,n){return this._initCurve(),fo.curveTo(t,e,i,r,s,n,this.currentPath.points),this}arcTo(t,e,i,r,s){this._initCurve(t,e);const n=this.currentPath.points,o=uo.curveTo(t,e,i,r,s,n);if(o){const{cx:t,cy:e,radius:i,startAngle:r,endAngle:s,anticlockwise:n}=o;this.arc(t,e,i,r,s,n)}return this}arc(t,e,i,r,s,n=!1){if(r===s)return this;if(!n&&s<=r?s+=re:n&&r<=s&&(r+=re),s-r==0)return this;const o=t+Math.cos(r)*i,a=e+Math.sin(r)*i,h=this._geometry.closePointEps;let l=this.currentPath?this.currentPath.points:null;if(l){const t=Math.abs(l[l.length-2]-o),e=Math.abs(l[l.length-1]-a);t<h&&e<h||l.push(o,a)}else this.moveTo(o,a),l=this.currentPath.points;return uo.arc(o,a,t,e,i,r,s,n,l),this}beginFill(t=0,e){return this.beginTextureFill({texture:mi.WHITE,color:t,alpha:e})}normalizeColor(t){const e=ot.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:mi.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,r){return this.drawShape(new le(t,e,i,r))}drawRoundedRect(t,e,i,r,s){return this.drawShape(new fe(t,e,i,r,s))}drawCircle(t,e,i){return this.drawShape(new ue(t,e,i))}drawEllipse(t,e,i,r){return this.drawShape(new ce(t,e,i,r))}drawPolygon(...t){let e,i=!0;const r=t[0];r.points?(i=r.closeStroke,e=r.points):e=Array.isArray(t[0])?t[0]:t;const s=new de(e);return s.closeStroke=i,this.drawShape(s),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!==oe.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,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let r=0;r<i;r++){const i=t.batches[r],s=i.style.color,n=new Float32Array(this.vertexData.buffer,4*i.attribStart*2,2*i.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*i.attribStart*2,2*i.attribSize),a={vertexData:n,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*i.start,i.size),uvs:o,_batchRGB:ot.shared.setValue(s).toRgbArray(),_tintRGB:s,_texture:i.style.texture,alpha:i.style.alpha,worldAlpha:1};this.batches[r]=a}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const i=this.batches[e];i.worldAlpha=this.worldAlpha*i.alpha,t.plugins[this.pluginName].render(i)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,r=this.worldAlpha,s=e.uniforms,n=i.drawCalls;s.translationMatrix=this.transform.worldTransform,ot.shared.setValue(this._tintColor).premultiply(r).toArray(s.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let e=0,r=n.length;e<r;e++)this._renderDrawCallDirect(t,i.drawCalls[e])}_renderDrawCallDirect(t,e){const{texArray:i,type:r,size:s,start:n}=e,o=i.count;for(let e=0;e<o;e++)t.texture.bind(i.elements[e],e);t.geometry.draw(r,s,n)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Co[i]){const{maxTextures:e}=t.plugins[i],r=new Int32Array(e);for(let t=0;t<e;t++)r[t]=t;const s={tint:new Float32Array([1,1,1,1]),translationMatrix:new pe,default:qe.from({uSamplers:r},!0)},n=t.plugins[i]._shader.program;Co[i]=new Ke(n,s)}e=Co[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:r,maxY:s}=t.bounds;this._bounds.addFrame(this.transform,e,i,r,s)}containsPoint(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=ot.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,n=e.d,o=e.tx,a=e.ty,h=this._geometry.points,l=this.vertexData;let u=0;for(let t=0;t<h.length;t+=2){const e=h[t],c=h[t+1];l[u++]=i*e+s*c+o,l[u++]=n*c+r*e+a}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,
1super.destroy(t)}};Po.curves=lo,Po._TEMP_POINT=new ae;let Ro=Po;class Io{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const Mo=new ae,Do=new de,Fo=class t extends Gr{constructor(t,e,i,r=a.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||kt.for2d(),this.drawMode=r,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=T.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(e){const i=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===a.TRIANGLES&&i.length<2*t.BATCHABLE_SIZE?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const r=this.transform.worldTransform,s=r.a,n=r.b,o=r.c,a=r.d,h=r.tx,l=r.ty,u=this.vertexData;for(let t=0;t<u.length/2;t++){const i=e[2*t],r=e[2*t+1];u[2*t]=s*i+o*r+h,u[2*t+1]=n*i+a*r+l}if(this._roundPixels){const t=T.RESOLUTION;for(let e=0;e<u.length;++e)u[e]=Math.round(u[e]*t)/t}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Io(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Mo);const e=this.geometry.getBuffer("aVertexPosition").data,i=Do.points,r=this.geometry.getIndex().data,s=r.length,n=4===this.drawMode?3:1;for(let t=0;t+2<s;t+=n){const s=2*r[t],n=2*r[t+1],o=2*r[t+2];if(i[0]=e[s],i[1]=e[s+1],i[2]=e[n],i[3]=e[n+1],i[4]=e[o],i[5]=e[o+1],Do.contains(Mo.x,Mo.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Fo.BATCHABLE_SIZE=100;let Bo=Fo;class Lo extends ee{constructor(t,e,i){super();const r=new qt(t),s=new qt(e,!0),n=new qt(i,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,u.FLOAT).addAttribute("aTextureCoord",s,2,!1,u.FLOAT).addIndex(n),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}class Oo extends Ke{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:pe.IDENTITY,uColor:new Float32Array([1,1,1,1])};
1(e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e)).uniforms&&Object.assign(i,e.uniforms),super(e.program||$e.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying 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 = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),i),this._colorDirty=!1,this.uvMatrix=new Ii(t),this.batchable=void 0===e.program,this.pluginName=e.pluginName,this._tintColor=new ot(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;ot.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class No extends Lo{constructor(t=200,e,i=0){super(new Float32Array(4*e.length),new Float32Array(4*e.length),new Uint16Array(6*(e.length-1))),this.points=e,this._width=t,this.textureScale=i,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));const s=i.data,n=r.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let o=0,a=t[0];const h=this._width*this.textureScale,l=t.length;for(let e=0;e<l;e++){const i=4*e;if(this.textureScale>0){const i=a.x-t[e].x,r=a.y-t[e].y,s=Math.sqrt(i*i+r*r);a=t[e],o+=s/h}else o=e/(l-1);s[i]=o,s[i+1]=0,s[i+2]=o,s[i+3]=1}let u=0;for(let t=0;t<l-1;t++){const e=2*t;n[u++]=e,n[u++]=e+1,n[u++]=e+2,n[u++]=e+2,n[u++]=e+1,n[u++]=e+3}i.update(),r.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e,i=t[0],r=0,s=0;const n=this.buffers[0].data,o=t.length,a=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let h=0;h<o;h++){const o=t[h],l=4*h;e=h<t.length-1?t[h+1]:o,s=-(e.x-i.x),r=e.y-i.y;const u=Math.sqrt(r*r+s*s);u<1e-6?(r=0,s=0):(r/=u,s/=u,r*=a,s*=a),n[l]=o.x+r,n[l+1]=o.y+s,n[l+2]=o.x-r,n[l+3]=o.y-s,i=o}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class ko extends Bo{constructor(t,e,i=0){const r=new No(t.height,e,i),s=new Oo(t);i>0&&(t.baseTexture.wrapMode=f.REPEAT),super(r,s),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)}}class Uo{constructor(t,e,i){this.geometry=new ee,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let i=0;i<t.length;++i){let r=t[i];r={attributeName:r.attributeName,size:r.size,uploadFunction:r.uploadFunction,type:r.type||u.FLOAT,offset:r.offset},e[i]?this.dynamicProperties.push(r):this.staticProperties.push(r)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new qt(function(t,e=null){const i=6*t;if((e=e||new Uint16Array(i)).length!==i)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${i}`);for(let t=0,r=0;t<i;
1t+=6,r+=4)e[t+0]=r+0,e[t+1]=r+1,e[t+2]=r+2,e[t+3]=r+0,e[t+4]=r+2,e[t+5]=r+3;return e}(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let t=0;t<this.dynamicProperties.length;++t){const i=this.dynamicProperties[t];i.offset=e,e+=i.size,this.dynamicStride+=i.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new qt(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let t=0;t<this.staticProperties.length;++t){const e=this.staticProperties[t];e.offset=r,r+=e.size,this.staticStride+=e.size}const s=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new qt(this.staticData,!0,!1);for(let e=0;e<this.dynamicProperties.length;++e){const i=this.dynamicProperties[e];t.addAttribute(i.attributeName,this.dynamicBuffer,0,i.type===u.UNSIGNED_BYTE,i.type,4*this.dynamicStride,4*i.offset)}for(let e=0;e<this.staticProperties.length;++e){const i=this.staticProperties[e];t.addAttribute(i.attributeName,this.staticBuffer,0,i.type===u.UNSIGNED_BYTE,i.type,4*this.staticStride,4*i.offset)}}uploadDynamic(t,e,i){for(let r=0;r<this.dynamicProperties.length;r++){const s=this.dynamicProperties[r];s.uploadFunction(t,e,i,s.type===u.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let r=0;r<this.staticProperties.length;r++){const s=this.staticProperties[r];s.uploadFunction(t,e,i,s.type===u.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}class Go extends Je{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new pe,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:u.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ke.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n    float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n    float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n    vec2 v = vec2(x, y);\n    v = v + aPositionCoord;\n\n    gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n    vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n    gl_FragColor = color;\n}",{}),this.state=kt.for2d()}render(t){const e=t.children,i=t._maxSize,r=t._batchSize,s=this.renderer;let n=e.length;if(0===n)return;n>i&&!t.autoResize&&(n=i);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const a=e[0]._texture.baseTexture,h=a.alphaMode>0;this.state.blendMode=dt(t.blendMode,h),s.state.set(this.state);const l=s.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(s.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=ot.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);let c=!1;for(let i=0,a=0;i<n;i+=r,a+=1){let h=n-i;h>r&&(h=r),a>=o.length&&o.push(this._generateOneMoreBuffer(t));const u=o[a];u.uploadDynamic(e,i,h);const d=t._bufferUpdateIDs[a]||0;c=c||u._updateID<d,c&&(u._updateID=t._updateID,u.uploadStatic(e,i,h)),s.geometry.bind(u.geometry),l.drawElements(l.TRIANGLES,6*h,l.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,r=t._batchSize,s=t._properties;for(let t=0;t<i;t+=r)e.push(new Uo(this.properties,s,r));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new Uo(this.properties,i,e)}uploadVertices(t,e,i,r,s,n){let o=0,a=0,h=0,l=0;for(let u=0;u<i;++u){const i=t[e+u],c=i._texture,d=i.scale.x,f=i.scale.y,p=c.trim,m=c.orig;p?(a=p.x-i.anchor.x*m.width,o=a+p.width,l=p.y-i.anchor.y*m.height,h=l+p.height):(o=m.width*(1-i.anchor.x),a=m.width*-i.anchor.x,h=m.height*(1-i.anchor.y),l=m.height*-i.anchor.y),r[n]=a*d,r[n+1]=l*f,r[n+s]=o*d,r[n+s+1]=l*f,r[n+2*s]=o*d,r[n+2*s+1]=h*f,r[n+3*s]=a*d,r[n+3*s+1]=h*f,n+=4*s}}
1uploadPosition(t,e,i,r,s,n){for(let o=0;o<i;o++){const i=t[e+o].position;r[n]=i.x,r[n+1]=i.y,r[n+s]=i.x,r[n+s+1]=i.y,r[n+2*s]=i.x,r[n+2*s+1]=i.y,r[n+3*s]=i.x,r[n+3*s+1]=i.y,n+=4*s}}uploadRotation(t,e,i,r,s,n){for(let o=0;o<i;o++){const i=t[e+o].rotation;r[n]=i,r[n+s]=i,r[n+2*s]=i,r[n+3*s]=i,n+=4*s}}uploadUvs(t,e,i,r,s,n){for(let o=0;o<i;++o){const i=t[e+o]._texture._uvs;i?(r[n]=i.x0,r[n+1]=i.y0,r[n+s]=i.x1,r[n+s+1]=i.y1,r[n+2*s]=i.x2,r[n+2*s+1]=i.y2,r[n+3*s]=i.x3,r[n+3*s+1]=i.y3,n+=4*s):(r[n]=0,r[n+1]=0,r[n+s]=0,r[n+s+1]=0,r[n+2*s]=0,r[n+2*s+1]=0,r[n+3*s]=0,r[n+3*s+1]=0,n+=4*s)}}uploadTint(t,e,i,r,s,n){for(let o=0;o<i;++o){const i=t[e+o],a=ot.shared.setValue(i._tintRGB).toPremultiplied(i.alpha,i.texture.baseTexture.alphaMode>0);r[n]=a,r[n+s]=a,r[n+2*s]=a,r[n+3*s]=a,n+=4*s}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Go.extension={name:"particle",type:Mt.RendererPlugin},Bt.add(Go);var zo=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))(zo||{});const Ho={willReadFrequently:!0},Xo=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0!==e){const i=T.ADAPTER.getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return e}constructor(t,e,i,r,s,n,o,a,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=s,this.lineWidths=n,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=h}static measureText(e,i,r,s=t._canvas){r=r??i.wordWrap;const n=i.toFontString(),o=t.measureFont(n);0===o.fontSize&&(o.fontSize=i.fontSize,o.ascent=i.fontSize);const a=s.getContext("2d",Ho);a.font=n;const h=(r?t.wordWrap(e,i,s):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let e=0;e<h.length;e++){const r=t._measureText(h[e],i.letterSpacing,a);l[e]=r,u=Math.max(u,r)}let c=u+i.strokeThickness;i.dropShadow&&(c+=i.dropShadowDistance);const d=i.lineHeight||o.fontSize+i.strokeThickness;let f=Math.max(d,o.fontSize+2*i.strokeThickness)+i.leading+(h.length-1)*(d+i.leading);return i.dropShadow&&(f+=i.dropShadowDistance),new t(e,i,c,f,h,l,d+i.leading,u,o)}static _measureText(e,i,r){let s=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(r.letterSpacing=`${i}px`,r.textLetterSpacing=`${i}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let n=r.measureText(e).width;return n>0&&(s?n-=i:n+=(t.graphemeSegmenter(e).length-1)*i),n}static wordWrap(e,i,r=t._canvas){const s=r.getContext("2d",Ho);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=i,c=t.collapseSpaces(u),d=t.collapseNewlines(u);let f=!c;const p=i.wordWrapWidth+l,m=t.tokenize(e);for(let e=0;e<m.length;e++){let r=m[e];if(t.isNewline(r)){if(!d){a+=t.addLine(o),f=!c,o="",n=0;continue}r=" "}if(c){const e=t.isBreakingSpace(r),i=t.isBreakingSpace(o[o.length-1]);if(e&&i)continue}const u=t.getFromCache(r,l,h,s);if(u>p)if(""!==o&&(a+=t.addLine(o),o="",n=0),t.canBreakWords(r,i.breakWords)){const e=t.wordWrapSplit(r);for(let u=0;u<e.length;u++){let c=e[u],d=c,m=1;for(;e[u+m];){const s=e[u+m];if(t.canBreakChars(d,s,r,u,i.breakWords))break;c+=s,d=s,m++}u+=m-1;const g=t.getFromCache(c,l,h,s);g+n>p&&(a+=t.addLine(o),f=!1,o="",n=0),o+=c,n+=g}}else{o.length>0&&(a+=t.addLine(o),o="",n=0);const i=e===m.length-1;a+=t.addLine(r,!i),f=!1,o="",n=0}else u+n>p&&(f=!1,a+=t.addLine(o),o="",n=0),(o.length>0||!t.isBreakingSpace(r)||f)&&(o+=r,n+=u)}return a+=t.addLine(o,!1),a}static addLine(e,i=!0){return e=t.trimRight(e),e=i?`${e}\n`:e}static getFromCache(e,i,r,s){let n=r[e];return"number"!=typeof n&&(n=t._measureText(e,i,s)+i,r[e]=n),n}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(e){if("string"!=typeof e)return"";for(let i=e.length-1;i>=0;i--){const r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e}static isNewline(e){return"string"==typeof e&&t._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,i){return"string"==typeof e&&t._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const i=[];let r="";if("string"!=typeof e)return i;for(let s=0;s<e.length;s++){const n=e[s],o=e[s+1];t.isBreakingSpace(n,o)||t.isNewline(n)?(""!==r&&(i.push(r),r=""),i.push(n)):r+=n}return""!==r&&i.push(r),i}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,s){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];const i={ascent:0,descent:0,fontSize:0},r=t._canvas,s=t._context;s.font=e;const n=t.METRICS_STRING+t.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(t.BASELINE_SYMBOL).width);const h=Math.ceil(t.HEIGHT_MULTIPLIER*a);if(a=a*t.BASELINE_MULTIPLIER|0,0===o||0===h)return t._fonts[e]=i,i;r.width=o,r.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,u=l.length,c=4*o;let d=0,f=0,p=!1;for(d=0;d<a;++d){for(let t=0;t<c;t+=4)if(255!==l[f+t]){p=!0;break}if(p)break;f+=c}for(i.ascent=a-d,f=u-c,p=!1,d=h;d>a;--d){for(let t=0;t<c;t+=4)if(255!==l[f+t]){p=!0;break}if(p)break;f-=c}return i.descent=d-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if(i.getContext("2d",Ho)?.measureText)return t.__canvas=i,i;e=T.ADAPTER.createCanvas()}catch{e=T.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",Ho)),t.__context}};Xo.METRICS_STRING="|ÉqÅ",Xo.BASELINE_SYMBOL="M",Xo.BASELINE_MULTIPLIER=1.4,Xo.HEIGHT_MULTIPLIER=2,Xo.graphemeSegmenter=(()=>
1{if("function"==typeof Intl?.Segmenter){const t=new Intl.Segmenter;return e=>[...t.segment(e)].map((t=>t.segment))}return t=>[...t]})(),Xo.experimentalLetterSpacing=!1,Xo._fonts={},Xo._newlines=[10,13],Xo._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Vo=Xo;const jo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Wo=class t{constructor(t){this.styleID=0,this.reset(),qo(this,t,t)}clone(){const e={};return qo(e,this,t.defaultStyle),new t(e)}reset(){qo(this,t.defaultStyle,t.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=Yo(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=Yo(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 i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Yo(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t="number"==typeof this.fontSize?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let t=e.length-1;t>=0;t--){let i=e[t].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!jo.includes(i)&&(i=`"${i}"`),e[t]=i}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Wo.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:zo.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};let $o=Wo;function Yo(t){const e=ot.shared,i=t=>{const i=e.setValue(t);return 1===i.alpha?i.toHex():i.toRgbaString()};return Array.isArray(t)?t.map(i):i(t)}function qo(t,e,i){for(const r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}const Ko={texture:!0,children:!1,baseTexture:!0},Zo=class t extends Xr{constructor(e,i,r){let s=!1;r||(r=T.ADAPTER.createCanvas(),s=!0),r.width=3,r.height=3;const n=mi.from(r);n.orig=new le,n.trim=new le,super(n),this._ownCanvas=s,this.canvas=r,this.context=r.getContext("2d",{willReadFrequently:!0}),this._resolution=t.defaultResolution??T.RESOLUTION,this._autoResolution=t.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=i,this.localStyleID=-1}static get experimentalLetterSpacing(){return Vo.experimentalLetterSpacing}static set experimentalLetterSpacing(t){S("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Vo.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 i=this.context,r=Vo.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),s=r.width,n=r.height,o=r.lines,a=r.lineHeight,h=r.lineWidths,l=r.maxLineWidth,u=r.fontProperties;let c,d;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,s)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,n)+2*e.padding)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;const f=e.dropShadow?2:1;for(let t=0;t<f;++t){const s=e.dropShadow&&0===t,f=s?Math.ceil(Math.max(1,n)+2*e.padding):0,p=f*this._resolution;if(s){i.fillStyle="black",i.strokeStyle="black";const t=e.dropShadowColor,r=e.dropShadowBlur*this._resolution,s=e.dropShadowDistance*this._resolution;i.shadowColor=ot.shared.setValue(t).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=r,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*s,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*s+p}else i.fillStyle=this._generateFillStyle(e,o,r),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let m=(a-u.fontSize)/2;a-u.fontSize<0&&(m=0);for(let t=0;t<o.length;t++)c=e.strokeThickness/2,d=e.strokeThickness/2+t*a+u.ascent+m,"right"===e.align?c+=l-h[t]:"center"===e.align&&(c+=(l-h[t])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(o[t],c+e.padding,d+e.padding-f,!0),e.fill&&this.drawLetterSpacing(o[t],c+e.padding,d+e.padding-f)}this.updateTexture()}drawLetterSpacing(t,e,i,r=!1){const s=this._style.letterSpacing;let n=!1;if(Vo.experimentalLetterSpacingSupported&&(Vo.experimentalLetterSpacing?(this.context.letterSpacing=`${s}px`,this.context.textLetterSpacing=`${s}px`,n=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),0===s||n)return void(r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i));let o=e;const a=Vo.graphemeSegmenter(t);let h=this.context.measureText(t).width,l=0;for(let t=0;t<a.length;++t){const e=a[t];r?this.context.strokeText(e,o,i):this.context.fillText(e,o,i);let n="";for(let e=t+1;e<a.length;++e)n+=a[e];l=this.context.measureText(n).width,o+=h-l+s,h=l}}updateTexture(){const t=this.canvas;if(this._style.trim){const e=Rt(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}const e=this._texture,i=this._style,r=i.trim?0:i.padding,s=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,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(),s.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),-1===this._textureID&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){const r=t.fill;if(!Array.isArray(r))return r;if(1===r.length)return r[0];let s;const n=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,a=this.canvas.width/this._resolution-n-2*o,h=this.canvas.height/this._resolution-n-2*o,l=r.slice(),u=t.fillGradientStops.slice();if(!u.length){const t=l.length+1;for(let e=1;e<t;++e)u.push(e/t)}if(l.unshift(r[0]),u.unshift(0),l.push(r[r.length-1]),u.push(1),t.fillGradientType===zo.LINEAR_VERTICAL){s=this.context.createLinearGradient(a/2,o,a/2,h+o);const r=i.fontProperties.fontSize+t.strokeThickness;for(let t=0;t<e.length;t++){const n=i.lineHeight*(t-1)+r,o=i.lineHeight*t;let a=o;t>0&&n>o&&(a=(o+n)/2);const c=o+r,d=i.lineHeight*(t+1);let f=c;t+1<e.length&&d<c&&(f=(c+d)/2);const p=(f-a)/h;for(let t=0;t<l.length;t++){let e=0;e="number"==typeof u[t]?u[t]:t/l.length;let i=Math.min(1,Math.max(0,a/h+e*p));i=Number(i.toFixed(5)),s.addColorStop(i,l[t])}}}else{s=this.context.createLinearGradient(o,h/2,a+o,h/2);const t=l.length+1;let e=1;for(let i=0;i<l.length;i++){let r;r="number"==typeof u[i]?u[i]:e/t,s.addColorStop(r,l[i]),e++}}return s}destroy(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},Ko,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=vt(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=vt(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},this._style=t instanceof $o?t:new $o(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(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)}};Zo.defaultAutoResolution=!0;let Qo=Zo;class Jo{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function ta(t,e){let i=!1;if(t?._textures?.length)for(let r=0;r<t._textures.length;r++)if(t._textures[r]instanceof mi){const s=t._textures[r].baseTexture;e.includes(s)||(e.push(s),i=!0)}return i}function ea(t,e){if(t.baseTexture instanceof Wt){const i=t.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function ia(t,e){if(t._texture&&t._texture instanceof mi){const i=t._texture.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function ra(t,e){return e instanceof Qo&&(e.updateText(!0),!0)}function sa(t,e){if(e instanceof $o){const t=e.toFontString();return Vo.measureFont(t),!0}return!1}function na(t,e){if(t instanceof Qo){e.includes(t.style)||e.push(t.style),e.includes(t)||e.push(t);const i=t._texture.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function oa(t,e){return t instanceof $o&&(e.includes(t)||e.push(t),!0)}const aa=class t{constructor(e){this.limiter=new Jo(t.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(na),this.registerFindHook(oa),this.registerFindHook(ta),this.registerFindHook(ea),this.registerFindHook(ia),this.registerUploadHook(ra),this.registerUploadHook(sa)}upload(t){return new Promise((e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,gr.system.addOnce(this.tick,this,fr.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 i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)gr.system.addOnce(this.tick,this,fr.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Gr)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&gr.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}};aa.uploadsPerFrame=4;let ha=aa;function la(t,e){return e instanceof Wt&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function ua(t,e){if(!(e instanceof Ro))return!1;const{geometry:i}=e;e.finishPoly(),i.updateBatches();const{batches:r}=i;for(let e=0;e<r.length;e++){const{texture:i}=r[e].style;i&&la(t,i.baseTexture)}return i.batchable||t.geometry.bind(i,e._resolveDirectShader(t)),!0}function ca(t,e){return t instanceof Ro&&(e.push(t),!0)}Object.defineProperties(T,{UPLOADS_PER_FRAME:{get:()=>ha.uploadsPerFrame,set(t){S("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),ha.uploadsPerFrame=t}}});class da extends ha{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(ca),this.registerUploadHook(la),this.registerUploadHook(ua)}}da.extension={name:"prepare",type:Mt.RendererSystem},Bt.add(da);class fa extends Xr{constructor(t,e=!0){super(t[0]instanceof mi?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&&(gr.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(gr.shared.add(this.update,this,fr.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,i=this.currentFrame;if(null!==this._durations){let i=this._currentTime%1*this._durations[this.currentFrame];for(i+=e/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];const r=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.cur
1rentFrame]*r,this._currentTime+=r;this._currentTime+=i/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()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i||this.animationSpeed<0&&this.currentFrame>i)&&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 i=0;i<t.length;++i)e.push(mi.from(t[i]));return new fa(e)}static fromImages(t){const e=[];for(let i=0;i<t.length;++i)e.push(mi.from(t[i]));return new fa(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof mi)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.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?(gr.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(gr.shared.add(this.update,this),this._isConnectedToTicker=!0))}}new ae;var pa="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";const ma=new pe;class ga extends Je{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new xi,this.state=kt.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ke.from(pa,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n    vec4 texSample = texture2D(uSampler, vTextureCoord);\n    gl_FragColor = texSample * uColor;\n}\n",e),this.shader=t.context.webGLVersion>1?Ke.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):Ke.from(pa,"#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,i=this.quad;let r=i.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const s=t.uvRespectAnchor?t.anchor.x:0,n=t.uvRespectAnchor?t.anchor.y:0;r=i.uvs,r[0]=r[6]=-s,r[1]=r[3]=-n,r[2]=r[4]=1-s,r[5]=r[7]=1-n,i.invalidate();const o=t._texture,a=o.baseTexture,h=a.alphaMode>0,l=t.tileTransform.localTransform,u=t.uvMatrix;let c=a.isPowerOfTwo&&o.frame.width===a.width&&o.frame.height===a.height;c&&(a._glTextures[e.CONTEXT_UID]?c=a.wrapMode!==f.CLAMP:a.wrapMode===f.CLAMP&&(a.wrapMode=f.REPEAT));const d=c?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,_=t._height;ma.set(l.a*p/g,l.b*p/_,l.c*m/g,l.d*m/_,l.tx/g,l.ty/_),ma.invert(),c?ma.prepend(u.mapCoord):(d.uniforms.uMapCoord=u.mapCoord.toArray(!0),d.uniforms.uClampFrame=u.uClampFrame,d.uniforms.uClampOffset=u.uClampOffset),d.uniforms.uTransform=ma.toArray(!0),d.uniforms.uColor=ot.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(d.uniforms.uColor),d.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),d.uniforms.uSampler=o,e.shader.bind(d),e.geometry.bind(i),this.state.blendMode=dt(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}ga.extension={name:"tilingSprite",type:Mt.RendererPlugin},Bt.add(ga);const _a=class t{constructor(t,e,i){this.linkedSheets=[],(t instanceof Wt||t instanceof mi)&&(t={texture:t,data:e,resolutionFilename:i});const{texture:r,data:s,resolutionFilename:n=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=r instanceof mi?r:null,this.baseTexture=r instanceof Wt?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=s;const a=this.baseTexture.resource;this.resolution=this._updateResolution(n||(a?a.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 i=It(t,null);return null===i&&(i="number"==typeof e?e:parseFloat(e??"1")),1!==i&&this.baseTexture.setRe
1solution(i),i}parse(){return new Promise((e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(e){let i=e;const r=t.BATCH_SIZE;for(;i-e<r&&i<this._frameKeys.length;){const t=this._frameKeys[i],e=this._frames[t],r=e.frame;if(r){let i=null,s=null;const n=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,o=new le(0,0,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution);i=e.rotated?new le(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.h)/this.resolution,Math.floor(r.w)/this.resolution):new le(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(s=new le(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution)),this.textures[t]=new mi(this.baseTexture,i,o,s,e.rotated?2:0,e.anchor,e.borders),mi.addToCache(this.textures[t],this.cachePrefix+t.toString())}i++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};_a.BATCH_SIZE=1e3;let va=_a;const xa=["jpg","png","jpeg","avif","webp"];function ya(t,e,i){const r={};if(t.forEach((t=>{r[t]=e})),Object.keys(e.textures).forEach((t=>{r[`${e.cachePrefix}${t}`]=e.textures[t]})),!i){const i=P.dirname(t[0]);e.linkedSheets.forEach(((t,s)=>{Object.assign(r,ya([`${i}/${e.data.meta.related_multi_packs[s]}`],t,!0))}))}return r}const ba={extension:Mt.Asset,cache:{test:t=>t instanceof va,getCacheableAssets:(t,e)=>ya(t,e,!1)},resolver:{test:t=>{const e=t.split("?")[0].split("."),i=e.pop(),r=e.pop();return"json"===i&&xa.includes(r)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(T.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:Mt.LoadParser,priority:Rs.Normal},testParse:async(t,e)=>".json"===P.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,i){const{texture:r,imageFilename:s,cachePrefix:n}=e?.data??{};let o,a=P.dirname(e.src);if(a&&a.lastIndexOf("/")!==a.length-1&&(a+="/"),r&&r.baseTexture)o=r;else{const r=Es(a+(s??t.meta.image),e.src);o=(await i.load([r]))[r]}const h=new va({texture:o.baseTexture,data:t,resolutionFilename:e.src,cachePrefix:n});await h.parse();const l=t?.meta?.related_multi_packs;if(Array.isArray(l)){const t=[];for(const r of l){if("string"!=typeof r)continue;let s=a+r;e.data?.ignoreMultiPack||(s=Es(s,e.src),t.push(i.load({src:s,data:{ignoreMultiPack:!0}})))}const r=await Promise.all(t);h.linkedSheets=r,r.forEach((t=>{t.linkedSheets=[h].concat(h.linkedSheets.filter((e=>e!==t)))}))}return h},unload(t){t.destroy(!0)}}};Bt.add(ba);class Ta{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ea{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const t in e){const r=e[t].match(/^[a-z]+/gm)[0],s=e[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),n={};for(const t in s){const e=s[t].split("="),i=e[0],r=e[1].replace(/"/gm,""),o=parseFloat(r),a=isNaN(o)?r:o;n[i]=a}i[r].push(n)}const r=new Ta;return i.info.forEach((t=>r.info.push({face:t.face,size:parseInt(t.size,10)}))),i.common.forEach((t=>r.common.push({lineHeight:parseInt(t.lineHeight,10)}))),i.page.forEach((t=>r.page.push({id:parseInt(t.id,10),file:t.file}))),i.char.forEach((t=>r.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)}))),i.kerning.forEach((t=>r.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)}))),i.distanceField.forEach((t=>r.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType}))),r}}class Aa{static test(t){const e=t;return"string"!=typeof t&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){const e=new Ta,i=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),s=t.getElementsByTagName("page"),n=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),a=t.getElementsByTagName("distanceField");for(let t=0;t<i.length;t++)e.info.push({face:i[t].getAttribute("face"),size:parseInt(i[t].getAttribute("size"),10)});for(let t=0;t<r.length;t++)e.common.push({lineHeight:parseInt(r[t].getAttribute("lineHeight"),10)});for(let t=0;t<s.length;t++)e.page.push({id:parseInt(s[t].getAttribute("id"),10)||0,file:s[t].getAttribute("file")});for(let t=0;t<n.length;t++){const i=n[t];e.char.push({id:parseInt(i.getAttribute("id"),10),page:parseInt(i.getAttribute("page"),10)||0,x:parseInt(i.getAttribute("x"),10),y:parseInt(i.getAttribute("y"),10),width:parseInt(i.getAttribute("width"),10),height:parseInt(i.getAttribute("height"),10),xoffset:parseInt(i.getAttribute("xoffset"),10),yoffset:parseInt(i.getAttribute("yoffset"),10),xadvance:parseInt(i.getAttribute("xadvance"),10)})}for(let t=0;t<o.length;t++)e.kerning.push({first:parseInt(o[t].getAttribute("first"),10),second:parseInt(o[t].getAttribute("second"),10),amount:parseInt(o[t].getAttribute("amount"),10)});for(let t=0;t<a.length;
1t++)e.distanceField.push({fieldType:a[t].getAttribute("fieldType"),distanceRange:parseInt(a[t].getAttribute("distanceRange"),10)});return e}}class Sa{static test(t){return!("string"!=typeof t||!t.includes("<font>"))&&Aa.test(T.ADAPTER.parseXML(t))}static parse(t){return Aa.parse(T.ADAPTER.parseXML(t))}}const wa=[Ea,Aa,Sa];function Ca(t,e,i,r,s,n,o){const a=i.text,h=i.fontProperties;e.translate(r,s),e.scale(n,n);const l=o.strokeThickness/2,u=-o.strokeThickness/2;if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=function(t,e,i,r,s,n){const o=i.fill;if(!Array.isArray(o))return o;if(1===o.length)return o[0];let a;const h=i.dropShadow?i.dropShadowDistance:0,l=i.padding||0,u=t.width/r-h-2*l,c=t.height/r-h-2*l,d=o.slice(),f=i.fillGradientStops.slice();if(!f.length){const t=d.length+1;for(let e=1;e<t;++e)f.push(e/t)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),i.fillGradientType===zo.LINEAR_VERTICAL){a=e.createLinearGradient(u/2,l,u/2,c+l);let t=0;const r=(n.fontProperties.fontSize+i.strokeThickness)/c;for(let e=0;e<s.length;e++){const i=n.lineHeight*e;for(let e=0;e<d.length;e++){let s=0;s="number"==typeof f[e]?f[e]:e/d.length;const n=i/c+s*r;let o=Math.max(t,n);o=Math.min(o,1),a.addColorStop(o,d[e]),t=o}}}else{a=e.createLinearGradient(l,c/2,u+l,c/2);const t=d.length+1;let i=1;for(let e=0;e<d.length;e++){let r;r="number"==typeof f[e]?f[e]:i/t,a.addColorStop(r,d[e]),i++}}return a}(t,e,o,n,[a],i),e.strokeStyle=o.stroke,o.dropShadow){const t=o.dropShadowColor,i=o.dropShadowBlur*n,r=o.dropShadowDistance*n;e.shadowColor=ot.shared.setValue(t).setAlpha(o.dropShadowAlpha).toRgbaString(),e.shadowBlur=i,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*r,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*r}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,l,u+i.lineHeight-h.descent),o.fill&&e.fillText(a,l,u+i.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function Pa(t){return t.codePointAt?t.codePointAt(0):t.charCodeAt(0)}function Ra(t){return Array.from?Array.from(t):t.split("")}const Ia=class t{constructor(t,e,i){const[r]=t.info,[s]=t.common,[n]=t.page,[o]=t.distanceField,a=It(n.file),h={};this._ownsTextures=i,this.font=r.face,this.size=r.size,this.lineHeight=s.lineHeight/a,this.chars={},this.pageTextures=h;for(let i=0;i<t.page.length;i++){const{id:r,file:s}=t.page[i];h[r]=e instanceof Array?e[i]:e[s],o?.fieldType&&"none"!==o.fieldType&&(h[r].baseTexture.alphaMode=m.NO_PREMULTIPLIED_ALPHA,h[r].baseTexture.mipmap=p.OFF)}for(let e=0;e<t.char.length;e++){const{id:i,page:r}=t.char[e];let{x:s,y:n,width:o,height:l,xoffset:u,yoffset:c,xadvance:d}=t.char[e];s/=a,n/=a,o/=a,l/=a,u/=a,c/=a,d/=a;const f=new le(s+h[r].frame.x/a,n+h[r].frame.y/a,o,l);this.chars[i]={xOffset:u,yOffset:c,xAdvance:d,kerning:{},texture:new mi(h[r].baseTexture,f),page:r}}for(let e=0;e<t.kerning.length;e++){let{first:i,second:r,amount:s}=t.kerning[e];i/=a,r/=a,s/=a,this.chars[r]&&(this.chars[r].kerning[i]=s)}this.distanceFieldRange=o?.distanceRange,this.distanceFieldType=o?.fieldType?.toLowerCase()??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(e,i,r){let s;if(e instanceof Ta)s=e;else{const t=function(t){for(let e=0;e<wa.length;e++)if(wa[e].test(t))return wa[e];return null}(e);if(!t)throw new Error("Unrecognized data format for font.");s=t.parse(e)}i instanceof mi&&(i=[i]);const n=new t(s,i,r);return t.available[n.font]=n,n}static uninstall(e){const i=t.available[e];if(!i)throw new Error(`No font found named '${e}'`);i.destroy(),delete t.available[e]}static from(e,i,r){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},t.defaultOptions,r),u=function(t){"string"==typeof t&&(t=[t]);const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];if(Array.isArray(r)){if(2!==r.length)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);
1const t=r[0].charCodeAt(0),i=r[1].charCodeAt(0);if(i<t)throw new Error("[BitmapFont]: Invalid character range.");for(let r=t,s=i;r<=s;r++)e.push(String.fromCharCode(r))}else e.push(...Ra(r))}if(0===e.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}(s),c=i instanceof $o?i:new $o(i),d=a,f=new Ta;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p,m,g,_=0,v=0,x=0;const y=[];for(let t=0;t<u.length;t++){p||(p=T.ADAPTER.createCanvas(),p.width=a,p.height=h,m=p.getContext("2d"),g=new Wt(p,{resolution:o,...l}),y.push(new mi(g)),f.page.push({id:y.length-1,file:""}));const e=u[t],i=Vo.measureText(e,c,!1,p),r=i.width,s=Math.ceil(i.height),b=Math.ceil(("italic"===c.fontStyle?2:1)*r);if(v>=h-s*o){if(0===v)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,p=null,m=null,g=null,v=0,_=0,x=0;continue}if(x=Math.max(s+i.fontProperties.descent,x),b*o+_>=d){if(0===_)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,v+=x*o,v=Math.ceil(v),_=0,x=0;continue}Ca(p,m,i,_,v,o,c);const E=Pa(i.text);f.char.push({id:E,page:y.length-1,x:_/o,y:v/o,width:b,height:s,xoffset:0,yoffset:0,xadvance:r-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),_+=(b+2*n)*o,_=Math.ceil(_)}if(!r?.skipKerning)for(let t=0,e=u.length;t<e;t++){const i=u[t];for(let t=0;t<e;t++){const e=u[t],r=m.measureText(i).width,s=m.measureText(e).width,n=m.measureText(i+e).width-(r+s);n&&f.kerning.push({first:Pa(i),second:Pa(e),amount:n})}}const b=new t(f,y,!0);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=b,b}};Ia.ALPHA=[["a","z"],["A","Z"]," "],Ia.NUMERIC=[["0","9"]],Ia.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Ia.ASCII=[[" ","~"]],Ia.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Ia.ALPHANUMERIC},Ia.available={};let Ma=Ia;const Da=[],Fa=[],Ba=[],La=class t extends Gr{constructor(e,i={}){super();const{align:r,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},t.styleDefaults,i);if(!Ma.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=r,this._tintColor=new ot(s),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=e,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new Ee((()=>{this.dirty=!0}),this,0,0),this._roundPixels=T.ROUND_PIXELS,this.dirty=!0,this._resolution=T.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const t=Ma.available[this._fontName],e=this.fontSize,i=e/t.size,r=new ae,s=[],n=[],a=[],h=Ra(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),l=this._maxWidth*t.size/e,u="none"===t.distanceFieldType?Da:Fa;let c=null,d=0,f=0,p=0,m=-1,g=0,_=0,v=0,x=0;for(let e=0;e<h.length;e++){const i=h[e],o=Pa(i);if(/(?:\s)/.test(i)&&(m=e,g=d,x++),"\r"===i||"\n"===i){n.push(d),a.push(-1),f=Math.max(f,d),++p,++_,r.x=0,r.y+=t.lineHeight,c=null,x=0;continue}const u=t.chars[o];if(!u)continue;c&&u.kerning[c]&&(r.x+=u.kerning[c]);const y=Ba.pop()||{texture:mi.EMPTY,line:0,charCode:0,prevSpaces:0,position:new ae};y.texture=u.texture,y.line=p,y.charCode=o,y.position.x=Math.round(r.x+u.xOffset+this._letterSpacing/2),y.position.y=Math.round(r.y+u.yOffset),y.prevSpaces=x,s.push(y),d=y.position.x+Math.max(u.xAdvance-u.xOffset,u.texture.orig.width),r.x+=u.xAdvance+this._letterSpacing,v=Math.max(v,u.yOffset+u.texture.height),c=o,-1!==m&&l>0&&r.x>l&&(++_,_t(s,1+m-_,1+e-m),e=m,m=-1,n.push(g),a.push(s.length>0?s[s.length-1].prevSpaces:0),f=Math.max(f,g),p++,r.x=0,r.y+=t.lineHeight,c=null,x=0)}const y=h[h.length-1];"\r"!==y&&"\n"!==y&&(/(?:\s)/.test(y)&&(d=g),n.push(d),f=Math.max(f,d),a.push(-1));const b=[];for(let t=0;t<=p;t++){let e=0;"right"===this._align?e=f-n[t]:"center"===this._align?e=(f-n[t])/2:"justify"===this._align&&(e=a[t]<0?0:(f-n[t])/a[t]),b.push(e)}const T=s.length,E={},A=[],S=this._activePagesMeshData;u.push(...S);for(let e=0;e<T;e++){const i=s[e].texture,r=i.baseTexture.uid;if(!E[r]){let e=u.pop();if(!e){const i=new Lo;let r,s;"none"===t.distanceFieldType?(r=new Oo(mi.EMPTY),s=o.NORMAL):(r=new Oo(mi.EMPTY,{program:$e.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\r\n\r\n    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n  // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n  vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n  // MSDF\r\n  float median = texColor.r + texColor.g + texColor.b -\r\n                  min(texColor.r, min(texColor.g, texColor.b)) -\r\n                  max(texColor.r, max(texColor.g, texColor.b));\r\n  // SDF\r\n  median = min(median, texColor.a);\r\n\r\n  float screenPxDistance = uFWidth * (median - 0.5);\r\n  float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n  if (median < 0.01) {\r\n    alpha = 0.0;\r\n  } else if (median > 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}}),s=o.NORMAL_NPM);const n=new Bo(i,r);n.blendMode=s,e={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:n,vertices:null,uvs:null,indices:null}}e.index=0,e.indexCount=0,e.vertexCount=0,e.uvsCount=0,e.total=0;const{_textureCache:s}=this;s[r]=s[r]||new mi(i.baseTexture),e.mesh.texture=s[r],e.mesh.tint=this._tintColor.value,A.push(e),E[r]=e}E[r].total++}for(let t=0;t<S.length;t++)A.includes(S[t])||this.removeChild(S[t].mesh);for(let t=0;t<A.length;t++)A[t].mesh.parent!==this&&this.addChild(A[t].mesh);this._activePagesMeshData=A;for(const t in E){const e=E[t],i=e.total;if(!(e.indices?.length>6*i)||e.vertices.length<2*Bo.BATCHABLE_SIZE)e.vertices=new Float32Array(8*i),e.uvs=new Float32Array(8*i),e.indices=new Uint16Array(6*i);else{const t=e.total,i=e.vertices;for(let e=4*t*2;e<i.length;e++)i[e]=0}e.mesh.size=6*i}for(let t=0;t<T;t++){const e=s[t];let r=e.position.x+b[e.line]*("justify"===this._align?e.prevSpaces:1);this._roundPixels&&(r=Math.round(r));const n=r*i,o=e.position.y*i,a=e.texture,h=E[a.baseTexture.uid],l=a.frame,u=a._uvs,c=h.index++;h.indices[6*c+0]=0+4*c,h.indices[6*c+1]=1+4*c,h.indices[6*c+2]=2+4*c,h.indices[6*c+3]=0+4*c,h.indices[6*c+4]=2+4*c,h.indices[6*c+5]=3+4*c,h.vertices[8*c+0]=n,h.vertices[8*c+1]=o,h.vertices[8*c+2]=n+l.width*i,h.vertices[8*c+3]=o,h.vertices[8*c+4]=n+l.width*i,h.vertices[8*c+5]=o+l.height*i,h.vertices[8*c+6]=n,h.vertices[8*c+7]=o+l.height*i,h.uvs[8*c+0]=u.x0,h.uvs[8*c+1]=u.y0,h.uvs[8*c+2]=u.x1,h.uvs[8*c+3]=u.y1,h.uvs[8*c+4]=u.x2,h.uvs[8*c+5]=u.y2,h.uvs[8*c+6]=u.x3,h.uvs[8*c+7]=u.y3}this._textWidth=f*i,this._textHeight=(r.y+t.lineHeight)*i;for(const t in E){const e=E[t];if(0!==this.anchor.x||0!==this.anchor.y){let t=0;const i=this._textWidth*this.anchor.x,r=this._textHeight*this.anchor.y;for(let s=0;s<e.total;s++)e.vertices[t++]-=i,e.vertices[t++]-=r,e.vertices[t++]-=i,e.vertices[t++]-=r,e.vertices[t++]-=i,e.vertices[t++]-=r,e.vertices[t++]-=i,e.vertices[t++]-=r}this._maxLineHeight=v*i;const r=e.mesh.geometry.getBuffer("aVertexPosition"),s=e.mesh.geometry.getBuffer("aTextureCoord"),n=e.mesh.geometry.getIndex();r.data=e.vertices,s.data=e.uvs,n.data=e.indices,r.update(),s.update(),n.update()}for(let t=0;t<s.length;t++)Ba.push(s[t]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:i,size:r}=Ma.available[this._fontName];if("none"!==i){const{a:i,b:s,c:n,d:o}=this.worldTransform,a=Math.sqrt(i*i+s*s),h=Math.sqrt(n*n+o*o),l=(Math.abs(a)+Math.abs(h))/2,u=this.fontSize/r,c=t._view.resolution;for(const t of this._activePagesMeshData)t.mesh.shader.uniforms.uFWidth=l*e*u*c}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Ma.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!Ma.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Ma.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}
1set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,i="none"===Ma.available[this._fontName].distanceFieldType?Da:Fa;i.push(...this._activePagesMeshData);for(const t of this._activePagesMeshData)this.removeChild(t.mesh);this._activePagesMeshData=[],i.filter((t=>e[t.mesh.texture.baseTexture.uid])).forEach((t=>{t.mesh.texture=mi.EMPTY}));for(const t in e)e[t].destroy(),delete e[t];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};La.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let Oa=La;const Na=[".xml",".fnt"],ka={extension:{type:Mt.LoadParser,priority:Rs.Normal},name:"loadBitmapFont",test:t=>Na.includes(P.extname(t).toLowerCase()),testParse:async t=>Ea.test(t)||Sa.test(t),async parse(t,e,i){const r=Ea.test(t)?Ea.parse(t):Sa.parse(t),{src:s}=e,{page:n}=r,o=[];for(let t=0;t<n.length;++t){const e=n[t].file;let i=P.join(P.dirname(s),e);i=Es(i,s),o.push(i)}const a=await i.load(o),h=o.map((t=>a[t]));return Ma.install(r,h,!0)},load:async(t,e)=>(await T.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};Bt.add(ka);const Ua=class t extends $o{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new t(Object.keys(t.defaultOptions).reduce(((t,i)=>({...t,[i]:e[i]})),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach((e=>{URL.revokeObjectURL(e.src),e.refs--,0===e.refs&&(e.fontFace&&document.fonts.delete(e.fontFace),delete t.availableFonts[e.originalUrl])})),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,i={}){const{availableFonts:r}=t;if(r[e]){const t=r[e];return this._fonts.push(t),t.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return T.ADAPTER.fetch(e).then((t=>t.blob())).then((async t=>new Promise(((e,i)=>{const r=URL.createObjectURL(t),s=new FileReader;s.onload=()=>e([r,s.result]),s.onerror=i,s.readAsDataURL(t)})))).then((async([t,s])=>{const n=Object.assign({family:P.basename(e,P.extname(e)),weight:"normal",style:"normal",display:"auto",src:t,dataSrc:s,refs:1,originalUrl:e,fontFace:null},i);r[e]=n,this._fonts.push(n),this.styleID++;const o=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style,display:n.display});n.fontFace=o,await o.load(),document.fonts.add(o),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}');
1\n                font-weight: ${e.weight};\n                font-style: ${e.style};\n                font-display: ${e.display};\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=ut(t)),"number"==typeof t?ht(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(255*e|0).toString(16).padStart(2,"0"));const s=`${i}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${s} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${s} ${t}`}reset(){Object.assign(this,t.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}=T.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}};Ua.availableFonts={},Ua.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};let Ga=Ua;const za=class t extends Xr{constructor(e="",i={}){super(mi.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const r=new Image,s=mi.from(r,{scaleMode:T.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new le,s.trim=new le,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),u=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=t.defaultMaxWidth,this.maxHeight=t.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=r,this._loadImage=new Image,this._autoResolution=t.defaultAutoResolution,this._resolution=t.defaultResolution??T.RESOLUTION,this.text=e,this.style=i}measureText(t){const{text:e,style:i,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(r)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const s=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:n,height:o}=s;(n>this.maxWidth||o>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const a=Math.min(this.maxWidth,Math.ceil(n)),h=Math.min(this.maxHeight,Math.ceil(o));return this._svgRoot.setAttribute("width",a.toString()),this._svgRoot.setAttribute("height",h.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(r)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:a+2*i.padding,height:h+2*i.padding}}async updateText(t=!0){const{style:e,_image:i,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:s,height:n}=this.measureText();i.width=r.width=Math.ceil(Math.max(1,s)),i.height=r.height=Math.ceil(Math.max(1,n)),this._updateID++;const o=this._updateID;await new Promise((t=>{r.onload=async()=>{o<this._updateID||(await e.onBeforeDraw(),i.src=r.src,r.onload=null,r.src="",this.updateTexture()),t()};const s=(new XMLSerializer).serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(s)}`}))}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:r}=this,{padding:s}=t,{baseTexture:n}=e;e.trim.width=e._frame.width=i.width/r,e.trim.height=e._frame.height=i.height/r,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-2*s,e.orig.height=e._frame.height-2*s,this._onTextureUpdate(),n.setRealSize(i.width,i.height,r),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(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},t.defaultDestroyOptions,e),super.destroy(e);const i=null;this.ownsStyle&&this._style?.cleanFonts(),this._style=i,this._svgRoot?.remove(),this._svgRoot=i,this._domElement?.remove(),this._domElement=i,this._foreignObject?.remove(),this._foreignObject=i,this._styleElement?.remove(),this._styleElement=i,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=i,this._image.src="",this._image=i}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=vt(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=vt(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 Ga?(this.ownsStyle=!1,this._style=t):t instanceof $o?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Ga.from(t)):(this.ownsStyle=!0,this._style=new Ga(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(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};za.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},za.defaultMaxWidth=2024,za.defaultMaxHeight=2024,za.defaultAutoResolution=!0;class Ha extends ri{constructor(t=4,e=3,i=!1){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}",i?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n    vec4 color = vec4(0.0);\n\n    // Sample top left pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Sample top right pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Sample bottom right pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Sample bottom left pixel\n    color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n    // Average\n    color *= 0.25;\n\n    gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n    vec4 color = vec4(0.0);\n\n    // Sample top left pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n    // Sample top right pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n    // Sample bottom right pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n    // Sample bottom left pixel\n    color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n    // Average\n    color *= 0.25;\n\n    gl_FragColor = color;\n}"),this._kernels=[],this._blur=4,this._quality=3,this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new ae,this.pixelSize=1,this._clamp=i,Array.isArray(t)?this.kernels=t:(this._blur=t,this.quality=e)}apply(t,e,i,r){const s=this._pixelSize.x/e._frame.width,n=this._pixelSize.y/e._frame.height;let o;if(1===this._quality||0===this._blur)o=this._kernels[0]+.5,this.uniforms.uOffset[0]=o*s,this.uniforms.uOffset[1]=o*n,t.applyFilter(this,e,i,r);else{const a=t.getFilterTexture();let h,l=e,u=a;const c=this._quality-1;for(let e=0;e<c;e++)o=this._kernels[e]+.5,this.uniforms.uOffset[0]=o*s,this.uniforms.uOffset[1]=o*n,t.applyFilter(this,l,u,1),h=l,l=u,u=h;o=this._kernels[c]+.5,this.uniforms.uOffset[0]=o*s,this.uniforms.uOffset[1]=o*n,t.applyFilter(this,l,i,r),t.returnFilterTexture(a)}}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce(((t,e)=>t+e+.5),0))}_generateKernels(){const t=this._blur,e=this._quality,i=[t];if(t>0){let r=t;const s=t/e;for(let t=1;t<e;t++)r-=s,i.push(r)}this._kernels=i,this._updatePadding()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get clamp(){return this._clamp}set pixelSize(t){"number"==typeof t?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof ae?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)}get pixelSize(){return this._pixelSize}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get blur(){return this._blur}set blur(t){this._blur=t,this._generateKernels()}}var Xa="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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}";class Va extends ri{constructor(t=.5){super(Xa,"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n    vec4 color = texture2D(uSampler, vTextureCoord);\n\n    // A simple & fast algorithm for getting brightness.\n    // It's inaccuracy , but good enought for this feature.\n    float _max = max(max(color.r, color.g), color.b);\n    float _min = min(min(color.r, color.g), color.b);\n    float brightness = (_max + _min) * 0.5;\n\n    if(brightness > threshold) {\n        gl_FragColor = color;\n    } else {\n        gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n    }\n}\n"),this.threshold=t}get threshold(){return this.uniforms.threshold}set threshold(t){this.uniforms.threshold=t}}const ja=class extends ri{constructor(t){super(Xa,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n    vec4 color = texture2D(uSampler, vTextureCoord);\n    color.rgb *= brightness;\n    vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n    bloomColor.rgb *= bloomScale;\n    gl_FragColor = color + bloomColor;\n}\n"),this.bloomScale=1,this.brightness=1,this._resolution=T.FILTER_RESOLUTION,"number"==typeof t&&(t={threshold:t});const e=Object.assign(ja.defaults,t);this.bloomScale=e.bloomScale,this.brightness=e.brightness;const{kernels:i,blur:r,quality:s,pixelSize:n,resolution:o}=e;this._extractFilter=new Va(e.threshold),this._extractFilter.resolution=o,this._blurFilter=i?new Ha(i):new Ha(r,s),this.pixelSize=n,this.resolution=o}apply(t,e,i,r,s){const n=t.getFilterTexture();this._extractFilter.apply(t,e,n,1,s);const o=t.getFilterTexture();this._blurFilter.apply(t,n,o,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=o,t.applyFilter(this,e,i,r),t.returnFilterTexture(o),t.returnFilterTexture(n)}get resolution(){return this._resolution}set resolution(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)}get threshold(){return this._extractFilter.threshold}set threshold(t){this._extractFilter.threshold=t}get kernels(){return this._blurFilter.kernels}set kernels(t){this._blurFilter.kernels=t}get blur(){return this._blurFilter.blur}set blur(t){this._blurFilter.blur=t}get quality(){return this._blurFilter.quality}set quality(t){this._blurFilter.quality=t}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(t){this._blurFilter.pixelSize=t}};ja.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:T.FILTER_RESOLUTION};const Wa=class extends ri{constructor(t){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n    vec2 coord = vTextureCoord * filterArea.xy;\n    coord -= center * dimensions.xy;\n    float distance = length(coord);\n    if (distance < radius) {\n        float percent = distance / radius;\n        if (strength > 0.0) {\n            coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n        } else {\n            coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n        }\n    }\n    coord += center * dimensions.xy;\n    coord /= filterArea.xy;\n    vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n    vec4 color = texture2D(uSampler, clampedCoord);\n    if (coord != clampedCoord) {\n        color *= max(0.0, 1.0 - length(coord - clampedCoord));\n    }\n\n    gl_FragColor = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,Wa.defaults,t)}apply(t,e,i,r){const{width:s,height:n}=e.filterFrame;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=n,t.applyFilter(this,e,i,r)}get radius(){return this.uniforms.radius}set radius(t){this.uniforms.radius=t}get strength(){return this.uniforms.strength}set strength(t){this.uniforms.strength=t}get center(){return this.uniforms.center}set center(t){this.uniforms.center=t}};Wa.defaults={center:[.5,.5],radius:100,strength:1};var $a;($a=$a||{}).stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var i=t.visit(e.orientation);return i&&(i+=", "),e.type+"("+i+t.visit(e.colorStops)+")"},visit_shape:function(e){var i=e.value,r=t.visit(e.at),s=t.visit(e.style);return s&&(i+=" "+s),r&&(i+=" at "+r),i},"visit_default-radial":function(e){var i="",r=t.visit(e.at);return r&&(i+=r),i},"visit_extent-keyword":function(e){var i=e.value,r=t.visit(e.at);return r&&(i+=" at "+r),i},"visit_position-keyword":function(t){return t.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(t){return t.value+"%"},visit_em:function(t){return t.value+"em"},visit_px:function(t){return t.value+"px"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_color:function(e,i){var r=e,s=t.visit(i.length);return s&&(r+=" "+s),r},visit_angular:function(t){return t.value+"deg"},visit_directional:function(t){return"to "+t.value},visit_array:function(e){var i="",r=e.length;return e.forEach((function(e,s){i+=t.visit(e),s<r-1&&(i+=", ")})),i},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e,"");if(e.type){var i=t["visit_"+e.type];if(i)return i(e);throw Error("Missing visitor visit_"+e.type)}throw Error("Invalid node.")}};return function(e){return t.visit(e)}}(),($a=$a||{}).parse=function(){var t=/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,e=/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,i=/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,r=/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,s=/^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,n=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,o=/^(left|center|right|top|bottom)/i,a=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,h=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,c=/^\(/,d=/^\)/,f=/^,/,p=/^\#([0-9a-fA-F]+)/,m=/^([a-zA-Z]+)/,g=/^rgb/i,_=/^rgba/i,v=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,x="";function y(t){var e=new Error(x+": "+t);throw e.source=x,e}function b(){var t=M(T);return x.length>0&&y("Invalid input not EOF"),t}function T(){return E("linear-gradient",t,S)||E("repeating-linear-gradient",e,S)||E("radial-gradient",i,w)||E("repeating-radial-gradient",r,w)}function E(t,e,i){return A(e,(function(e){var r=i();return r&&(N(f)||y("Missing comma before color stops")),{type:t,orientation:r,colorStops:M(D)}}))}function A(t,e){var i=N(t);if(i){N(c)||y("Missing (");var r=e(i);return N(d)||y("Missing )"),r}}function S(){return O("directional",s,1)||O("angular",u,1)}function w(){var t,e,i=C();return i&&((t=[]).push(i),e=x,N(f)&&((i=C())?t.push(i):x=e)),t}function C(){var t=function(){var t=O("shape",/^(circle)/i,0);return t&&(t.style=L()||P()),t}()||function(){var t=O("shape",/^(ellipse)/i,0);return t&&(t.style=B()||P()),t}();if(t)t.at=R();else{var e=P();if(e){t=e;var i=R();i&&(t.at=i)}else{var r=I();r&&(t={type:"default-radial",at:r})}}return t}function P(){return O("extent-keyword",n,1)}function R(){if(O("position",/^at/,0)){var t=I();return t||y("Missing positioning value"),t}}function I(){var t={x:B(),y:B()};if(t.x||t.y)return{type:"position",value:t}}function M(t){var e=t(),i=[];if(e)for(i.push(e);N(f);)(e=t())?i.push(e):y("One extra comma");return i}function D(){var t=O("hex",p,1)||A(_,(function(){return{type:"rgba",value:M(F)}}))||A(g,(function(){return{type:"rgb",value:M(F)}}))||O("literal",m,0);return t||y("Expected color definition"),t.length=B(),t}function F(){return N(v)[1]}function B(){return O("%",h,1)||O("position-keyword",o,1)||L()}function L(){return O("px",a,1)||O("em",l,1)}function O(t,e,i){var r=N(e);if(r)return{type:t,value:r[i]}}function N(t){var e,i;return(i=/^[\n\r\t\s]+/.exec(x))&&k(i[0].length),(e=t.exec(x))&&k(e[0].length),e}function k(t){x=x.substr(t)}return function(t){return x=t.toString(),b()}}();var Ya=$a.parse;$a.stringify;var qa={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],ol
1ive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ka={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Za(t){var e,i,r=[],s=1;if("string"==typeof t)if(qa[t])r=qa[t].slice(),i="rgb";else if("transparent"===t)s=0,i="rgb",r=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var n=t.slice(1);s=1,(h=n.length)<=4?(r=[parseInt(n[0]+n[0],16),parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16)],4===h&&(s=parseInt(n[3]+n[3],16)/255)):(r=[parseInt(n[0]+n[1],16),parseInt(n[2]+n[3],16),parseInt(n[4]+n[5],16)],8===h&&(s=parseInt(n[6]+n[7],16)/255)),r[0]||(r[0]=0),r[1]||(r[1]=0),r[2]||(r[2]=0),i="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var o=e[1],a="rgb"===o;i=n=o.replace(/a$/,"");var h="cmyk"===n?4:"gray"===n?1:3;r=e[2].trim().split(/\s*[,\/]\s*|\s+/).map((function(t,e){if(/%$/.test(t))return e===h?parseFloat(t)/100:"rgb"===n?255*parseFloat(t)/100:parseFloat(t);if("h"===n[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==Ka[t])return Ka[t]}return parseFloat(t)})),o===n&&r.push(1),s=a||void 0===r[h]?1:r[h],r=r.slice(0,h)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(r=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi).join("").toLowerCase());else isNaN(t)?Array.isArray(t)||t.length?(r=[t[0],t[1],t[2]],i="rgb",s=4===t.length?t[3]:1):t instanceof Object&&(null!=t.r||null!=t.red||null!=t.R?(i="rgb",r=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(i="hsl",r=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),s=t.a||t.alpha||t.opacity||1,null!=t.opacity&&(s/=100)):(i="rgb",r=[t>>>16,(65280&t)>>>8,255&t]);return{space:i,values:r,alpha:s}}var Qa={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},Ja={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,r,s,n,o=t[0]/360,a=t[1]/100,h=t[2]/100;if(0===a)return[n=255*h,n,n];e=2*h-(i=h<.5?h*(1+a):h+a-h*a),s=[0,0,0];for(var l=0;l<3;l++)(r=o+1/3*-(l-1))<0?r++:r>1&&r--,n=6*r<1?e+6*(i-e)*r:2*r<1?i:3*r<2?e+(i-e)*(2/3-r)*6:e,s[l]=255*n;return s}};function th(t){switch(typeof t){case"string":return function(t){const e=function(t){Array.isArray(t)&&t.raw&&(t=String.raw(...arguments));var e,i=Za(t);if(!i.space)return[];const r="h"===i.space[0]?Ja.min:Qa.min,s="h"===i.space[0]?Ja.max:Qa.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],r[0]),s[0]),e[1]=Math.min(Math.max(i.values[1],r[1]),s[1]),e[2]=Math.min(Math.max(i.values[2],r[2]),s[2]),"h"===i.space[0]&&(e=Ja.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}(t);if(!e)throw new Error(`Unable to parse color "${t}" as RGBA.`);return[e[0]/255,e[1]/255,e[2]/255,e[3]]}(t);case"number":return at(t);default:return t}}function eh(t){const e=Ya(function(t){let e=t.replace(/\s{2,}/gu," ");return e=e.replace(/;/g,""),e=e.replace(/ ,/g,","),e=e.replace(/\( /g,"("),e=e.replace(/ \)/g,")"),e.trim()}(t));if(0===e.length)throw new Error("Invalid CSS gradient.");if(1!==e.length)throw new Error("Unsupported CSS gradient (multiple gradients is not supported).");const i=e[0],r=function(t){const e={"linear-gradient":0,"radial-gradient":1};if(!(t in e))throw new Error(`Unsupported gradient type "${t}"`);return e[t]}(i.type),s=function(t){const e=function(t){const e=[];for(let i=0;i<t.length;i++){const r=t[i];let s=-1;
1"literal"===r.type&&r.length&&"type"in r.length&&"%"===r.length.type&&"value"in r.length&&(s=parseFloat(r.length.value)/100),e.push(s)}const i=t=>{for(let i=t;i<e.length;i++)if(-1!==e[i])return{indexDelta:i-t,offset:e[i]};return{indexDelta:e.length-1-t,offset:1}};let r=0;for(let t=0;t<e.length;t++){const s=e[t];if(-1!==s)r=s;else if(0===t)e[t]=0;else if(t+1===e.length)e[t]=1;else{const s=i(t),n=(s.offset-r)/(1+s.indexDelta);for(let i=0;i<=s.indexDelta;i++)e[t+i]=r+(i+1)*n;t+=s.indexDelta,r=e[t]}}return e.map(rh)}(t),i=[];for(let r=0;r<t.length;r++){const s=ih(t[r]);i.push({offset:e[r],color:s.slice(0,3),alpha:s[3]})}return i}(i.colorStops),n=function(t){if(void 0===t)return 0;if("type"in t&&"value"in t)switch(t.type){case"angular":return parseFloat(t.value);case"directional":return function(t){const e={left:270,top:0,bottom:180,right:90,"left top":315,"top left":315,"left bottom":225,"bottom left":225,"right top":45,"top right":45,"right bottom":135,"bottom right":135};if(!(t in e))throw new Error(`Unsupported directional value "${t}"`);return e[t]}(t.value)}return 0}(i.orientation);return{type:r,stops:s,angle:n}}function ih(t){return th(function(t){switch(t.type){case"hex":return`#${t.value}`;case"literal":return t.value;default:return`${t.type}(${t.value.join(",")})`}}(t))}function rh(t){return t.toString().length>6?parseFloat(t.toString().substring(0,6)):t}Qa.hsl=function(t){var e,i,r=t[0]/255,s=t[1]/255,n=t[2]/255,o=Math.min(r,s,n),a=Math.max(r,s,n),h=a-o;return a===o?e=0:r===a?e=(s-n)/h:s===a?e=2+(n-r)/h:n===a&&(e=4+(r-s)/h),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?h/(a+o):h/(2-a-o)),100*i]};var sh=Object.defineProperty,nh=Object.defineProperties,oh=Object.getOwnPropertyDescriptors,ah=Object.getOwnPropertySymbols,hh=Object.prototype.hasOwnProperty,lh=Object.prototype.propertyIsEnumerable,uh=(t,e,i)=>e in t?sh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ch=(t,e)=>{for(var i in e||(e={}))hh.call(e,i)&&uh(t,i,e[i]);if(ah)for(var i of ah(e))lh.call(e,i)&&uh(t,i,e[i]);return t};const dh=class extends ri{constructor(t){var e,i;let r;if(r=t&&"css"in t?((t,e)=>nh(t,oh(e)))(ch({},eh(t.css||"")),{alpha:null!=(e=t.alpha)?e:dh.defaults.alpha,maxColors:null!=(i=t.maxColors)?i:dh.defaults.maxColors}):ch(ch({},dh.defaults),t),!r.stops||r.stops.length<2)throw new Error("ColorGradientFilter requires at least 2 color stops.");super("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n    vFilterCoord = vTextureCoord * inputSize.xy / outputFrame.zw;\n}\n","const float PI = 3.1415926538;\nconst float PI_2 = PI*2.;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\nuniform sampler2D uSampler;\n\nconst int TYPE_LINEAR = 0;\nconst int TYPE_RADIAL = 1;\nconst int TYPE_CONIC = 2;\nconst int MAX_STOPS = 32;\n\nuniform int uNumStops;\nuniform float uAlphas[3*MAX_STOPS];\nuniform vec3 uColors[MAX_STOPS];\nuniform float uOffsets[MAX_STOPS];\nuniform int uType;\nuniform float uAngle;\nuniform float uAlpha;\nuniform int uMaxColors;\nuniform bool uReplace;\n\nstruct ColorStop {\n    float offset;\n    vec3 color;\n    float alpha;\n};\n\nmat2 rotate2d(float angle){\n    return mat2(cos(angle), -sin(angle),\n    sin(angle), cos(angle));\n}\n\nfloat projectLinearPosition(vec2 pos, float angle){\n    vec2 center = vec2(0.5);\n    vec2 result = pos - center;\n    result = rotate2d(angle) * result;\n    result = result + center;\n    return clamp(result.x, 0., 1.);\n}\n\nfloat projectRadialPosition(vec2 pos) {\n    float r = distance(vFilterCoord, vec2(0.5));\n    return clamp(2.*r, 0., 1.);\n}\n\nfloat projectAnglePosition(vec2 pos, float angle) {\n    vec2 center = pos - vec2(0.5);\n    float polarAngle=atan(-center.y, center.x);\n    return mod(polarAngle + angle, PI_2) / PI_2;\n}\n\nfloat projectPosition(vec2 pos, int type, float angle) {\n    if (type == TYPE_LINEAR) {\n        return projectLinearPosition(pos, angle);\n    } else if (type == TYPE_RADIAL) {\n        return projectRadialPosition(pos);\n    } else if (type == TYPE_CONIC) {\n        return projectAnglePosition(pos, angle);\n    }\n\n    return pos.y;\n}\n\nvoid main(void) {\n    // current/original color\n    vec4 currentColor = texture2D(uSampler, vTextureCoord);\n\n    // skip calculations if gradient alpha is 0\n    if (0.0 == uAlpha) {\n        gl_FragColor = currentColor;\n        return;\n    }\n\n    // project position\n    float y = projectPosition(vFilterCoord, uType, radians(uAngle));\n\n    // check gradient bounds\n    float offsetMin = uOffsets[0];\n    float offsetMax = 0.0;\n\n    for (int i = 0; i < MAX_STOPS; i++) {\n        if (i == uNumStops-1){ // last index\n            offsetMax = uOffsets[i];\n        }\n    }\n\n    if (y  < offsetMin || y > offsetMax) {\n        gl_FragColor = currentColor;\n        return;\n    }\n\n    // limit colors\n    if (uMaxColors > 0) {\n        float stepSize = 1./float(uMaxColors);\n        float stepNumber = float(floor(y/stepSize));\n        y = stepSize * (stepNumber + 0.5);// offset by 0.5 to use color from middle of segment\n    }\n\n    // find color stops\n    ColorStop from;\n    ColorStop to;\n\n    for (int i = 0; i < MAX_STOPS; i++) {\n        if (y >= uOffsets[i]) {\n            from = ColorStop(uOffsets[i], uColors[i], uAlphas[i]);\n            to = ColorStop(uOffsets[i+1], uColors[i+1], uAlphas[i+1]);\n        }\n\n        if (i == uNumStops-1){ // last index\n            break;\n        }\n    }\n\n    // mix colors from stops\n    vec4 colorFrom = vec4(from.color * from.alpha, from.alpha);\n    vec4 colorTo = vec4(to.color * to.alpha, to.alpha);\n\n    float segmentHeight = to.offset - from.offset;\n    float relativePos = y - from.offset;// position from 0 to [segmentHeight]\n    float relativePercent = relativePos / segmentHeight;// position in percent between [from.offset] and [to.offset].\n\n    float gradientAlpha = uAlpha * currentColor.a;\n    vec4 gradientColor = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n\n    if (uReplace == false) {\n        // mix resulting color with current color\n        gl_FragColor = gradientColor + currentColor*(1.-gradientColor.a);\n    } else {\n        // replace with gradient color\n        gl_FragColor = gradientColor;\n    }\n}\n"),this._stops=[],this.autoFit=!1,Object.assign(this,r)}get stops(){return this._stops}set stops(t){const e=function(t){return[...t].sort(((t,e)=>t.offset-e.offset))}(t),i=new Float32Array(3*e.length);for(let t=0;t<e.length;t++){const r=th(e[t].color),s=3*t;i[s+0]=r[0],i[s+1]=r[1],i[s+2]=r[2]}this.uniforms.uColors=i,this.uniforms.uOffsets=e.map((t=>t.offset)),this.uniforms.uAlphas=e.map((t=>t.alpha)),this.uniforms.uNumStops=e.length,this._stops=e}set type(t){this.uniforms.uType=t}get type(){return this.uniforms.uType}set angle(t){this.uniforms.uAngle=t-90}get angle(){return this.uniforms.uAngle+90}set alpha(t){this.uniforms.uAlpha=t}get alpha(){return this.uniforms.uAlpha}set maxColors(t){this.uniforms.uMaxColors=t}get maxColors(){return this.uniforms.uMaxColors}set replace(t){this.uniforms.uReplace=t}get replace(){return this.uniforms.uReplace}};let fh=dh;fh.LINEAR=0,fh.RADIAL=1,fh.CONIC=2,fh.defaults={type:dh.LINEAR,stops:[{offset:0,color:16711680,alph
1a:1},{offset:1,color:255,alpha:1}],alpha:1,angle:90,maxColors:0,replace:!1};const ph=class extends ri{constructor(t){super("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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n    vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n    vec2 dir = vec2(vTextureCoord.xy * filterArea.xy / dimensions - vec2(0.5, 0.5));\n    \n    gl_FragColor = texture2D(uSampler, vTextureCoord);\n    vec3 rgb = gl_FragColor.rgb;\n\n    if (noise > 0.0 && noiseSize > 0.0)\n    {\n        pixelCoord.x = floor(pixelCoord.x / noiseSize);\n        pixelCoord.y = floor(pixelCoord.y / noiseSize);\n        float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n        rgb += _noise * noise;\n    }\n\n    if (lineWidth > 0.0)\n    {\n        float _c = curvature > 0. ? curvature : 1.;\n        float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n        vec2 uv = dir * k;\n\n        float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n        float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n        rgb *= j;\n        float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n        rgb *= 0.99 + ceil(segment) * 0.015;\n    }\n\n    if (vignetting > 0.0)\n    {\n        float outter = SQRT_2 - vignetting * SQRT_2;\n        float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n        rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n    }\n\n    gl_FragColor.rgb = rgb;\n}\n"),this.time=0,this.seed=0,this.uniforms.dimensions=new Float32Array(2),Object.assign(this,ph.defaults,t)}apply(t,e,i,r){const{width:s,height:n}=e.filterFrame;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=n,this.uniforms.seed=this.seed,this.uniforms.time=this.time,t.applyFilter(this,e,i,r)}set curvature(t){this.uniforms.curvature=t}get curvature(){return this.uniforms.curvature}set lineWidth(t){this.uniforms.lineWidth=t}get lineWidth(){return this.uniforms.lineWidth}set lineContrast(t){this.uniforms.lineContrast=t}get lineContrast(){return this.uniforms.lineContrast}set verticalLine(t){this.uniforms.verticalLine=t}get verticalLine(){return this.uniforms.verticalLine}set noise(t){this.uniforms.noise=t}get noise(){return this.uniforms.noise}set noiseSize(t){this.uniforms.noiseSize=t}get noiseSize(){return this.uniforms.noiseSize}set vignetting(t){this.uniforms.vignetting=t}get vignetting(){return this.uniforms.vignetting}set vignettingAlpha(t){this.uniforms.vignettingAlpha=t}get vignettingAlpha(){return this.uniforms.vignettingAlpha}set vignettingBlur(t){this.uniforms.vignettingBlur=t}get vignettingBlur(){return this.uniforms.vignettingBlur}};ph.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0};var mh=Object.defineProperty,gh=Object.getOwnPropertySymbols,_h=Object.prototype.hasOwnProperty,vh=Object.prototype.propertyIsEnumerable,xh=(t,e,
1i)=>e in t?mh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yh=(t,e)=>{for(var i in e||(e={}))_h.call(e,i)&&xh(t,i,e[i]);if(gh)for(var i of gh(e))vh.call(e,i)&&xh(t,i,e[i]);return t};const bh=class extends ri{constructor(t){super(),this.angle=45,this._distance=5,this._resolution=T.FILTER_RESOLUTION;const e=t?yh(yh({},bh.defaults),t):bh.defaults,{kernels:i,blur:r,quality:s,pixelSize:n,resolution:o}=e;this._offset=new Ee(this._updatePadding,this),this._tintFilter=new ri("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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n    vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n    // Premultiply alpha\n    sample.rgb = color.rgb * sample.a;\n\n    // alpha user alpha\n    sample *= alpha;\n\n    gl_FragColor = sample;\n}"),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=this._offset,this._tintFilter.resolution=o,this._blurFilter=i?new Ha(i):new Ha(r,s),this.pixelSize=n,this.resolution=o;const{shadowOnly:a,rotation:h,distance:l,offset:u,alpha:c,color:d}=e;this.shadowOnly=a,void 0!==h&&void 0!==l?(this.rotation=h,this.distance=l):this.offset=u,this.alpha=c,this.color=d}apply(t,e,i,r){const s=t.getFilterTexture();this._tintFilter.apply(t,e,s,1),this._blurFilter.apply(t,s,i,r),!0!==this.shadowOnly&&t.applyFilter(this,e,i,0),t.returnFilterTexture(s)}_updatePadding(){const t=Math.max(Math.abs(this._offset.x),Math.abs(this._offset.y));this.padding=t+2*this.blur}_updateShift(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))}set offset(t){this._offset.copyFrom(t),this._updatePadding()}get offset(){return this._offset}get resolution(){return this._resolution}set resolution(t){this._resolution=t,this._tintFilter&&(this._tintFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)}get distance(){return this._distance}set distance(t){S("5.3.0","DropShadowFilter distance is deprecated, use offset"),this._distance=t,this._updatePadding(),this._updateShift()}get rotation(){return this.angle/ne}set rotation(t){S("5.3.0","DropShadowFilter rotation is deprecated, use offset"),this.angle=t*ne,this._updateShift()}get alpha(){return this._tintFilter.uniforms.alpha}set alpha(t){this._tintFilter.uniforms.alpha=t}get color(){return ut(this._tintFilter.uniforms.color)}set color(t){at(t,this._tintFilter.uniforms.color)}get kernels(){return this._blurFilter.kernels}set kernels(t){this._blurFilter.kernels=t}get blur(){return this._blurFilter.blur}set blur(t){this._blurFilter.blur=t,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(t){this._blurFilter.quality=t}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(t){this._blurFilter.pixelSize=t}};bh.defaults={offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:T.FILTER_RESOLUTION};const Th=class extends ri{constructor(t){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n    vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n    if (coord.x > 1.0 || coord.y > 1.0) {\n        return;\n    }\n\n    float cx = coord.x - 0.5;\n    float cy = (coord.y - 0.5) * aspect;\n    float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n    // displacementMap: repeat\n    // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n    // displacementMap: mirror\n    ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n    vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n    float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n    coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n    if (fillMode == CLAMP) {\n        coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n    } else {\n        if( coord.x > filterClamp.z ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.x -= filterClamp.z;\n            } else if (fillMode == MIRROR) {\n                coord.x = filterClamp.z * 2.0 - coord.x;\n            }\n        } else if( coord.x < filterClamp.x ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.x += filterClamp.z;\n            } else if (fillMode == MIRROR) {\n                coord.x *= -filterClamp.z;\n            }\n        }\n\n        if( coord.y > filterClamp.w ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.y -= filterClamp.w;\n            } else if (fillMode == MIRROR) {\n                coord.y = filterClamp.w * 2.0 - coord.y;\n            }\n        } else if( coord.y < filterClamp.y ) {\n            if (fillMode == TRANSPARENT) {\n                discard;\n            } else if (fillMode == LOOP) {\n                coord.y += filterClamp.w;\n            } else if (fillMode == MIRROR) {\n                coord.y *= -filterClamp.w;\n            }\n        }\n    }\n\n    gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n    gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n    gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n    gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n"),this.offset=100,this.fillMode=Th.TRANSPARENT,this.average=!1,this.seed=0,this.minSize=8,this.sampleSize=512,this._slices=0,this._offsets=new Float32Array(1),this._sizes=new Float32Array(1),this._direction=-1,this.uniforms.dimensions=new Float32Array(2),this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=mi.from(this._canvas,{scaleMode:d.NEAREST}),Object.assign(this,Th.defaults,t)}apply(t,e,i,r){const{width:s,height:n}=e.filterFrame;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=n,this.uniforms.aspect=n/s,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,t.applyFilter(this,e,i,r)}_randomizeSizes(){const t=this._sizes,e=this._slices-1,i=this.sampleSize,r=Math.min(this.minSize/i,.9/this._slices);if(this.average){const i=this._slices;let s=1;for(let n=0;n<e;n++){const e=s/(i-n),o=Math.max(e*(1-.6*Math.random()),r);t[n]=o,s-=o}t[e]=s}else{let i=1;const s=Math.sqrt(1/this._slices);for(let n=0;n<e;n++){const e=Math.max(s*i*Math.random(),r);t[n]=e,i-=e}t[e]=i}this.shuffle()}shuffle(){const t=this._sizes;for(let e=this._slices-1;e>0;e--){const i=Math.random()*e>>0,r=t[e];t[e]=t[i],t[i]=r}}_randomizeOffsets(){for(let t=0;t<this._slices;t++)this._offsets[t]=Math.random()*(Math.random()<.5?-1:1)}refresh(){this._randomizeSizes(),this._randomizeOffsets(),this.redraw()}redraw(){const t=this.sampleSize,e=this.texture,i=this._canvas.getContext("2d");i.clearRect(0,0,8,t);let r,s=0;for(let e=0;e<this._slices;e++){r=Math.floor(256*this._offsets[e]);const n=this._sizes[e]*t,o=r>0?r:0,a=r<0?-r:0;i.fillStyle=`rgba(${o}, ${a}, 0, 1)`,i.fillRect(0,s>>0,t,n+1>>0),s+=n}
1e.baseTexture.update(),this.uniforms.displacementMap=e}set sizes(t){const e=Math.min(this._slices,t.length);for(let i=0;i<e;i++)this._sizes[i]=t[i]}get sizes(){return this._sizes}set offsets(t){const e=Math.min(this._slices,t.length);for(let i=0;i<e;i++)this._offsets[i]=t[i]}get offsets(){return this._offsets}get slices(){return this._slices}set slices(t){this._slices!==t&&(this._slices=t,this.uniforms.slices=t,this._sizes=this.uniforms.slicesWidth=new Float32Array(t),this._offsets=this.uniforms.slicesOffset=new Float32Array(t),this.refresh())}get direction(){return this._direction}set direction(t){if(this._direction===t)return;this._direction=t;const e=t*ne;this.uniforms.sinDir=Math.sin(e),this.uniforms.cosDir=Math.cos(e)}get red(){return this.uniforms.red}set red(t){this.uniforms.red=t}get green(){return this.uniforms.green}set green(t){this.uniforms.green=t}get blue(){return this.uniforms.blue}set blue(t){this.uniforms.blue=t}destroy(){var t;null==(t=this.texture)||t.destroy(!0),this.texture=this._canvas=this.red=this.green=this.blue=this._sizes=this._offsets=null}};let Eh=Th;Eh.defaults={slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},Eh.TRANSPARENT=0,Eh.ORIGINAL=1,Eh.LOOP=2,Eh.CLAMP=3,Eh.MIRROR=4;var Ah="varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float outerStrength;\nuniform float innerStrength;\n\nuniform vec4 glowColor;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform bool knockout;\nuniform float alpha;\n\nconst float PI = 3.14159265358979323846264;\n\nconst float DIST = __DIST__;\nconst float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.0);\nconst float ANGLE_STEP_NUM = ceil(PI * 2.0 / ANGLE_STEP_SIZE);\n\nconst float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.0) / 2.0;\n\nvoid main(void) {\n    vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\n    float totalAlpha = 0.0;\n\n    vec2 direction;\n    vec2 displaced;\n    vec4 curColor;\n\n    for (float angle = 0.0; angle < PI * 2.0; angle += ANGLE_STEP_SIZE) {\n       direction = vec2(cos(angle), sin(angle)) * px;\n\n       for (float curDistance = 0.0; curDistance < DIST; curDistance++) {\n           displaced = clamp(vTextureCoord + direction * \n                   (curDistance + 1.0), filterClamp.xy, filterClamp.zw);\n\n           curColor = texture2D(uSampler, displaced);\n\n           totalAlpha += (DIST - curDistance) * curColor.a;\n       }\n    }\n    \n    curColor = texture2D(uSampler, vTextureCoord);\n\n    float alphaRatio = (totalAlpha / MAX_TOTAL_ALPHA);\n\n    float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * curColor.a;\n    float innerGlowStrength = min(1.0, innerGlowAlpha);\n    \n    vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n\n    float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a);\n    float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);\n\n    if (knockout) {\n      float resultAlpha = (outerGlowAlpha + innerGlowAlpha) * alpha;\n      gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n    }\n    else {\n      vec4 outerGlowColor = outerGlowStrength * glowColor.rgba * alpha;\n      gl_FragColor = innerColor + outerGlowColor;\n    }\n}\n";const Sh=class extends ri{constructor(t){const e=Object.assign({},Sh.defaults,t),{outerStrength:i,innerStrength:r,color:s,knockout:n,quality:o,alpha:a}=e,h=Math.round(e.distance);super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}",Ah.replace(/__ANGLE_STEP_SIZE__/gi,`${(1/o/h).toFixed(7)}`).replace(/__DIST__/gi,`${h.toFixed(0)}.0`)),this.uniforms.glowColor=new Float32Array([0,0,0,1]),this.uniforms.alpha=1,Object.assign(this,{color:s,outerStrength:i,innerStrength:r,padding:h,knockout:n,alpha:a})}get color(){return ut(this.uniforms.glowColor)}set color(t){at(t,this.uniforms.glowColor)}get outerStrength(){return this.uniforms.outerStrength}set outerStrength(t){this.uniforms.outerStrength=t}get innerStrength(){return this.uniforms.innerStrength}set innerStrength(t){this.uniforms.innerStrength=t}get knockout(){return this.uniforms.knockout}set knockout(t){this.uniforms.knockout=t}get alpha(){return this.uniforms.alpha}set alpha(t){this.uniforms.alpha=t}};let wh=Sh;wh.defaults={distance:10,outerStrength:4,innerStrength:0,color:16777215,quality:.1,knockout:!1,alpha:1};var Ch="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform vec2 light;\nuniform bool parallel;\nuniform float aspect;\n\nuniform float gain;\nuniform float lacunarity;\nuniform float time;\nuniform float alpha;\n\n${perlin}\n\nvoid main(void) {\n    vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n    float d;\n\n    if (parallel) {\n        float _cos = light.x;\n        float _sin = light.y;\n        d = (_cos * coord.x) + (_sin * coord.y * aspect);\n    } else {\n        float dx = coord.x - light.x / dimensions.x;\n        float dy = (coord.y - light.y / dimensions.y) * aspect;\n        float dis = sqrt(dx * dx + dy * dy) + 0.00001;\n        d = dy / dis;\n    }\n\n    vec3 dir = vec3(d, d, 0.0);\n\n    float noise = turb(dir + vec3(time, 0.0, 62.1 + time) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n    noise = mix(noise, 0.0, 0.3);\n    //fade vertically.\n    vec4 mist = vec4(noise, noise, noise, 1.0) * (1.0 - coord.y);\n    mist.a = 1.0;\n    // apply user alpha\n    mist *= alpha;\n\n    gl_FragColor = texture2D(uSampler, vTextureCoord) + mist;\n\n}\n";const Ph=class extends ri{constructor(t){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}",Ch.replace("${perlin}","vec3 mod289(vec3 x)\n{\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x)\n{\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 permute(vec4 x)\n{\n    return mod289(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\n    return 1.79284291400159 - 0.85373472095314 * r;\n}\nvec3 fade(vec3 t)\n{\n    return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\n// Classic Perlin noise, periodic variant\nfloat pnoise(vec3 P, vec3 rep)\n{\n    vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n    vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n    Pi0 = mod289(Pi0);\n    Pi1 = mod289(Pi1);\n    vec3 Pf0 = fract(P); // Fractional part for interpolation\n    vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n    vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n    vec4 iy = vec4(Pi0.yy, Pi1.yy);\n    vec4 iz0 = Pi0.zzzz;\n    vec4 iz1 = Pi1.zzzz;\n    vec4 ixy = permute(permute(ix) + iy);\n    vec4 ixy0 = permute(ixy + iz0);\n    vec4 ixy1 = permute(ixy + iz1);\n    vec4 gx0 = ixy0 * (1.0 / 7.0);\n    vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n    gx0 = fract(gx0);\n    vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n    vec4 sz0 = step(gz0, vec4(0.0));\n    gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n    gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n    vec4 gx1 = ixy1 * (1.0 / 7.0);\n    vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n    gx1 = fract(gx1);\n    vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n    vec4 sz1 = step(gz1, vec4(0.0));\n    gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n    gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n    vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n    vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n    vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n    vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n    vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n    vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n    vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n    vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n    vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n    g000 *= norm0.x;\n    g010 *= norm0.y;\n    g100 *= norm0.z;\n    g110 *= norm0.w;\n    vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n    g001 *= norm1.x;\n    g011 *= norm1.y;\n    g101 *= norm1.z;\n    g111 *= norm1.w;\n    float n000 = dot(g000, Pf0);\n    float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n    float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n    float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n    float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n    float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n    float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n    float n111 = dot(g111, Pf1);\n    vec3 fade_xyz = fade(Pf0);\n    vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n    vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n    float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n    return 2.2 * n_xyz;\n}\nfloat turb(vec3 P, vec3 rep, float lacunarity, float gain)\n{\n    float sum = 0.0;\n    float sc = 1.0;\n    float totalgain = 1.0;\n    for (float i = 0.0; i < 6.0; i++)\n    {\n        sum += totalgain * pnoise(P * sc, rep);\n        sc *= lacunarity;\n        totalgain *= gain;\n    }\n    return abs(sum);\n}\n")),this.parallel=!0,this.time=0,this._angle=0,this.uniforms.dimensions=new Float32Array(2);const e=Object.assign(Ph.defaults,t);this._angleLight=new ae,this.angle=e.angle,this.gain=e.gain,this.lacunarity=e.lacunarity,this.alpha=e.alpha,this.parallel=e.parallel,this.center=e.center,this.time=e.time}apply(t,e,i,r){const{width:s,height:n}=e.filterFrame;this.uniforms.light=this.parallel?this._angleLight:this.center,this.uniforms.parallel=this.parallel,this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=n,this.uniforms.aspect=n/s,this.uniforms.time=this.time,this.uniforms.alpha=this.alpha,t.applyFilter(this,e,i,r)}get angle(){return this._angle}set angle(t){this._angle=t;const e=t*ne;this._angleLight.x=Math.cos(e),this._angleLight.y=Math.sin(e)}get gain(){return this.uniforms.gain}set gain(t){this.uniforms.gain=t}get lacunarity(){return this.uniforms.lacunarity}set lacunarity(t){this.uniforms.lacunarity=t}get alpha(){return this.uniforms.alpha}set alpha(t){this.uniforms.alpha=t}};Ph.defaults={angle:30,gain:.5,lacunarity:2.5,time:0,parallel:!0,center:[0,0],alpha:1};const Rh=class extends ri{constructor(t){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float uHue;\nuniform float uAlpha;\nuniform bool uColorize;\nuniform float uSaturation;\nuniform float uLightness;\n\n// https://en.wikipedia.org/wiki/Luma_(video)\nconst vec3 weight = vec3(0.299, 0.587, 0.114);\n\nfloat getWeightedAverage(vec3 rgb) {\n    return rgb.r * weight.r + rgb.g * weight.g + rgb.b * weight.b;\n}\n\n// https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3195243#gistcomment-3195243\nconst vec3 k = vec3(0.57735, 0.57735, 0.57735);\n\nvec3 hueShift(vec3 color, float angle) {\n    float cosAngle = cos(angle);\n    return vec3(\n    color * cosAngle +\n    cross(k, color) * sin(angle) +\n    k * dot(k, color) * (1.0 - cosAngle)\n    );\n}\n\nvoid main()\n{\n    vec4 color = texture2D(uSampler, vTextureCoord);\n    vec4 result = color;\n\n    // colorize\n    if (uColorize) {\n        result.rgb = vec3(getWeightedAverage(result.rgb), 0., 0.);\n    }\n\n    // hue\n    result.rgb = hueShift(result.rgb, uHue);\n\n    // saturation\n    // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/huesaturation.js\n    float average = (result.r + result.g + result.b) / 3.0;\n\n    if (uSaturation > 0.) {\n        result.rgb += (average - result.rgb) * (1. - 1. / (1.001 - uSaturation));\n    } else {\n        result.rgb -= (average - result.rgb) * uSaturation;\n    }\n\n    // lightness\n    result.rgb = mix(result.rgb, vec3(ceil(uLightness)) * color.a, abs(uLightness));\n\n    // alpha\n    gl_FragColor = mix(color, result, uAlpha);\n}\n"),this._hue=0;const e=Object.assign({},Rh.defaults,t);Object.assign(this,e)}get hue(){return this._hue}set hue(t){this._hue=t,this.uniforms.uHue=this._hue*(Math.PI/180)}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}get colorize(){return this.uniforms.uColorize}set colorize(t){this.uniforms.uColorize=t}get lightness(){return this.uniforms.uLightness}set lightness(t){this.uniforms.uLightness=t}get saturation(){return this.uniforms.uSaturation}set saturation(t){this.uniforms.uSaturation=t}};Rh.defaults={hue:0,saturation:0,lightness:0,colorize:!1,alpha:1};const Ih=class extends ri{constructor(t,e=0){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nuniform float sepia;\nuniform float noise;\nuniform float noiseSize;\nuniform float scratch;\nuniform float scratchDensity;\nuniform float scratchWidth;\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\nuniform float seed;\n\nconst float SQRT_2 = 1.414213;\nconst vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n\nfloat rand(vec2 co) {\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvec3 Overlay(vec3 src, vec3 dst)\n{\n    // if (dst <= 0.5) then: 2 * src * dst\n    // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n    return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n                (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n                (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord);\n    vec3 color = gl_FragColor.rgb;\n\n    if (sepia > 0.0)\n    {\n        float gray = (color.x + color.y + color.z) / 3.0;\n        vec3 grayscale = vec3(gray);\n\n        color = Overlay(SEPIA_RGB, grayscale);\n\n        color = grayscale + sepia * (color - grayscale);\n    }\n\n    vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n    if (vignetting > 0.0)\n    {\n        float outter = SQRT_2 - vignetting * SQRT_2;\n        vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n        dir.y *= dimensions.y / dimensions.x;\n        float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n        color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n    }\n\n    if (scratchDensity > seed && scratch != 0.0)\n    {\n        float phase = seed * 256.0;\n        float s = mod(floor(phase), 2.0);\n        float dist = 1.0 / scratchDensity;\n        float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n        if (d < seed * 0.6 + 0.4)\n        {\n            highp float period = scratchDensity * 10.0;\n\n            float xx = coord.x * period + phase;\n            float aa = abs(mod(xx, 0.5) * 4.0);\n            float bb = mod(floor(xx / 0.5), 2.0);\n            float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n            float kk = 2.0 * period;\n            float dw = scratchWidth / dimensions.x * (0.75 + seed);\n            float dh = dw * kk;\n\n            float tine = (yy - (2.0 - dh));\n\n            if (tine > 0.0) {\n                float _sign = sign(scratch);\n\n                tine = s * tine / period + scratch + 0.1;\n                tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n                color.rgb *= tine;\n            }\n        }\n    }\n\n    if (noise > 0.0 && noiseSize > 0.0)\n    {\n        vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n        pixelCoord.x = floor(pixelCoord.x / noiseSize);\n        pixelCoord.y = floor(pixelCoord.y / noiseSize);\n        // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n        // float _noise = snoise(d) * 0.5;\n        float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n        color += _noise * noise;\n    }\n\n    gl_FragColor.rgb = color;\n}\n"),this.seed=0,this.uniforms.dimensions=new Float32Array(2),"number"==typeof t?(this.seed=t,t=void 0):this.seed=e,Object.assign(this,Ih.defaults,t)}apply(t,e,i,r){var s,n;this.uniforms.dimensions[0]=null==(s=e.filterFrame)?void 0:s.width,this.uniforms.dimensions[1]=null==(n=e.filterFrame)?void 0:n.height,this.uniforms.seed=this.seed,t.applyFilter(this,e,i,r)}set sepia(t){this.uniforms.sepia=t}get sepia(){return this.uniforms.sepia}set noise(t){this.uniforms.noise=t}get noise(){return this.uniforms.noise}set noiseSize(t){this.uniforms.noiseSize=t}get noiseSize(){return this.uniforms.noiseSize}set scratch(t){this.uniforms.scratch=t}get scratch(){return this.uniforms.scratch}set scratchDensity(t){this.uniforms.scratchDensity=t}get scratchDensity(){return this.uniforms.scratchDensity}set scratchWidth(t){this.uniforms.scratchWidth=t}get scratchWidth(){return this.uniforms.scratchWidth}set vignetting(t){this.uniforms.vignetting=t}get vignetting(){return this.uniforms.vignetting}set vignettingAlpha(t){this.uniforms.vignettingAlpha=t}get vignettingAlpha(){return this.uniforms.vignettingAlpha}set vignettingBlur(t){this.uniforms.vignettingBlur=t}get vignettingBlur(){return this.uniforms.vignettingBlur}};Ih.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3};var Mh="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterClamp;\n\nuniform float uAlpha;\nuniform vec2 uThickness;\nuniform vec4 uColor;\nuniform bool uKnockout;\n\nconst float DOUBLE_PI = 2. * 3.14159265358979323846264;\nconst float ANGLE_STEP = ${angleStep};\n\nfloat outlineMaxAlphaAtPos(vec2 pos) {\n    if (uThickness.x == 0. || uThickness.y == 0.) {\n        return 0.;\n    }\n\n    vec4 displacedColor;\n    vec2 displacedPos;\n    float maxAlpha = 0.;\n\n    for (float angle = 0.; angle <= DOUBLE_PI; angle += ANGLE_STEP) {\n        displacedPos.x = vTextureCoord.x + uThickness.x * cos(angle);\n        displacedPos.y = vTextureCoord.y + uThickness.y * sin(angle);\n        displacedColor = texture2D(uSampler, clamp(displacedPos, filterClamp.xy, filterClamp.zw));\n        maxAlpha = max(maxAlpha, displacedColor.a);\n    }\n\n    return maxAlpha;\n}\n\nvoid main(void) {\n    vec4 sourceColor = texture2D(uSampler, vTextureCoord);\n    vec4 contentColor = sourceColor * float(!uKnockout);\n    float outlineAlpha = uAlpha * outlineMaxAlphaAtPos(vTextureCoord.xy) * (1.-sourceColor.a);\n    vec4 outlineColor = vec4(vec3(uColor) * outlineAlpha, outlineAlpha);\n    gl_FragColor = contentColor + outlineColor;\n}\n";const Dh=class extends ri{constructor(t=1,e=0,i=.1,r=1,s=!1){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}",Mh.replace(/\$\{angleStep\}/,Dh.getAngleStep(i))),this._thickness=1,this._alpha=1,this._knockout=!1,this.uniforms.uThickness=new Float32Array([0,0]),this.uniforms.uColor=new Float32Array([0,0,0,1]),this.uniforms.uAlpha=r,this.uniforms.uKnockout=s,Object.assign(this,{thickness:t,color:e,quality:i,alpha:r,knockout:s})}static getAngleStep(t){const e=Math.max(t*Dh.MAX_SAMPLES,Dh.MIN_SAMPLES);return(2*Math.PI/e).toFixed(7)}apply(t,e,i,r){this.uniforms.uThickness[0]=this._thickness/e._frame.width,this.uniforms.uThickness[1]=this._thickness/e._frame.height,this.uniforms.uAlpha=this._alpha,this.uniforms.uKnockout=this._knockout,t.applyFilter(this,e,i,r)}get alpha(){return this._alpha}set alpha(t){this._alpha=t}get color(){return ut(this.uniforms.uColor)}set color(t){at(t,this.uniforms.uColor)}get knockout(){return this._knockout}set knockout(t){this._knockout=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t,this.padding=t}};let Fh=Dh;Fh.MIN_SAMPLES=1,Fh.MAX_SAMPLES=100;const Bh=class extends ri{constructor(t){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n    vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n    vec2 coord = pixelCoord / dimensions;\n\n    if (coord.y < boundary) {\n        gl_FragColor = texture2D(uSampler, vTextureCoord);\n        return;\n    }\n\n    float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n    float areaY = boundary * dimensions.y / filterArea.y;\n    float v = areaY + areaY - vTextureCoord.y;\n    float y = mirror ? v : vTextureCoord.y;\n\n    float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n    float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n    float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n    float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n    x = clamp(x, filterClamp.x, filterClamp.z);\n\n    vec4 color = texture2D(uSampler, vec2(x, y));\n\n    gl_FragColor = color * _alpha;\n}\n"),this.time=0,this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,Bh.defaults,t)}apply(t,e,i,r){var s,n;this.uniforms.dimensions[0]=null==(s=e.filterFrame)?void 0:s.width,this.uniforms.dimensions[1]=null==(n=e.filterFrame)?void 0:n.height,this.uniforms.time=this.time,t.applyFilter(this,e,i,r)}set mirror(t){this.uniforms.mirror=t}get mirror(){return this.uniforms.mirror}set boundary(t){this.uniforms.boundary=t}get boundary(){return this.uniforms.boundary}set amplitude(t){this.uniforms.amplitude[0]=t[0],this.uniforms.amplitude[1]=t[1]}get amplitude(){return this.uniforms.amplitude}set waveLength(t){this.uniforms.waveLength[0]=t[0],this.uniforms.waveLength[1]=t[1]}get waveLength(){return this.uniforms.waveLength}set alpha(t){this.uniforms.alpha[0]=t[0],this.uniforms.alpha[1]=t[1]}get alpha(){return this.uniforms.alpha}};Bh.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0};class Lh extends ri{constructor(t=[-10,0],e=[0,10],i=[0,0]){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n   gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n   gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n   gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n   gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n"),this.red=t,this.green=e,this.blue=i}get red(){return this.uniforms.red}set red(t){this.uniforms.red=t}get green(){return this.uniforms.green}set green(t){this.uniforms.green=t}get blue(){return this.uniforms.blue}set blue(t){this.uniforms.blue=t}}const Oh=class extends ri{constructor(t=[0,0],e,i=0){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n    float halfWavelength = wavelength * 0.5 / filterArea.x;\n    float maxRadius = radius / filterArea.x;\n    float currentRadius = time * speed / filterArea.x;\n\n    float fade = 1.0;\n\n    if (maxRadius > 0.0) {\n        if (currentRadius > maxRadius) {\n            gl_FragColor = texture2D(uSampler, vTextureCoord);\n            return;\n        }\n        fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n    }\n\n    vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n    dir.y *= filterArea.y / filterArea.x;\n    float dist = length(dir);\n\n    if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n        gl_FragColor = texture2D(uSampler, vTextureCoord);\n        return;\n    }\n\n    vec2 diffUV = normalize(dir);\n\n    float diff = (dist - currentRadius) / halfWavelength;\n\n    float p = 1.0 - pow(abs(diff), 2.0);\n\n    // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n    float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n    vec2 offset = diffUV * powDiff / filterArea.xy;\n\n    // Do clamp :\n    vec2 coord = vTextureCoord + offset;\n    vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n    vec4 color = texture2D(uSampler, clampedCoord);\n    if (coord != clampedCoord) {\n        color *= max(0.0, 1.0 - length(coord - clampedCoord));\n    }\n\n    // No clamp :\n    // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n    color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n    gl_FragColor = color;\n}\n"),this.center=t,Object.assign(this,Oh.defaults,e),this.time=i}apply(t,e,i,r){this.uniforms.time=this.time,t.applyFilter(this,e,i,r)}get center(){return this.uniforms.center}set center(t){this.uniforms.center=t}get amplitude(){return this.uniforms.amplitude}set amplitude(t){this.uniforms.amplitude=t}get wavelength(){return this.uniforms.wavelength}set wavelength(t){this.uniforms.wavelength=t}get brightness(){return this.uniforms.brightness}set brightness(t){this.uniforms.brightness=t}get speed(){return this.uniforms.speed}set speed(t){this.uniforms.speed=t}get radius(){return this.uniforms.radius}set radius(t){this.uniforms.radius=t}};Oh.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1};class Nh extends ri{constructor(t){var e,i;super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n    return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n    vec4 color = vec4(0.0);\n    float total = 0.0;\n\n    float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n    vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n    float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n    for (float t = -30.0; t <= 30.0; t++)\n    {\n        float percent = (t + offset - 0.5) / 30.0;\n        float weight = 1.0 - abs(percent);\n        vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n        sample.rgb *= sample.a;\n        color += sample * weight;\n        total += weight;\n    }\n\n    color /= total;\n    color.rgb /= color.a + 0.00001;\n\n    gl_FragColor = color;\n}\n"),this.uniforms.blur=t.blur,this.uniforms.gradientBlur=t.gradientBlur,this.uniforms.start=null!=(e=t.start)?e:new ae(0,window.innerHeight/2),this.uniforms.end=null!=(i=t.end)?i:new ae(600,window.innerHeight/2),this.uniforms.delta=new ae(30,30),this.uniforms.texSize=new ae(window.innerWidth,window.innerHeight),this.updateDelta()}updateDelta(){this.uniforms.delta.x=0,this.uniforms.delta.y=0}get blur(){return this.uniforms.blur}set blur(t){this.uniforms.blur=t}get gradientBlur(){return this.uniforms.gradientBlur}set gradientBlur(t){this.uniforms.gradientBlur=t}get start(){return this.uniforms.start}set start(t){this.uniforms.start=t,this.updateDelta()}get end(){return this.uniforms.end}set end(t){this.uniforms.end=t,this.updateDelta()}}class kh extends Nh{updateDelta(){const t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+e*e);this.uniforms.delta.x=t/i,this.uniforms.delta.y=e/i}}class Uh extends Nh{updateDelta(){const t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+e*e);this.uniforms.delta.x=-e/i,this.uniforms.delta.y=t/i}}const Gh=class extends ri{constructor(t,e,i,r){super(),"number"==typeof t&&(S("5.3.0","TiltShiftFilter constructor arguments is deprecated, use options."),t={blur:t,gradientBlur:e,start:i,end:r}),t=Object.assign({},Gh.defaults,t),this.tiltShiftXFilter=new kh(t),this.tiltShiftYFilter=new Uh(t)}apply(t,e,i,r){const s=t.getFilterTexture();this.tiltShiftXFilter.apply(t,e,s,1),this.tiltShiftYFilter.apply(t,s,i,r),t.returnFilterTexture(s)}get blur(){return this.tiltShiftXFilter.blur}set blur(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t}get gradientBlur(){return this.tiltShiftXFilter.gradientBlur}set gradientBlur(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t}get start(){return this.tiltShiftXFilter.start}set start(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t}get end(){return this.tiltShiftXFilter.end}set end(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t}};Gh.defaults={blur:100,gradientBlur:600,start:void 0,end:void 0};const zh=class extends ri{constructor(t){super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n    coord *= filterArea.xy;\n    coord += filterArea.zw;\n\n    return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n    coord -= filterArea.zw;\n    coord /= filterArea.xy;\n\n    return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n    coord -= offset;\n\n    float dist = length(coord);\n\n    if (dist < radius)\n    {\n        float ratioDist = (radius - dist) / radius;\n        float angleMod = ratioDist * ratioDist * angle;\n        float s = sin(angleMod);\n        float c = cos(angleMod);\n        coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n    }\n\n    coord += offset;\n\n    return coord;\n}\n\nvoid main(void)\n{\n\n    vec2 coord = mapCoord(vTextureCoord);\n\n    coord = twist(coord);\n\n    coord = unmapCoord(coord);\n\n    gl_FragColor = texture2D(uSampler, coord );\n\n}\n"),Object.assign(this,zh.defaults,t)}get offset(){return this.uniforms.offset}set offset(t){this.uniforms.offset=t}get radius(){return this.uniforms.radius}set radius(t){this.uniforms.radius=t}get angle(){return this.uniforms.angle}set angle(t){this.uniforms.angle=t}};
1zh.defaults={radius:200,angle:4,padding:20,offset:new ae};var Hh="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = ${maxKernelSize};\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n    const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n    highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n    return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n    float minGradient = uInnerRadius * 0.3;\n    float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n    float gradient = uRadius * 0.3;\n    float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n    float countLimit = MAX_KERNEL_SIZE;\n\n    vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n    float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n    float strength = uStrength;\n\n    float delta = 0.0;\n    float gap;\n    if (dist < innerRadius) {\n        delta = innerRadius - dist;\n        gap = minGradient;\n    } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n        delta = dist - radius;\n        gap = gradient;\n    }\n\n    if (delta > 0.0) {\n        float normalCount = gap / filterArea.x;\n        delta = (normalCount - delta) / normalCount;\n        countLimit *= delta;\n        strength *= delta;\n        if (countLimit < 1.0)\n        {\n            gl_FragColor = texture2D(uSampler, vTextureCoord);\n            return;\n        }\n    }\n\n    // randomize the lookup values to hide the fixed number of samples\n    float offset = rand(vTextureCoord, 0.0);\n\n    float total = 0.0;\n    vec4 color = vec4(0.0);\n\n    dir *= strength;\n\n    for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n        float percent = (t + offset) / MAX_KERNEL_SIZE;\n        float weight = 4.0 * (percent - percent * percent);\n        vec2 p = vTextureCoord + dir * percent;\n        vec4 sample = texture2D(uSampler, p);\n\n        // switch to pre-multiplied alpha to correctly blur transparent images\n        // sample.rgb *= sample.a;\n\n        color += sample * weight;\n        total += weight;\n\n        if (t > countLimit){\n            break;\n        }\n    }\n\n    color /= total;\n    // switch back from pre-multiplied alpha\n    // color.rgb /= color.a + 0.00001;\n\n    gl_FragColor = color;\n}\n",Xh=Object.getOwnPropertySymbols,Vh=Object.prototype.hasOwnProperty,jh=Object.prototype.propertyIsEnumerable;const Wh=class extends ri{constructor(t){const e=Object.assign(Wh.defaults,t),{maxKernelSize:i}=e,r=((t,e)=>{var i={};for(var r in t)Vh.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&Xh)for(var r of Xh(t))e.indexOf(r)<0&&jh.call(t,r)&&(i[r]=t[r]);return i})(e,["maxKernelSize"]);super("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
1)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}",Hh.replace("${maxKernelSize}",i.toFixed(1))),Object.assign(this,r)}get center(){return this.uniforms.uCenter}set center(t){this.uniforms.uCenter=t}get strength(){return this.uniforms.uStrength}set strength(t){this.uniforms.uStrength=t}get innerRadius(){return this.uniforms.uInnerRadius}set innerRadius(t){this.uniforms.uInnerRadius=t}get radius(){return this.uniforms.uRadius}set radius(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t}};let $h=Wh;$h.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32};
2/*!
3 * @pixi/particle-emitter - v5.0.8
4 * Compiled Mon, 28 Nov 2022 04:01:38 UTC
5 *
6 * @pixi/particle-emitter is licensed under the MIT License.
7 * http://www.opensource.org/licenses/mit-license
8 */
9class Yh{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,this.ease=i?"function"==typeof i?i:il(i):null}static createList(t){if("list"in t){const e=t.list;let i;const{value:r,time:s}=e[0],n=i=new Yh("string"==typeof r?el(r):r,s,t.ease);if(e.length>2||2===e.length&&e[1].value!==r)for(let t=1;t<e.length;++t){const{value:r,time:s}=e[t];i.next=new Yh("string"==typeof r?el(r):r,s),i=i.next}return n.isStepped=!!t.isStepped,n}const e=new Yh("string"==typeof t.start?el(t.start):t.start,0);return t.end!==t.start&&(e.next=new Yh("string"==typeof t.end?el(t.end):t.end,1)),e}}let qh=mi.from;const Kh=Math.PI/180;function Zh(t,e){if(!t)return;const i=Math.sin(t),r=Math.cos(t),s=e.x*r-e.y*i,n=e.x*i+e.y*r;e.x=s,e.y=n}function Qh(t,e,i){return t<<16|e<<8|i}function Jh(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function tl(t,e){t.x*=e,t.y*=e}function el(t,e){let i;return e||(e={}),"#"===t.charAt(0)?t=t.substr(1):0===t.indexOf("0x")&&(t=t.substr(2)),8===t.length&&(i=t.substr(0,2),t=t.substr(2)),e.r=parseInt(t.substr(0,2),16),e.g=parseInt(t.substr(2,2),16),e.b=parseInt(t.substr(4,2),16),i&&(e.a=parseInt(i,16)),e}function il(t){const e=t.length,i=1/e;return function(r){const s=e*r|0,n=(r-s*i)*e,o=t[s]||t[e-1];return o.s+n*(2*(1-n)*(o.cp-o.s)+n*(o.e-o.s))}}class rl extends Xr{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}var sl;!function(t){t[t.Spawn=0]="Spawn",t[t.Normal=2]="Normal",t[t.Late=5]="Late"}(sl||(sl={}));const nl=gr.shared,ol=Symbol("Position particle per emitter position");class al{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new ae,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new ae,this._prevEmitterPos=new ae,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){al.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){this._frequency="number"==typeof t&&t>0?t:1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase="function"==typeof t.ease?t.ease:il(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance="number"==typeof t.spawnChance&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=void 0===t.emit||!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map((t=>{const e=al.knownBehaviors[t.type];return e?new e(t.config):(console.error(`Unknown behavior: ${t.type}`),null)})).filter((t=>!!t));e.push(ol),e.sort(((t,e)=>t===ol?e.order===sl.Spawn?1:-1:e===ol?t.order===sl.Spawn?-1:1:t.order-e.order)),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter((t=>t!==ol&&t.updateParticle)),this.recycleBehaviors=e.filter((t=>t!==ol&&t.recycleParticle))}getBehavior(t){return al.knownBehaviors[t]&&this.initBehaviors.find((e=>e instanceof al.knownBehaviors[t]))||null}fillPool(t){for(;t>0;--t){const t=new rl(this);t.next=this._poolFirst,this._poolFirst=t}}recycle(t,e=!1){for(let i=0;i<this.recycleBehaviors.length;++i)this.recycleBehaviors[i].recycleParticle(t,!e);t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===this._activeParticlesLast&&(this._activeParticlesLast=t.prev),t===this._activeParticlesFirst&&(this._activeParticlesFirst=t.next),t.prev=null,t.next=this._poolFirst,this._poolFirst=t,t.parent&&t.parent.removeChild(t),--this.particleCount}rotate(t){if(this.rotation===t)return;const e=t-this.rotation;this.rotation=t,Zh(e,this.spawnPos),this._posChanged=!0}updateSpawnPos(t,e){this._posChanged=!0,this.spawnPos.x=t,this.spawnPos.y=e}updateOwnerPos(t,e){this._posChanged=!0,this.ownerPos.x=t,this.ownerPos.y=e}resetPositionTracking(){this._prevPosIsValid=!1}get emit(){return this._emit}set emit(t){this._emit=!!t,this._emitterLife=this.emitterLifetime}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){this._autoUpdate&&!t?nl.remove(this.update,this):!this._autoUpdate&&t&&nl.add(this.update,this),this._autoUpdate=!!t}playOnceAndDestroy(t){this.autoUpdate=!0,this.emit=!0,this._destroyWhenComplete=!0,this._completeCallback=t}playOnce(t){this.emit=!0,this._completeCallback=t}update(t){if(this._autoUpdate&&(t=.001*nl.elapsedMS),!this._parent)return;for(let e,i=this._activeParticlesFirst;i;i=e)if(e=i.next,i.age+=t,i.age>i.maxLife||i.age<0)this.recycle(i);else{let e=i.age*i.oneOverLife;this.customEase&&(e=4===this.customEase.length?this.customEase(e,0,1,1):this.customEase(e)),i.agePercent=e;for(let e=0;e<this.updateBehaviors.length;++e)if(this.updateBehaviors[e].updateParticle(i,t)){this.recycle(i);break}}let e,i;
9this._prevPosIsValid&&(e=this._prevEmitterPos.x,i=this._prevEmitterPos.y);const r=this.ownerPos.x+this.spawnPos.x,s=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let n,o;if(this._prevPosIsValid&&this._posChanged){const a=1+this._spawnTimer/t;n=(r-e)*a+e,o=(s-i)*a+i}else n=r,o=s;let a=null,h=null;for(let t=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),e=0;e<t;++e){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let t,e;(t=this.minLifetime===this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=t)||(this._poolFirst?(e=this._poolFirst,this._poolFirst=this._poolFirst.next,e.next=null):e=new rl(this),e.init(t),this.addAtBack?this._parent.addChildAt(e,0):this._parent.addChild(e),a?(h.next=e,e.prev=h,h=e):h=a=e,++this.particleCount)}
9if(a){this._activeParticlesLast?(this._activeParticlesLast.next=a,a.prev=this._activeParticlesLast,this._activeParticlesLast=h):(this._activeParticlesFirst=a,this._activeParticlesLast=h);for(let t=0;t<this.initBehaviors.length;++t){const e=this.initBehaviors[t];if(e===ol)for(let t,e=a;e;e=t){t=e.next,0!==this.rotation&&(Zh(this.rotation,e.position),e.rotation+=this.rotation),e.position.x+=n,e.position.y+=o,e.age+=-this._spawnTimer;let i=e.age*e.oneOverLife;this.customEase&&(i=4===this.customEase.length?this.customEase(i,0,1,1):this.customEase(i)),e.agePercent=i}else e.initParticles(a)}for(let t,e=a;e;e=t){t=e.next;for(let t=0;t<this.updateBehaviors.length;++t)if(this.updateBehaviors[t].updateParticle(e,-this._spawnTimer)){this.recycle(e);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=r,this._prevEmitterPos.y=s,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const t=this._completeCallback;this._completeCallback=null,t()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let i=null,r=null;for(let t=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),e=0;e<t;++e){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let t,e;this._poolFirst?(t=this._poolFirst,this._poolFirst=this._poolFirst.next,t.next=null):t=new rl(this),e=this.minLifetime===this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,t.init(e),this.addAtBack?this._parent.addChildAt(t,0):this._parent.addChild(t),i?(r.next=t,t.prev=r,r=t):r=i=t,++this.particleCount}if(i){this._activeParticlesLast?(this._activeParticlesLast.next=i,i.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=i,this._activeParticlesLast=r);for(let r=0;r<this.initBehaviors.length;++r){const s=this.initBehaviors[r];if(s===ol)for(let r,s=i;s;s=r)r=s.next,0!==this.rotation&&(Zh(this.rotation,s.position),s.rotation+=this.rotation),s.position.x+=t,s.position.y+=e;else s.initParticles(i)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){let t;this.autoUpdate=!1,this.cleanup();for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}al.knownBehaviors={};class hl{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t){t.x=Math.random()*this.w+this.x,t.y=Math.random()*this.h+this.y}}hl.type="rect",hl.editorConfig=null;class ll{constructor(t){this.x=t.x||0,this.y=t.y||0,this.radius=t.radius,this.innerRadius=t.innerRadius||0,this.rotation=!!t.affectRotation}getRandPos(t){this.innerRadius!==this.radius?t.x=Math.random()*(this.radius-this.innerRadius)+this.innerRadius:t.x=this.radius,t.y=0;const e=Math.random()*Math.PI*2;this.rotation&&(t.rotation+=e),Zh(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}ll.type="torus",ll.editorConfig=null;class ul{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(t&&t.length)if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const i=t[e];let r=i[0];for(let t=1;t<i.length;++t){const e=i[t];this.segments.push({p1:r,p2:e,l:0}),r=e}}else{let e=t[0];for(let i=1;i<t.length;++i){const r=t[i];this.segments.push({p1:e,p2:r,l:0}),e=r}}else this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});for(let t=0;t<this.segments.length;++t){const{p1:e,p2:i}=this.segments[t],r=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y));this.segments[t].l=r,this.totalLength+=r,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let i,r;if(1===this.segments.length)i=this.segments[0],r=e;else for(let t=0;t<this.countingLengths.length;++t)if(e<this.countingLengths[t]){i=this.segments[t],r=0===t?e:e-this.countingLengths[t-1];break}r/=i.l||1;const{p1:s,p2:n}=i;t.x=s.x+r*(n.x-s.x),t.y=s.y+r*(n.y-s.y)}}ul.type="polygonalChain",ul.editorConfig=null;class cl{constructor(t){var e;this.order=sl.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=null!==(e=t.maxSpeed)&&void 0!==e?e:0}initParticles(t){let e=t;for(;e;){const t=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(t,0):e.config.velocity=new ae(t,0),Zh(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity,r=i.x,s=i.y;if(i.x+=this.accel.x*e,i.y+=this.accel.y*e,this.maxSpeed){const t=Jh(i);t>this.maxSpeed&&tl(i,this.maxSpeed/t)}
9t.x+=(r+i.x)/2*e,t.y+=(s+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}}function dl(t){return this.ease&&(t=this.ease(t)),(this.first.next.value-this.first.value)*t+this.first.value}function fl(t){this.ease&&(t=this.ease(t));const e=this.first.value,i=this.first.next.value;return Qh((i.r-e.r)*t+e.r,(i.g-e.g)*t+e.g,(i.b-e.b)*t+e.b)}function pl(t){this.ease&&(t=this.ease(t));let e=this.first,i=e.next;for(;t>i.time;)e=i,i=i.next;return t=(t-e.time)/(i.time-e.time),(i.value-e.value)*t+e.value}function ml(t){this.ease&&(t=this.ease(t));let e=this.first,i=e.next;for(;t>i.time;)e=i,i=i.next;t=(t-e.time)/(i.time-e.time);const r=e.value,s=i.value;return Qh((s.r-r.r)*t+r.r,(s.g-r.g)*t+r.g,(s.b-r.b)*t+r.b)}function gl(t){this.ease&&(t=this.ease(t));let e=this.first;for(;e.next&&t>e.next.time;)e=e.next;return e.value}function _l(t){this.ease&&(t=this.ease(t));let e=this.first;for(;e.next&&t>e.next.time;)e=e.next;const i=e.value;return Qh(i.r,i.g,i.b)}cl.type="moveAcceleration",cl.editorConfig=null;class vl{constructor(t=!1){this.first=null,this.isColor=!!t,this.interpolate=null,this.ease=null}reset(t){this.first=t;t.next&&t.next.time>=1?this.interpolate=this.isColor?fl:dl:t.isStepped?this.interpolate=this.isColor?_l:gl:this.interpolate=this.isColor?ml:pl,this.ease=this.first.ease}}class xl{constructor(t){this.order=sl.Normal,this.list=new vl(!1),this.list.reset(Yh.createList(t.alpha))}initParticles(t){let e=t;for(;e;)e.alpha=this.list.first.value,e=e.next}updateParticle(t){t.alpha=this.list.interpolate(t.agePercent)}}xl.type="alpha",xl.editorConfig=null;class yl{constructor(t){this.order=sl.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}function bl(t){const e=[];for(let i=0;i<t.length;++i){let r=t[i];if("string"==typeof r)e.push(qh(r));else if(r instanceof mi)e.push(r);else{let t=r.count||1;for(r="string"==typeof r.texture?qh(r.texture):r.texture;t>0;--t)e.push(r)}}return e}yl.type="alphaStatic",yl.editorConfig=null;class Tl{constructor(t){this.order=sl.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const i=t.anims[e],r=bl(i.textures),s=i.framerate<0?-1:i.framerate>0?i.framerate:60,n={textures:r,duration:s>0?r.length/s:0,framerate:s,loop:s>0&&!!i.loop};this.anims.push(n)}}initParticles(t){let e=t;for(;e;){const t=Math.floor(Math.random()*this.anims.length),i=e.config.anim=this.anims[t];e.texture=i.textures[0],e.config.animElapsed=0,-1===i.framerate?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}}updateParticle(t,e){const i=t.config,r=i.anim;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(i.anim.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const s=i.animElapsed*i.animFramerate+1e-7|0;t.texture=r.textures[s]||r.textures[r.textures.length-1]||mi.EMPTY}}Tl.type="animatedRandom",Tl.editorConfig=null;class El{constructor(t){this.order=sl.Normal;const e=t.anim,i=bl(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:i,duration:r>0?i.length/r:0,framerate:r,loop:r>0&&!!e.loop}}initParticles(t){let e=t;const i=this.anim;for(;e;)e.texture=i.textures[0],e.config.animElapsed=0,-1===i.framerate?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}updateParticle(t,e){const i=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(i.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const s=r.animElapsed*r.animFramerate+1e-7|0;t.texture=i.textures[s]||i.textures[i.textures.length-1]||mi.EMPTY}}El.type="animatedSingle",El.editorConfig=null;class Al{constructor(t){this.order=sl.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=(i=this.value)?(i=i.toUpperCase().replace(/ /g,"_"),o[i]||o.NORMAL):o.NORMAL,e=e.next;var i}}Al.type="blendMode",Al.editorConfig=null;class Sl{constructor(t){this.order=sl.Spawn,this.spacing=t.spacing*Kh,this.start=t.start*Kh,this.distance=t.distance}initParticles(t){let e=0,i=t;for(;i;){let t;t=this.spacing?this.start+this.spacing*e:Math.random()*Math.PI*2,i.rotation=t,this.distance&&(i.position.x=this.distance,Zh(t,i.position)),i=i.next,++e}}}Sl.type="spawnBurst",Sl.editorConfig=null;class wl{constructor(t){this.order=sl.Normal,this.list=new vl(!0),this.list.reset(Yh.createList(t.color))}initParticles(t){let e=t;const i=this.list.first.value,r=Qh(i.r,i.g,i.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}wl.type="color",wl.editorConfig=null;class Cl{constructor(t){this.order=sl.Normal;let e=t.color;"#"===e.charAt(0)?e=e.substr(1):0===e.indexOf("0x")&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}Cl.type="colorStatic",Cl.editorConfig=null;class Pl{constructor(t){this.order=sl.Normal,this.index=0,this.textures=t.textures.map((t=>"string"==typeof t?qh(t):t))}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Pl.type="textureOrdered",Pl.editorConfig=null;const Rl=new ae,Il=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2","abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","cos","cosh","exp","expm1","floor","fround","hypot","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh"],Ml=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(Il).join("|"),"g");class Dl{constructor(t){var e;if(this.order=sl.Late,t.path)if("function"==typeof t.path)this.path=t.path;else try{this.path=function(t){const e=t.match(Ml);for(let t=e.length-1;t>=0;--t)Il.indexOf(e[t])>=0&&(e[t]=`Math.${e[t]}`);return t=e.join(""),new Function("x",`return ${t};`)}(t.path)}catch(t){this.path=null}else this.path=t=>t;this.list=new vl(!1),this.list.reset(Yh.createList(t.speed)),this.minMult=null!==(e=t.minMult)&&void 0!==e?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new ae(e.x,e.y),e.config.movement=0;const t=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=t,e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=i*e,Rl.x=t.config.movement,Rl.y=this.path(Rl.x),Zh(t.config.initRotation,Rl),t.position.x=t.config.initPosition.x+Rl.x,t.position.y=t.config.initPosition.y+Rl.y}}Dl.type="movePath",Dl.editorConfig=null;class Fl{constructor(){this.order=sl.Spawn}initParticles(t){}}Fl.type="spawnPoint",Fl.editorConfig=null;class Bl{constructor(t){this.order=sl.Normal,this.textures=t.textures.map((t=>"string"==typeof t?qh(t):t))}initParticles(t){let e=t;for(;e;){const t=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[t],e=e.next}}}Bl.type="textureRandom",Bl.editorConfig=null;class Ll{constructor(t){this.order=sl.Normal,this.minStart=t.minStart*Kh,this.maxStart=t.maxStart*Kh,this.minSpeed=t.minSpeed*Kh,this.maxSpeed=t.maxSpeed*Kh,this.accel=t.accel*Kh}initParticles(t){let e=t;for(;e;)this.minStart===this.maxStart?e.rotation+=this.maxStart:e.rotation+=Math.random()*(this.maxStart-this.minStart)+this.minStart,e.config.rotSpeed=Math.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel){const i=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+i)/2*e}else t.rotation+=t.config.rotSpeed*e}}Ll.type="rotation",Ll.editorConfig=null;class Ol{constructor(t){this.order=sl.Normal,this.min=t.min*Kh,this.max=t.max*Kh}initParticles(t){let e=t;for(;e;)this.min===this.max?e.rotation+=this.max:e.rotation+=Math.random()*(this.max-this.min)+this.min,e=e.next}}Ol.type="rotationStatic",Ol.editorConfig=null;class Nl{constructor(t){this.order=sl.Late+1,this.rotation=(t.rotation||0)*Kh}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Nl.type="noRotation",Nl.editorConfig=null;class kl{constructor(t){var e;this.order=sl.Normal,this.list=new vl(!1),this.list.reset(Yh.createList(t.scale)),this.minMult=null!==(e=t.minMult)&&void 0!==e?e:1}initParticles(t){let e=t;for(;e;){const t=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=t,e.scale.x=e.scale.y=this.list.first.value*t,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}kl.type="scale",kl.editorConfig=null;class Ul{constructor(t){this.order=sl.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const t=Math.random()*(this.max-this.min)+this.min;
9e.scale.x=e.scale.y=t,e=e.next}}}Ul.type="scaleStatic",Ul.editorConfig=null;class Gl{constructor(t){this.order=sl.Spawn;const e=Gl.shapes[t.type];if(!e)throw new Error(`No shape found with type '${t.type}'`);this.shape=new e(t.data)}static registerShape(t,e){Gl.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Gl.type="spawnShape",Gl.editorConfig=null,Gl.shapes={},Gl.registerShape(ul),Gl.registerShape(hl),Gl.registerShape(ll),Gl.registerShape(ll,"circle");class zl{constructor(t){this.order=sl.Normal,this.texture="string"==typeof t.texture?qh(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}zl.type="textureSingle",zl.editorConfig=null;class Hl{constructor(t){var e;this.order=sl.Late,this.list=new vl(!1),this.list.reset(Yh.createList(t.speed)),this.minMult=null!==(e=t.minMult)&&void 0!==e?e:1}initParticles(t){let e=t;for(;e;){const t=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=t,e.config.velocity?e.config.velocity.set(this.list.first.value*t,0):e.config.velocity=new ae(this.list.first.value*t,0),Zh(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;!function(t){const e=1/Jh(t);t.x*=e,t.y*=e}(r),tl(r,i),t.x+=r.x*e,t.y+=r.y*e}}Hl.type="moveSpeed",Hl.editorConfig=null;class Xl{constructor(t){this.order=sl.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const t=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(t,0):e.config.velocity=new ae(t,0),Zh(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity;t.x+=i.x*e,t.y+=i.y*e}}function Vl(t,e){var i,r,s,n,o,a,h,l,u,c,d,f,p,m,g,_,v,x,y,b,T;if("behaviors"in t)return t;const E={lifetime:t.lifetime,ease:t.ease,particlesPerWave:t.particlesPerWave,frequency:t.frequency,spawnChance:t.spawnChance,emitterLifetime:t.emitterLifetime,maxParticles:t.maxParticles,addAtBack:t.addAtBack,pos:t.pos,emit:t.emit,autoUpdate:t.autoUpdate,behaviors:[]};if(t.alpha)if("start"in t.alpha)if(t.alpha.start===t.alpha.end)1!==t.alpha.start&&E.behaviors.push({type:"alphaStatic",config:{alpha:t.alpha.start}});else{const e={list:[{time:0,value:t.alpha.start},{time:1,value:t.alpha.end}]};E.behaviors.push({type:"alpha",config:{alpha:e}})}else 1===t.alpha.list.length?1!==t.alpha.list[0].value&&E.behaviors.push({type:"alphaStatic",config:{alpha:t.alpha.list[0].value}}):E.behaviors.push({type:"alpha",config:{alpha:t.alpha}});if(t.acceleration&&(t.acceleration.x||t.acceleration.y)){let e,s;"start"in t.speed?(e=t.speed.start*(null!==(i=t.speed.minimumSpeedMultiplier)&&void 0!==i?i:1),s=t.speed.start):(e=t.speed.list[0].value*(null!==(r=t.minimumSpeedMultiplier)&&void 0!==r?r:1),s=t.speed.list[0].value),E.behaviors.push({type:"moveAcceleration",config:{accel:t.acceleration,minStart:e,maxStart:s,rotate:!t.noRotation,maxSpeed:t.maxSpeed}})}else if(null===(s=t.extraData)||void 0===s?void 0:s.path){let e,i;"start"in t.speed?(i=null!==(n=t.speed.minimumSpeedMultiplier)&&void 0!==n?n:1,e=t.speed.start===t.speed.end?{list:[{time:0,value:t.speed.start}]}:{list:[{time:0,value:t.speed.start},{time:1,value:t.speed.end}]}):(e=t.speed,i=null!==(o=t.minimumSpeedMultiplier)&&void 0!==o?o:1),E.behaviors.push({type:"movePath",config:{path:t.extraData.path,speed:e,minMult:i}})}else if(t.speed)if("start"in t.speed)if(t.speed.start===t.speed.end)E.behaviors.push({type:"moveSpeedStatic",config:{min:t.speed.start*(null!==(a=t.speed.minimumSpeedMultiplier)&&void 0!==a?a:1),max:t.speed.start}});else{const e={list:[{time:0,value:t.speed.start},{time:1,value:t.speed.end}]};E.behaviors.push({type:"moveSpeed",config:{speed:e,minMult:t.speed.minimumSpeedMultiplier}})}else 1===t.speed.list.length?E.behaviors.push({type:"moveSpeedStatic",config:{min:t.speed.list[0].value*(null!==(h=t.minimumSpeedMultiplier)&&void 0!==h?h:1),max:t.speed.list[0].value}}):E.behaviors.push({type:"moveSpeed",config:{speed:t.speed,minMult:null!==(l=t.minimumSpeedMultiplier)&&void 0!==l?l:1}});if(t.scale)if("start"in t.scale){const e=null!==(u=t.scale.minimumScaleMultiplier)&&void 0!==u?u:1;if(t.scale.start===t.scale.end)E.behaviors.push({type:"scaleStatic",config:{min:t.scale.start*e,max:t.scale.start}});else{const i={list:[{time:0,value:t.scale.start},{time:1,value:t.scale.end}]};E.behaviors.push({type:"scale",config:{scale:i,minMult:e}})}}else if(1===t.scale.list.length){const e=null!==(c=t.minimumScaleMultiplier)&&void 0!==c?c:1,i=t.scale.list[0].value;E.behaviors.push({type:"scaleStatic",config:{min:i*e,max:i}})}else E.behaviors.push({type:"scale",config:{scale:t.scale,minMult:null!==(d=t.minimumScaleMultiplier)&&void 0!==d?d:1}});
9if(t.color)if("start"in t.color)if(t.color.start===t.color.end)"ffffff"!==t.color.start&&E.behaviors.push({type:"colorStatic",config:{color:t.color.start}});else{const e={list:[{time:0,value:t.color.start},{time:1,value:t.color.end}]};E.behaviors.push({type:"color",config:{color:e}})}else 1===t.color.list.length?"ffffff"!==t.color.list[0].value&&E.behaviors.push({type:"colorStatic",config:{color:t.color.list[0].value}}):E.behaviors.push({type:"color",config:{color:t.color}});if(t.rotationAcceleration||(null===(f=t.rotationSpeed)||void 0===f?void 0:f.min)||(null===(p=t.rotationSpeed)||void 0===p?void 0:p.max)?E.behaviors.push({type:"rotation",config:{accel:t.rotationAcceleration||0,minSpeed:(null===(m=t.rotationSpeed)||void 0===m?void 0:m.min)||0,maxSpeed:(null===(g=t.rotationSpeed)||void 0===g?void 0:g.max)||0,minStart:(null===(_=t.startRotation)||void 0===_?void 0:_.min)||0,maxStart:(null===(v=t.startRotation)||void 0===v?void 0:v.max)||0}}):((null===(x=t.startRotation)||void 0===x?void 0:x.min)||(null===(y=t.startRotation)||void 0===y?void 0:y.max))&&E.behaviors.push({type:"rotationStatic",config:{min:(null===(b=t.startRotation)||void 0===b?void 0:b.min)||0,max:(null===(T=t.startRotation)||void 0===T?void 0:T.max)||0}}),t.noRotation&&E.behaviors.push({type:"noRotation",config:{}}),t.blendMode&&"normal"!==t.blendMode&&E.behaviors.push({type:"blendMode",config:{blendMode:t.blendMode}}),Array.isArray(e)&&"string"!=typeof e[0]&&"framerate"in e[0]){for(let t=0;t<e.length;++t)"matchLife"===e[t].framerate&&(e[t].framerate=-1);E.behaviors.push({type:"animatedRandom",config:{anims:e}})}else"string"!=typeof e&&"framerate"in e?("matchLife"===e.framerate&&(e.framerate=-1),E.behaviors.push({type:"animatedSingle",config:{anim:e}})):t.orderedArt&&Array.isArray(e)?E.behaviors.push({type:"textureOrdered",config:{textures:e}}):Array.isArray(e)?E.behaviors.push({type:"textureRandom",config:{textures:e}}):E.behaviors.push({type:"textureSingle",config:{texture:e}});if("burst"===t.spawnType)E.behaviors.push({type:"spawnBurst",config:{start:t.angleStart||0,spacing:t.particleSpacing,distance:0}});else if("point"===t.spawnType)E.behaviors.push({type:"spawnPoint",config:{}});else{let e;"ring"===t.spawnType?e={type:"torus",data:{x:t.spawnCircle.x,y:t.spawnCircle.y,radius:t.spawnCircle.r,innerRadius:t.spawnCircle.minR,affectRotation:!0}}:"circle"===t.spawnType?e={type:"torus",data:{x:t.spawnCircle.x,y:t.spawnCircle.y,radius:t.spawnCircle.r,innerRadius:0,affectRotation:!1}}:"rect"===t.spawnType?e={type:"rect",data:t.spawnRect}
9:"polygonalChain"===t.spawnType&&(e={type:"polygonalChain",data:t.spawnPolygon}),e&&E.behaviors.push({type:"spawnShape",config:e})}return E}Xl.type="moveSpeedStatic",Xl.editorConfig=null,al.registerBehavior(cl),al.registerBehavior(xl),al.registerBehavior(yl),al.registerBehavior(Tl),al.registerBehavior(El),al.registerBehavior(Al),al.registerBehavior(Sl),al.registerBehavior(wl),al.registerBehavior(Cl),al.registerBehavior(Pl),al.registerBehavior(Dl),al.registerBehavior(Fl),al.registerBehavior(Bl),al.registerBehavior(Ll),al.registerBehavior(Ol),al.registerBehavior(Nl),al.registerBehavior(kl),al.registerBehavior(Ul),al.registerBehavior(Gl),al.registerBehavior(zl),al.registerBehavior(Hl),al.registerBehavior(Xl);export{Wr as A,Kr as B,Zr as C,Qr as D,al as E,Jr as F,Ro as G,Bo as M,ts as N,ae as P,gi as R,Xr as S,mi as T,f as W,qr as a,Gr as b,ri as c,S as d,T as e,Sr as f,tn as g,ht as h,Vl as i,d as j,$o as k,wh as l,Qo as m,Oa as n,$h as o,fa as p,ko as q,No as r,lt as s,Oo as t,Lh as u,E as v};
10//# [email protected]

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.